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' (<>).

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).


Release v0.7.1

  • Fixed bug where time series vignette did not show on CRAN screen

Release v0.7.0

  • Implement a Gaussian process prior for ideal points to permit semi-parametric inference
  • Update id_plot_legis_dyn to allow for overlay plots comparing different time series models
  • Strength over-time model identification using variational inference fits

Release v0.6.0

  • Set a stricter threshold for vb to 1e-04 to promote more robust variational inference

Release v0.5.1

  • Fixed bugs in plotting functions related to plotting two groups.
  • Fixed bug in AR(1) model with restricted time variance.
  • Updated dependencies to rstan 2.18.2.
  • Added error-catching in covariate creation.

Release v0.5.0

  • New models for Poisson, ordinal-graded response, Normal and Log-normal outcomes.
  • Time-varying ideal point processes: random-walks and auto-regressive priors.
  • Time-varying plot functions for ideal points.
  • Hierarchical covariates for ideal points and item/bill discrimination.
  • Switched from matrix data input to long data frames.

Release v0.2.9.1

  • Fixed bugs in id_extract and id_make functions.

Release v0.2.9

  • Fixed a bug in the ideal point plot function, and also in the auto_id option in id_estimate.

Release v0.2.2

  • First release on CRAN.
  • Fixed documentation issues from v0.2.1
  • All vignettes now building properly.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


0.7.1 by Robert Kubinec, 2 months ago

Report a bug at

Browse source code at

Authors: Robert Kubinec [aut, cre] , Jonah Gabry [ctb] , Ben Goodrich [ctb] , Trustees of Columbia University [cph]

Documentation:   PDF Manual  

Task views: Missing Data

GPL license

Imports rstan, rstantools, dplyr, tidyr, stringr, bayesplot, ggplot2, lazyeval, rlang, shinystan, gghighlight, forcats, ggrepel

Depends on methods, Rcpp

Suggests pscl, loo, lubridate, R.rsp

Linking to StanHeaders, rstan, BH, Rcpp, RcppEigen

System requirements: GNU make

See at CRAN