Open StanOkl opened 4 years ago
Do you have a reproducible example?
Do you have a reproducible example?
I have the same problem. Run the following code:
library(sjPlot)
data("efc")
model <- lm(c12hour ~ e15relat * e16sex, data = efc)
tab_model(model)
You can see that the interaction term appears as the variable names but not the labels. I think it is better to automatically convert the variable names to labels in the interaction term in order to keep consistent with the single regressors.
I saw this recent post and think I have a similar problem (variable names instead of labels used in plot).
Reproducible example based on my code:
library(sjPlot)
library(mgcv)
# create dataframe
set.seed(1)
d <- data.frame(f1 = rep(sample(1:50, 50),6),
f2 = sample(1:4, 300, replace = T),
c1 = rep(seq(0.01,1, by =0.01), 3),
c2 = sample(1:8000, 300),
r = rnorm(n=300)/2 +0.5)
d$f1 <- factor(d$f1)
d$f2 <- factor(d$f2)
# add label to c2
d <- apply_labels(d,c2 = 'this is label c2')
str(d)
# model (gamm)
mm <- gam(data = d,
formula = r ~ f2 + s(c1) + s(c2)+ s(f1, bs = "re"),
family = betar(link = logit), method = 'REML')
# plot model
plot_model(model = mm,
type = "pred",
ci.lvl = NA,
terms = c("c1","f2","c2 [100, 500, 1000]"),
auto.label = T)
If there is another way to change the labels/titles of the different facets in the produced plot, that would also be a solution for me. Cheers
Apologies if this has been answered already, but I couldn't find it. I'm trying to plot coefficients with the plot_model() function and my model has several interaction terms. I've relabeled the variables (with apply_labels from the expss package), but the interaction terms are using the variable name, rather than the label.
Is there a way to modify this without having to change the variable names used to estimate the regression?