【问题标题】:Multivariate deterministic regression imputation via mice leads to unstable results通过小鼠进行的多变量确定性回归插补导致结果不稳定
【发布时间】:2018-05-03 12:06:00
【问题描述】:

mice R 包通过指定method = "norm.predict" 提供确定性回归插补。由于确定性回归插补的性质,即不向插补值添加噪声,我希望插补值始终相同,无论我使用哪种种子。对于单变量缺失,这似乎有效。但是,我在估算多变量缺失时发现了不一致之处。下面用一个可重现的例子来说明这个问题:

library("mice")

# Example 1: Univariate missings (works fine)
data1 <- data.frame(x1 = c(NA, NA, NA, 8, 5, 1, 7, 4),
                    x2 = c(2, 13, 12, 5, 6, 6, 1, 2),
                    x3 = c(4, 7, 4, 5, 1, 2, 7, 3))

# Impute univariate missings
imp <- mice(data1, method = "norm.predict", m = 1)
complete(imp) # Always the same result


# Example 2: Multivariate missings (leads to inconsistent imputations)
data2 <- data1
data2[4, 2] <- NA

# Impute multivariate missings
imp1 <- mice(data2, method = "norm.predict", m = 1, seed = 111)
imp2 <- mice(data2, method = "norm.predict", m = 1, seed = 222)

# Results are different
complete(imp1)
complete(imp2)

问题:为什么小鼠的多元确定性回归插补不一致?

【问题讨论】:

  • 可以肯定的是,您的问题是“为什么mice() 函数的seed 参数不能正常工作?”。对我来说似乎是一个错误。
  • @F.Privé 不,我的问题是:当我使用不同的种子时,为什么估算值不同?如果我理解正确,确定性回归插补不涉及随机性。出于这个原因,我希望种子不会影响估算值。但是,在上面的示例中,结果取决于种子。为什么?

标签: r missing-data deterministic imputation r-mice


【解决方案1】:

来自?mice 看看data.init 参数的描述:

data.init 与数据大小和类型相同的数据框,不包含 缺失数据,用于在开始之前初始化插补 迭代过程。 默认 NULL 表示开始插补 是通过从数据中简单随机抽取而创建的。注意 data.init 的规范将启动 m Gibbs 采样流 来自相同的估算。

这就是随机性的来源。不是来自 norm.predict 方法本身,正如你所说,它是完全确定的。 (您可以在控制台输入mice.impute.norm.predict 来查看确认方法)。

所以为了避免随机抽样,我们必须提供micedata.init

data.init = data2
for (i in 1:ncol(data.init)) data.init[, i][is.na(data.init[, i])] = 1

imp1 <- mice(data2, method = "norm.predict", m = 1, data.init = data.init, seed = 111)
imp2 <- mice(data2, method = "norm.predict", m = 1, data.init = data.init, seed = 222)

# Results are the same
complete(imp1)
complete(imp2)

【讨论】:

  • 非常感谢这个完美的答案!
猜你喜欢
  • 2018-07-26
  • 1970-01-01
  • 2022-01-22
  • 2020-09-03
  • 1970-01-01
  • 2017-10-15
  • 1970-01-01
  • 2021-05-04
  • 2020-05-11
相关资源
最近更新 更多