std.est = "std2" does not seem to work in plot_models using lme4 model
StijnHeirb opened this issue · comments
When using a lme4 model in plot_models, std.est = "std2" does not seem to work.
Small example to reproduce the problem:
library(lme4)
library(sjPlot)
Dataset with repeated measures for Id
set.seed(123)
Dat1 <- data.frame(Id = as.factor(rep(c(1:10),10)),
Response = rnorm(100,10,0.5))
Dat2 <- data.frame(Id = as.factor(rep(c(11:20),10)),
Response = rnorm(100,11,0.5))
Dat <- rbind(Dat1, Dat2)
Dat$Var1 <- rnorm(200,2,1) + Dat$Response
Dat$Var2 <- rnorm(200,4,1) + Dat$Response
2 basic models
Fit1 <- lmer(Response ~ Var1 + (1|Id), data = Dat)
Fit2 <- lmer(Response ~ Var1 + Var2 + (1|Id), data = Dat)
std2 for a single model in plot_model works
plot_model(Fit2, show.values = TRUE)
plot_model(Fit2, show.values = TRUE, show.p = TRUE, type = "std2")
std2 in plot_models does not seem to work
plot_models(Fit1, Fit2, show.values = TRUE)
plot_models(Fit1, Fit2, std.est = "std2", show.values = TRUE)
Any ideas? Thanks in advance.
Thanks, should be fixed
library(lme4)
#> Loading required package: Matrix
library(sjPlot)
set.seed(123)
Dat1 <- data.frame(Id = as.factor(rep(c(1:10),10)),
Response = rnorm(100,10,0.5))
Dat2 <- data.frame(Id = as.factor(rep(c(11:20),10)),
Response = rnorm(100,11,0.5))
Dat <- rbind(Dat1, Dat2)
Dat$Var1 <- rnorm(200,2,1) + Dat$Response
Dat$Var2 <- rnorm(200,4,1) + Dat$Response
Fit1 <- lmer(Response ~ Var1 + (1|Id), data = Dat)
Fit2 <- lmer(Response ~ Var1 + Var2 + (1|Id), data = Dat)
plot_models(Fit1, Fit2, show.values = TRUE)
plot_models(Fit1, Fit2, std.est = "std2", show.values = TRUE)
Created on 2023-03-31 with reprex v2.0.2