[R] How can we get a predicted value that are used to plot the figure using a plot_model function of sjPlot?

Peter Wagey peter@w@g|ey09 @end|ng |rom gm@||@com
Sat Sep 19 10:28:56 CEST 2020


Hi R users,
I was trying to create a figure of three-way-interactions. There is a
function "plot-model" but I was wondering whether we can extract the
predicted value before we run the "plot-model" function.
For example:
in this example,
plot_model(fit, type = "pred", terms = c("c12hour", "barthtot [30,50,70]",
"c161sex"))
How can we see the predicted values that are used to plot the figure? If we
can see the data (predicted values), we could use other functions to create
another type of figures.
Thank you very much for your suggestions.

Thanks,

Peter
#############
library(sjPlot)
library(sjmisc)
library(ggplot2)
data(efc)
theme_set(theme_sjplot())

# make categorical
efc$c161sex <- to_factor(efc$c161sex)

# fit model with 3-way-interaction
fit <- lm(neg_c_7 ~ c12hour * barthtot * c161sex, data = efc)

# select only levels 30, 50 and 70 from continuous variable Barthel-Index
plot_model(fit, type = "pred", terms = c("c12hour", "barthtot [30,50,70]",
"c161sex"))

How can we get the predicted value that is used to plot the graph? we would
like to see the predicted value using three groups of barthtot
[30,50,70].Is there any way we can extract the data (predicted value) so
that we can use other graphic functions to create figures?

	[[alternative HTML version deleted]]



More information about the R-help mailing list