我在两个级别的数据(课程中的学生)上运行 HMI,而学生级别的数据缺失。当我包含缺少数据的二进制值(性别)时,代码会引发以下错误(错误:C 堆栈使用 7969776 太接近限制)。
下面是一个可重现的例子。
library(MCMCglmm)
library(hmi)
library(mice)
df <- data.frame(post = rtnorm(100,60,20,0,100),
pre = rtnorm(100,40,20,0,100),
gender = rbinom(n=100, size=1, prob=0.20),
course = rep( c("A","B","C","D"), 100*c(0.1,0.2,0.65,0.05) ))
df$post[1:round((0.3)*length(df$post),digits = 0)] <- NA
df$gender[round((0.2)*length(df$post),digits = 0):round((0.5)*length(df$post),
digits = 0)] <- NA
hmi_test <- hmi(df, model_formula = post ~ 1 + pre + gender + (1|course ),
M = 2, maxit = 5, list_of_types = NULL, nitt = 3000, burnin = 1000)
list_of_types_maker(df)