R 在GLMMadaptive包中生成效果图

R 在GLMMadaptive包中生成效果图,r,R,尝试在使用GLMMadaptive::mixed_model()和effects::predictereffect()函数创建的对象上运行效果图时,我收到一条无法理解的错误消息 下面是一个由toy二进制纵向数据创建的示例问题,该数据使用GLMMadaptive包中包含的一个渐晕图提供的代码创建 # Library Relevant Packages library(GLMMadaptive) library(effects) # Now we constuct a data frame wit

尝试在使用
GLMMadaptive::mixed_model()
effects::predictereffect()
函数创建的对象上运行效果图时,我收到一条无法理解的错误消息

下面是一个由toy二进制纵向数据创建的示例问题,该数据使用
GLMMadaptive
包中包含的一个渐晕图提供的代码创建

# Library Relevant Packages
library(GLMMadaptive)
library(effects)

# Now we constuct a data frame with the design: 
# everyone has a baseline measurment, and then measurements at random follow-up times
DF <- data.frame(id = rep(seq_len(n), each = K),
                 time = c(replicate(n, c(0, sort(runif(K - 1, 0, t_max))))),
                 sex = rep(gl(2, n/2, labels = c("male", "female")), each = K))

# design matrices for the fixed and random effects
X <- model.matrix(~ sex * time, data = DF)
Z <- model.matrix(~ time, data = DF)

betas <- c(-2.13, -0.25, 0.24, -0.05) # fixed effects coefficients
D11 <- 0.48 # variance of random intercepts
D22 <- 0.1 # variance of random slopes

# we simulate random effects
b <- cbind(rnorm(n, sd = sqrt(D11)), rnorm(n, sd = sqrt(D22)))
# linear predictor
eta_y <- as.vector(X %*% betas + rowSums(Z * b[DF$id, ]))
# we simulate binary longitudinal data
DF$y <- rbinom(n * K, 1, plogis(eta_y))
…我们得到以下错误

Error in mod.matrix %*% scoef : non-conformable arguments

以前有人遇到过这个问题吗?如果是,找到了解决方法吗?

@Dimitris Rizopoulos,我想让你知道这一点。不确定问题是什么。这可能只是意味着
effects
不支持这些模型。您不使用由
GLMMadaptive
本身提供的
effectPlotData
函数的任何原因?该
effectPlotData()
函数在Axeman确实起作用,我刚刚查看了小插图,想知道为什么
predictor effect()
函数不起作用。在小插曲中提供的代码不起作用是很少见的。不是前所未闻,但很不寻常。啊,好吧,我不清楚
预测器效应
代码是否也来自小插曲。您应该在github上打开一个问题。
plot(predictorEffect("time", fm), type = "link")
Error in mod.matrix %*% scoef : non-conformable arguments