marginalplot | R Documentation |
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.
marginalplot(x, predictors, conf.int = 0.95, plot.title = NULL)
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. |
A ggplot2 object.
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"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.