Plot Posterior Predictive Distribution for idealstan
Objects
Description
This function is the actual method for generating posterior distributions from a fitted idealstan
model.
Usage
## S4 method for signature 'idealstan'
id_plot_ppc(
object,
ppc_pred = NULL,
group = NULL,
item = NULL,
combine_item = TRUE,
type = NULL,
which_mod = NULL,
prompt_plot = TRUE,
observed_only = FALSE,
...
)
Arguments
object
|
A fitted idealstan object |
ppc_pred
|
The output of the id_post_pred function on a fitted idealstan object
|
group
|
A character vector of the person or group IDs over which to subset the predictive distribution |
item
|
A character vector of the item IDs over which to subset the predictive distribution |
combine_item
|
Whether to combine all items together (TRUE) or create one plot for each item (FALSE) |
type
|
Whether to plot "continuous" or "discrete" responses |
which_mod
|
If you are producing one plot aggregating data across multiple items and you have different item distributions, then you need to specify the item type number to plot (see function documentation in id_estimate ).
|
prompt_plot
|
Whether to expect a user prompt for each plot if multiple plots are produced (defaults to TRUE) If NULL (default), will use the type specified in the data. However, if both continuous and discrete items are present, will throw an error if NULL. |
observed_only
|
If the outcome is discrete and has missing data inflation, set to TRUE to only see the observed responses in the plot or FALSE to see all of the responses (missing data category will be the largest). |
…
|
Other arguments passed on to ppc_bars
|
Details
This function is a wrapper around ppc_bars
, ppc_dens_overlay
and ppc_violin_grouped
that plots the posterior predictive distribution derived from id_post_pred
against the original data. Because idealstan
allows for different distributions for each item, this function can either produce one predictive distribution for all items (the default) or it can produce one distribution for each item (set combine_item
to FALSE
). The latter is helpful if you have mixed distributions between items, such as continuous and dichotomous values. You can also subset the posterior predictions over legislators/persons or bills/item sby specifying the ID of each in the original data as a character vector. Only persons or items can be specified, not both.
If you specify a value for group
that is either a person ID or a group ID (depending on whether a person or group-level model was fit), then you can see the posterior distributions for those specific persons. Similarly, if an item ID is passed to item
, you can see how well the model predictions compare to the true values for that specific item.