Marginal Effects Plot for Hierarchical Covariates
Description
This function will calculate and plot the ideal point marginal effects, or the first derivative of the IRT/ideal point model with respect to the hierarchical covariate, for each item in the model. The function id_me
is used to first calculate the ideal point marginal effects.
Usage
id_plot_cov(
object,
calc_param = NULL,
label_high = "High",
label_low = "Low",
group_effects = NULL,
plot_model_id = NULL,
pred_outcome = NULL,
lb = 0.05,
upb = 0.95,
facet_ncol = 2,
cov_type = "person_cov",
...
)
Arguments
object
|
A fitted idealstan object
|
calc_param
|
Whether to calculate ideal point marginal effects for a given covariate. If NULL, the default, the function will instead produce a plot of the raw coefficients from the ideal point model. If passing the name of a covariate, should be a character value of a column in the data passed to the id_make function.
|
label_high
|
What label to use on the plot for the high end of the latent scale |
label_low
|
What label to use on the plot for the low end of the latent scale |
plot_model_id
|
The integer of the model ID to plot. If NULL and there are multiple model types, facet_wrap will be used to produce multiple plots with one for each model type.
|
pred_outcome
|
For discrete models with more than 2 categories, or binary models with missing data, which outcome to predict. This should be the value that matches what the outcome was coded as in the data passed to id_make .
|
lb
|
The lower limit of the posterior density to use for calculating credible intervals |
upb
|
The upper limit of the posterior density to use for calculating credible intervals |
facet_ncol
|
If facetting by multiple models or grouped factors, sets the number of columns in the multiple plots |
cov_type
|
Either ‘person_cov’ for person or group-level hierarchical parameters, ‘discrim_reg_cov’ for bill/item discrimination parameters from regular (non-inflated) model, and ‘discrim_infl_cov’ for bill/item discrimination parameters from inflated model.
|
…
|
Additional argument passed on to id_me
|
Details
The ends of the latent variable can be specified via the label_low
and label_high
options, which will use those labels for item discrimination.
Note that the function produces a ggplot2
object, which can be further modified with ggplot2
functions.
Value
A ggplot2
plot that can be further customized with ggplot2
functions if need be.