在包mi
中,我发现每个运行插补的结果与完全相同的选项不同。请考虑以下代码:
library(mi)
data(nlsyV)
mdf = missing_data.frame(nlsyV)
imputations = mi(mdf, n.iter = 30, n.chains = 4, seed=123)
data1 = complete(imputations, 4)
summary(data1[[4]]$ppvtr.36) #ppvtr.36 is one of the variables with missing values and now has the imputed values
曾经运行变量ppvtr.36
的代码的结果是:
Min. 1st Qu. Median Mean 3rd Qu. Max.
41.00 74.00 87.00 86.08 99.00 132.00
如果代码再次运行,结果为:
Min. 1st Qu. Median Mean 3rd Qu. Max.
27.96 72.89 86.50 85.58 98.86 138.60
显然,每次执行时估算的结果都不同,但种子是固定的。这是正常的吗?