hbamr

Hierarchical Bayesian Aldrich-McKelvey Scaling in R via Stan

https://github.com/jbolstad/hbamr

Science Score: 49.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 4 DOI reference(s) in README
  • Academic publication links
  • Committers with academic emails
    1 of 4 committers (25.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.3%) to scientific vocabulary

Keywords

bayesian bayesian-inference ideal-point-estimation r-package stan survey-analysis
Last synced: 6 months ago · JSON representation

Repository

Hierarchical Bayesian Aldrich-McKelvey Scaling in R via Stan

Basic Info
Statistics
  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Topics
bayesian bayesian-inference ideal-point-estimation r-package stan survey-analysis
Created about 3 years ago · Last pushed 7 months ago
Metadata Files
Readme Changelog License

README.md

hbamr hbamr website

CRAN status CRAN downloads R-CMD-check

Hierarchical Bayesian Aldrich-McKelvey Scaling

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.

Important Updates

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 the changelog for a more comprehensive discussion of the updates.

Installation

The package is available from CRAN and can be installed using the standard method:

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

Vignette

A vignette showing how to use all key functions in the package is available here. It can also be viewed locally, after installing the package:

r vignette("hbamr")

Usage

Load the package:

r library("hbamr")

Load and re-code example data:

r data(LC1980) LC1980[LC1980 == 0 | LC1980 == 8 | LC1980 == 9] <- NA self <- LC1980[, 1] stimuli <- LC1980[, -1]

Fit the standard HBAM model:

r fit_hbam <- hbam(self, stimuli)

Fit the HBAM_MINI model:

r fit_hbam_mini <- hbam(self, stimuli, model = "HBAM_MINI")

Plot the estimated stimuli positions:

r plot_stimuli(fit_hbam)

Plot the distribution of estimated respondent positions:

r plot_respondents(fit_hbam)

Plot the estimated scale-stretching parameters over respondents' self-placements:

r plot_over_self(list(fit_hbam, fit_hbam_mini), "abs_beta")

References

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

Owner

  • Name: Jørgen Bølstad
  • Login: jbolstad
  • Kind: user
  • Location: Oslo
  • Company: University of Oslo

Associate Professor of Political Science. I do causal inference and develop Bayesian models.

GitHub Events

Total
  • Push event: 18
Last Year
  • Push event: 18

Committers

Last synced: over 1 year ago

All Time
  • Total Commits: 285
  • Total Committers: 4
  • Avg Commits per committer: 71.25
  • Development Distribution Score (DDS): 0.032
Past Year
  • Commits: 161
  • Committers: 3
  • Avg Commits per committer: 53.667
  • Development Distribution Score (DDS): 0.05
Top Committers
Name Email Commits
jbolstad j****d@g****m 276
Jørgen Bølstad b****d@J****n 7
Andrew Johnson a****n@a****m 1
Jørgen Bølstad b****d@e****o 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: over 1 year ago

All Time
  • Total issues: 0
  • Total pull requests: 1
  • Average time to close issues: N/A
  • Average time to close pull requests: about 9 hours
  • Total issue authors: 0
  • Total pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 1.0
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 1
  • Average time to close issues: N/A
  • Average time to close pull requests: about 9 hours
  • Issue authors: 0
  • Pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 1.0
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 410 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 18
  • Total maintainers: 1
cran.r-project.org: hbamr

Hierarchical Bayesian Aldrich-McKelvey Scaling via 'Stan'

  • Versions: 18
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 410 Last month
Rankings
Forks count: 28.8%
Dependent packages count: 29.8%
Stargazers count: 35.2%
Dependent repos count: 35.5%
Average: 41.4%
Downloads: 77.8%
Maintainers (1)
Last synced: 6 months ago