This function will generate an impulse response function (IRF)
for a given covariate. The IRF shows the marginal impact of a 1-unit
change in the covariate on a person's ideal point over time. To use
this function, the vary_ideal_pts
option in
id_estimate
must have received the 'AR1'
option
as IRFs are only available for the AR(1) auto-regressive model.
id_plot_irf(object, cov_name = NULL, label_high = "Liberal",
label_low = "Conservative", pred_outcome = NULL, recalc_vals = F,
include = NULL, time_calc = 10, time_label = "Time Points",
line_type = 2, line_width = 1, line_alpha = 1,
line_color = "red", ci_color = "black", ci_alpha = 0.5,
use_ci = TRUE, high_quantile = 0.95, low_quantile = 0.05,
calc_varying = T)
A fitted idealstan
object
The name of the covariate to plot. Leave blank to select from a list of available covariates
The character label for the upper end of the latent scale
The character label for the lower end of the latent scale
For discrete models with more than 2 categories,
or binary models with missing data, which outcome to predict. This should
be a character value that matches what the outcome was coded as in the data
passed to id_make
.
Whether to combine two variables into one through addition before
computing IRFs. If TRUE
, two names of parameters should be passed to
cov_name
or selected from the dialog list
A list of character names of person or group IDs for which to calculate IRFs
The maximum number of time points over which to calculate the IRF
Character string specifying the type of time points (default is just
"Time Points"
)
The line type of the IRF line (see ggplot2
documentation)
The line width of the IRF line (see ggplot2
documentation)
The line alpha (transparency) of the IRF line (see ggplot2
documentation)
The color of the IRF line (see ggplot2
documentation)
The color of the IRF credible interval (see ggplot2
documentation)
The alpha of the IRF credible interval (see ggplot2
documentation)
Whether or not to plot a credible interval around the lines
The upper limit of the posterior density to use for calculating credible intervals
The lower limit of the posterior density to use for calculating credible intervals
if TRUE
, will calculate marginal effects of the
covariates on each end of the latent scale (see vignette for more information)
a ggplot2
object that can be further customized if necessary