【发布时间】: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