library(idealstan)
# To demonstrate, we load the 114th Senate data and fit a time-varying model
data('senate114_fit')
<- id_make(senate114,outcome = 'cast_code',
senate_data person_id = 'bioname',
item_id = 'rollnumber',
group_id= 'party_code',
time_id='date',
miss_val='Absent')
<- id_estimate(senate_data,
senate114_time_fit model_type = 2,
use_vb = T,
fixtype='vb_partial',
vary_ideal_pts='random_walk',
restrict_ind_high = "WARREN, Elizabeth",
restrict_ind_low="BARRASSO, John A.",
seed=84520)
# We plot the variances for all the Senators
id_plot_legis_var(senate114_fit)
Plot Legislator/Person Over-time Variances
Description
This function can be used on a fitted idealstan
object to plot the over-time variances (average rates of change in ideal points) for all the persons/legislators in the model.
Usage
id_plot_legis_var(
object,
return_data = FALSE,
include = NULL,
high_limit = 0.95,
low_limit = 0.05,
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.1,
group_color = TRUE,
...
)
Arguments
object
|
A fitted idealstan object
|
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 |
text_size_label
|
ggplot2 text size for legislator labels |
text_size_group
|
ggplot2 text size for group text used for points |
point_size
|
If person_labels and group_labels are set to FALSE , controls the size of the points plotted.
|
hjust_length
|
horizontal adjustment of the legislator labels |
person_labels
|
if TRUE , use the person_id column to plot labels for the person (legislator) ideal points
|
group_labels
|
if TRUE , use the group column to plot text markers for the group (parties) from the person/legislator data
|
person_ci_alpha
|
The transparency level of the dot plot and confidence bars for the person ideal points |
group_color
|
If TRUE , give each group/bloc a different color
|
…
|
Other options passed on to plotting function, currently ignored |
Details
This function will plot the person/legislator over-time variances as a vertical dot plot with associated high-density posterior interval (can be changed with high_limit
and low_limit
options).