如何解释Hmisc包中aregImpute()的结果以及如何确定NK值?

问题描述 投票:0回答:0

我刚刚查看了Hmisc包中aregImpute()函数的文档,示例如下:

# Example 1: large sample size, much missing data, no overlap in
# NAs across variables
x1 <- factor(sample(c('a','b','c'),1000,TRUE))
x2 <- (x1=='b') + 3*(x1=='c') + rnorm(1000,0,2)
x3 <- rnorm(1000)
y  <- x2 + 1*(x1=='c') + .2*x3 + rnorm(1000,0,2)
orig.x1 <- x1[1:250]
orig.x2 <- x2[251:350]
x1[1:250] <- NA
x2[251:350] <- NA
d <- data.frame(x1,x2,x3,y, stringsAsFactors=TRUE)
# Find value of nk that yields best validating imputation models
# tlinear=FALSE means to not force the target variable to be linear
f <- aregImpute(~y + x1 + x2 + x3, nk=c(0,3:5), tlinear=FALSE,
                data=d, B=10) # normally B=75
f

我运行代码到此为止,控制台在

view(f)
时返回一个列表。 让我感到困惑的是在它试图
Find value of nk that yields.....
的例子中,但是你如何用列表(即来自
view(f)
)做到这一点。

请帮忙!

r imputation hmisc
© www.soinside.com 2019 - 2024. All rights reserved.