id_plot_legis | R Documentation |
This function can be used on a fitted idealstan
object to plot the relative positions and
uncertainties of legislator/persons and bills/items.
id_plot_legis(
object,
return_data = FALSE,
include = NULL,
high_limit = 0.95,
low_limit = 0.05,
item_plot = NULL,
item_plot_type = "non-inflated",
text_size_label = 2,
text_size_group = 2.5,
point_size = 1,
hjust_length = -0.7,
person_labels = TRUE,
group_labels = F,
person_ci_alpha = 0.2,
show_true = FALSE,
group_color = TRUE,
hpd_limit = NULL,
sample_persons = NULL,
...
)
object |
A fitted |
return_data |
If true, the calculated legislator/bill data is returned along with the plot in a list |
include |
Specify a list of person/legislator IDs to include in the plot (all others excluded) |
high_limit |
The quantile (number between 0 and 1) for the high end of posterior uncertainty to show in plot |
low_limit |
The quantile (number between 0 and 1) for the low end of posterior uncertainty to show in plot |
item_plot |
The IDs (character vector) of the bill/item midpoints to overlay on the plot |
item_plot_type |
Whether to show the |
text_size_label |
ggplot2 text size for legislator labels |
text_size_group |
ggplot2 text size for group text used for points |
point_size |
If |
hjust_length |
horizontal adjustment of the legislator labels |
person_labels |
if |
group_labels |
if |
person_ci_alpha |
The transparency level of the dot plot and confidence bars for the person ideal points |
show_true |
Whether to show the true values of the legislators (if model has been simulated) |
group_color |
If |
hpd_limit |
The greatest absolute difference in high-posterior density interval shown for any point. Useful for excluding imprecisely estimated persons/legislators from the plot. Default is NULL if you don't want to exclude any. |
sample_persons |
If you don't want to use the full number of persons/legislators from the model, enter a proportion (between 0 and 1) to select only a fraction of the persons/legislators. |
... |
Other options passed on to plotting function, currently ignored |
This plot shows the distribution of ideal points for the legislators/persons in the model. It will plot them as a vertical
dot plot with associated high-density posterior interval (can be changed
with high_limit
and low_limit
options). In addition, if item/bill IDs
as a character vector is passed to the item_plot
option, then an item/bill midpoint will be overlain
on the ideal point plot, showing the point at which legislators/persons are indifferent to voting/answering on the
bill/item. Note that because this is an ideal point model, it is not possible to tell from the midpoint itself
which side will be voting which way. For that reason, the legislators/persons are colored by their votes/scores to
make it clear.
To compare across multiple idealstan
models, pass a named list
list(model1=model1,model2=model2,etc)
to the object
option.
Note that these comparisons will done by individual persons/groups, so if there are a lot of
persons/groups, consider using the include
option to only compare a specific set
of persons/groups.
## Not run:
# First create data and run a model
to_idealstan <- id_make(score_data = senate114,
outcome = 'cast_code',
person_id = 'bioname',
item_id = 'rollnumber',
group_id= 'party_code',
time_id='date',
high_val='Yes',
low_val='No',
miss_val='Absent')
sen_est <- id_estimate(senate_data,
model_type = 2,
use_vb = TRUE,
fixtype='vb_partial',
restrict_ind_high = "BARRASSO, John A.",
restrict_ind_low = "WARREN, Elizabeth")
# After running the model, we can plot
# the results of the person/legislator ideal points
id_plot_legis(sen_est)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.