R “如何修复”;“可变长度差异”;cv.zipath中有错误吗?

R “如何修复”;“可变长度差异”;cv.zipath中有错误吗?,r,cross-validation,R,Cross Validation,尝试使用mpath包中的cv.zipath运行零膨胀泊松模型的交叉验证 n <- dim(docvisits)[1] K <- 10 set.seed(197) foldid <- split(sample(1:n), rep(1:K, length = n)) fitcv <- cv.zipath(F_time_unemployed~ . | ., data = estimation_sample_nomiss, family = "poisson&

尝试使用
mpath
包中的
cv.zipath
运行零膨胀泊松模型的交叉验证

n <- dim(docvisits)[1]
K <- 10
set.seed(197)
foldid <- split(sample(1:n), rep(1:K, length = n))
fitcv <- cv.zipath(F_time_unemployed~ . | ., 
    data = estimation_sample_nomiss, family = "poisson",
                      nlambda = 100, lambda.count = fit.lasso$lambda.count[1:30],
                      lambda.zero = fit.lasso$lambda.zero[1:30], maxit.em = 300,
                      maxit.theta = 1, theta.fixed = FALSE, penalty = "enet",
                      rescale = FALSE, foldid = foldid)
套上套索
fit.lasso = zipath(estimation_sample_nomiss ~ .| ., 
             data = missings, 
             nlambda = 100, 
             family = "poisson", 
             link = "logit")
交叉验证
n <- dim(docvisits)[1]
K <- 10
set.seed(197)
foldid <- split(sample(1:n), rep(1:K, length = n))
fitcv <- cv.zipath(F_time_unemployed~ . | ., 
    data = estimation_sample_nomiss, family = "poisson",
                      nlambda = 100, lambda.count = fit.lasso$lambda.count[1:30],
                      lambda.zero = fit.lasso$lambda.zero[1:30], maxit.em = 300,
                      maxit.theta = 1, theta.fixed = FALSE, penalty = "enet",
                      rescale = FALSE, foldid = foldid)

n解决方案是
cv.zipath()
命令不接受TIBLE数据格式-至少在本例中是这样。(不保证本声明如何概括)。使用了dplyr命令后,需要将其转换回数据帧。因此,解决方案与.dataframe()一样简单

解决方案是,
cv.zipath()
命令不接受TIBLE数据格式-至少在本例中是这样。(不保证本声明如何概括)。使用了dplyr命令后,需要将其转换回数据帧。因此,解决方案与.dataframe()一样简单