# idealstan v0.7.1

0

0th

Percentile

## Generalized IRT Ideal Point Models with 'Stan'

Offers item-response theory (IRT) ideal-point estimation for binary, ordinal, counts and continuous responses with time-varying and missing-data inference. Full and approximate Bayesian sampling with 'Stan' (<https://mc-stan.org/>).

# Introduction to R Package Idealstan

Robert Kubinec October 26, 2018

Note: To report bugs with the package, please file an issue on the Github page. You are currently reading the README file, which largely follows the introductory vignette in the package. To install this package, type the command devtools::install_github('saudiwin/idealstan',local=F) at the R console prompt. To include the package vignettes in the package install, which can be accessed by the command vignette(package='idealstan), use instead the command devtools::install_github('saudiwin/idealstan',local=F,build_vignette=TRUE). To install the unstable development branch develop, use this command: devtools::install_github('saudiwin/idealstan',local=F,ref='develop').

If you use this package, please cite the following:

Kubinec, Robert. "Generalized Ideal Point Models for Time-Varying and Missing-Data Inference". Working Paper.

This package implements IRT (item response theory) ideal point models, which are models designed for situations in which actors make strategic choices that correlate with a unidimensional scale, such as the left-right axis in American politics. Compared to traditional IRT, ideal point models examine the polarizing influence of a set of items on a set of persons, and has simlarities to models based on Euclidean latent spaces, such as multi-dimensional scaling. For more information, I refer you to my paper presented at StanCon 2018 and the R package vignettes that can be accessed on CRAN.

The goal of idealstan is to offer both standard ideal point models and additional models for missing data, time-varying ideal points and diverse responses, such as binary, ordinal, count, continuous and positive-continuous outcomes. In addition, idealstan uses the Stan estimation engine to offer full and variational Bayesian inference for all models so that every model is estimated with uncertainty. The package also exploits variational inference to automatically identify models instead of requiring users to pre-specify which persons or items in the data to constrain in advance.

The approach to handling missing data in this package is to model directly strategic censoring in observations. While this kind of missing data pattern can be found in many situations in which data is not missing at random, this particular version was developed to account for legislatures in which legislators (persons) are strategically absent for votes on bills (items). This approach to missing data can be usefully applied to many contexts in which a missing outcome is a function of the person's ideal point (i.e., people will tend to be present in the data when the item is far away or very close to their ideal point).

The package also includes ordinal ideal point models to handle situations in which a ranked outcome is polarizing, such as a legislator who can vote yes, no or to abstain. Because idealstan uses Bayesian inference, it can model any kind of ordinal data even if there aren't an even distribution of ordinal categories for each item.

The package also has extensive plotting functions via ggplot2 for model parameters, particularly the legislator (person) ideal points (ability parameters).

## Functions in idealstan

 Name Description id_estimate Estimate an idealstan model id_extract,idealstan-method Extract stan joint posterior distribution from idealstan object id_plot_all_hist Density plots of Posterior Parameters id_plot_ppc,idealstan-method Plot Posterior Predictive Distribution for idealstan Objects id_plot_cov Display Coefficient Plot of Hierarchical Covariates id_extract Generic Method for Extracting Posterior Samples id_sim_coverage Function that computes how often the true value of the parameter is included within the 95/5 high posterior density interval id_make Create data to run IRT model id_sim_gen Simulate IRT ideal point data id_plot_compare Function to compare two fitted idealstan models by plotting ideal points. Assumes that underlying data is the same for both models. id_plot_legis Plot Legislator/Person and Bill/Item Ideal Points id_plot_ppc Plot Posterior Predictive Distribution for idealstan Objects id_sim_resid Residual function for checking estimated samples compared to true simulation scores Returns a data frame with residuals plus quantiles. id_plot_rhats Plotting Function to Display Rhat Distribution id_sim_rmse RMSE function for calculating individual RMSE values compared to true simulation scores Returns a data frame with RMSE plus quantiles. stan_trace,idealstan-method Plot the MCMC posterior draws by chain senate114 Rollcall vote data for 114th Senate derive_chain Helper Function for loo calculation delaware Rollcall vote data for Delaware State Legislature id_plot_sims This function plots the results from a simulation generated by id_sim_gen. launch_shinystan Generic Method to Use shinystan with idealstan release_questions Function that provides additional check questions for package release idealdata-class Data and Identification for id_estimate idealstan-class Results of id_estimate function id_plot_legis_dyn Function to plot dynamic ideal point models id_plot_legis_var Plot Legislator/Person Over-time Variances id_plot,idealstan-method Plot Results of id_estimate id_plot Generic Function for Plotting idealstan objects id_post_pred,idealstan-method Posterior Prediction for idealstan objects id_post_pred Generic Method for Obtaining Posterior Predictive Distribution from Stan Objects stan_trace Plot the MCMC posterior draws by chain idealstan idealstan package launch_shinystan,idealstan-method Function to Launch Shinystan with an idealstan Object summary,idealstan-method Posterior Summaries for fitted idealstan object No Results!