id_plot_legis_var: Plot Legislator/Person Over-time Variances

View source: R/Plot.R

id_plot_legis_varR Documentation

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 = FALSE,
  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).

Value

A ggplot2 object showing person/legislator over-time variance in ideal points as a dot plot with posterior intervals. If return_data=TRUE, a list with elements plot and data.

Examples


data('senate114')
senate114$cast_code <- ifelse(senate114$cast_code=="Absent", NA,
                              as.integer(senate114$cast_code) - 1L)
senate_data <- id_make(senate114, outcome_disc='cast_code',
                       person_id='bioname', item_id='rollnumber',
                       group_id='party_code', time_id='date')
senate_time_fit <- id_estimate(senate_data,
                               model_type=2, fixtype='vb_full',
                               vary_ideal_pts='random_walk',
                               use_method="pathfinder",
                               restrict_ind_high="WARREN, Elizabeth",
                               restrict_ind_low="BARRASSO, John A.",
                               nchains=2, ncores=4)
id_plot_legis_var(senate_time_fit)


idealstan documentation built on May 13, 2026, 1:08 a.m.