我很难尝试使用该sj.plot
包从四个非嵌套线性随机效应模型中生成具有四个系数图的网格。我没有嫁给这个包,所以请随意建议其他路线(ggplot2
比解决方案更好coefplot2::coefplot2
)。
期望的输出:四个系数的图彼此相邻的网格。
复制模型:
data("sleepstudy")
sleepstudy$var2 <- rnorm(n=nrow(sleepstudy), mean=0, sd=1)
sleepstudy$var3 <- rnorm(n=nrow(sleepstudy), mean=10, sd=5)
M1 <- lmer(Reaction ~ Days + (1|Subject), data=sleepstudy, REML = FALSE)
M2 <- lmer(Reaction ~ Days + var2 + (1|Subject), data=sleepstudy, REML = FALSE)
M3 <- lmer(Reaction ~ Days + var3 + (1|Subject), data=sleepstudy, REML = FALSE)
M4 <- lmer(Reaction ~ Days + var2 + var3 + (1|Subject), data=sleepstudy, REML = FALSE)
重现问题。尝试 #1 ( sjp.lmm
)
> sjp.lmm(M1, M2, M3, M4)
Computing p-values via Kenward-Roger approximation. Use `p.kr = FALSE` if computation takes too long.
Computing p-values via Kenward-Roger approximation. Use `p.kr = FALSE` if computation takes too long.
Error in data.frame(betas, p = ps, pa = palpha, shape = pointshapes, grp = fitcnt, :
arguments imply differing number of rows: 3, 2, 1
重现问题。尝试 #2 ( sjp.lmer
+ plot_grid
)
plot.1 <- sjp.lmer(fit=M1,type="fe.std",
p.kr=FALSE,
sort.est = "sort.all",
y.offset = 0.4,
fade.ns = TRUE,
facet.grid = T)
plot.2 <- sjp.lmer(fit=M2,type="fe.std",
p.kr=FALSE,
sort.est = "sort.all",
y.offset = 0.4,
fade.ns = TRUE,
facet.grid = T)
plot.3 <- sjp.lmer(fit=M3,type="fe.std",
p.kr=FALSE,
sort.est = "sort.all",
y.offset = 0.4,
fade.ns = TRUE,
facet.grid = T)
plot.4 <- sjp.lmer(fit=M4,type="fe.std",
p.kr=FALSE,
sort.est = "sort.all",
y.offset = 0.4,
fade.ns = TRUE,
facet.grid = T)
plot_grid(list(plot.1,plot.2,plot.3,plot.4))
> plot_grid(list(plot.1,plot.2,plot.3,plot.4))
Error in gList(list(wrapvp = list(x = 0.5, y = 0.5, width = 1, height = 1, :
only 'grobs' allowed in "gList"
有没有办法获得这个情节?版本:[6] sjPlot_2.1.1
, ggplot2_2.1.0
, lme4_1.1-12
, sjmisc_2.0.1
, gridExtra_2.2.1
, dplyr_0.5.0
.