- Notifications
You must be signed in to change notification settings - Fork1
Hierarchical Bayesian Aldrich-McKelvey Scaling in R via Stan
License
jbolstad/hbamr
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
This is an R package for performing hierarchical Bayesian Aldrich-McKelvey (HBAM) scaling using Hamiltonian Monte Carlo simulations via Stan. Aldrich-McKelvey (AM) scaling is a method for estimating the ideological positions of survey respondents and political actors on a common scale using positional survey data (Aldrich & McKelvey 1977). The hierarchical versions of the AM model included in this package outperform other versions both in terms of yielding meaningful posterior distributions for respondent positions and in terms of recovering true respondent positions in simulations (Bølstad 2024). The package contains functions for preparing data, fitting models, extracting estimates, plotting key results, and comparing models using cross-validation.
Version 2.1.0:
- All models now simulate errors in respondents' self-placements to yield realistic levels of uncertainty in estimated respondent positions while offering faster sampling.
Version 2.0.1:
- New MULTI-type models explicitly model group-differences.
- Models of FBAM-type now allow users to specify key priors.
- Most models have been revised to offer faster and better sampling.
See thechangelog for a more comprehensive discussion of the updates.
The package is available fromCRAN and can be installed using the standard method:
install.packages("hbamr")This is the easiest and fastest way to install the package, as the binaries on CRAN include pre-compiled models that are ready for use.
A vignette showing how to use all key functions in the package is availablehere. It can also be viewed locally, after installing the package:
vignette("hbamr")Load the package:
library("hbamr")Load and re-code example data:
data(LC1980)LC1980[LC1980==0|LC1980==8|LC1980==9]<-NAself<-LC1980[,1]stimuli<-LC1980[,-1]
Fit the standard HBAM model:
fit_hbam<- hbam(self,stimuli)
Fit the HBAM_MINI model:
fit_hbam_mini<- hbam(self,stimuli,model="HBAM_MINI")
Plot the estimated stimuli positions:
plot_stimuli(fit_hbam)Plot the distribution of estimated respondent positions:
plot_respondents(fit_hbam)Plot the estimated scale-stretching parameters over respondents' self-placements:
plot_over_self(list(fit_hbam,fit_hbam_mini),"abs_beta")
- Aldrich, John H, and Richard D McKelvey. 1977. "A Method of Scaling with Applications to the 1968 and 1972 Presidential Elections."American Political Science Review 71(1): 111-130.
- Bølstad, Jørgen. 2020. "Capturing Rationalization Bias and Differential Item Functioning: A Unified Bayesian Scaling Approach."Political Analysis 28(3): 340-355.
- Bølstad, Jørgen. 2024. "Hierarchical Bayesian Aldrich-McKelvey Scaling."Political Analysis 32(1): 50-64.
- Hare, Christopher et al. 2015. "Using Bayesian Aldrich-McKelvey Scaling to Study Citizens' Ideological Preferences and Perceptions."American Journal of Political Science 59(3): 759-774.
About
Hierarchical Bayesian Aldrich-McKelvey Scaling in R via Stan
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors2
Uh oh!
There was an error while loading.Please reload this page.
