marginalplot {eirm} | R Documentation |
Plots of Estimated Marginal Effects in Explanatory IRT Models
Description
This function uses ggpredict
to calculate marginal effects for explanatory variables in
an explanatory IRT model estimated with the eirm
function. It returns a plot of estimated probabilities
generated by the explanatory IRT model while holding some predictors constant.
Usage
marginalplot(x, predictors, conf.int = 0.95, plot.title = NULL)
Arguments
x |
An eirm object returned from the |
predictors |
Character vector with the names of up to three categorical predictors from the eirm model. The first predictor is plotted on the x-axis; the second predictor is used as a group variable; the third predictor is used as a facet in the plot. |
conf.int |
Confidence interval to be used in the plot (default = 0.95 for 95% confidence intervals). |
plot.title |
A title to be used in the plot. |
Value
A ggplot2 object.
Examples
data("VerbAgg")
mod <- eirm(formula = "r2 ~ -1 + situ + btype + mode + (1|id)", data = VerbAgg)
# Only one predictor
p1 <- marginalplot(mod, predictors = c("situ"))
# Two predictors
p2 <- marginalplot(mod, predictors = c("situ", "btype"))
# All three predictors
p3 <- marginalplot(mod, predictors = c("situ", "btype", "mode"))
[Package eirm version 0.5 Index]