marginalplot: Plots of Estimated Marginal Effects in Explanatory IRT Models

Description Usage Arguments Value Examples

View source: R/marginalplot.R

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

1
marginalplot(x, predictors, conf.int = 0.95, plot.title = NULL)

Arguments

x

An eirm object returned from the eirm function.

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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"))

eirm documentation built on Oct. 25, 2021, 9:11 a.m.