Learn R Programming

cosmic (version 0.5)

Conditional Ordinal Stereotype Model for Incident-Level Comparison

Description

Implements the Conditional Ordinal Stereotype Model for Incident-Level Comparison (COSMIC), a method for analyzing ordinal outcomes observed across multiple actors within shared events. The model uses a conditional likelihood to remove event-level confounding and estimate actor-specific propensities relative to their peers. Efficient computation is achieved via a dynamic programming algorithm for the Poisson-multinomial normalization term, enabling scalable estimation with Markov chain Monte Carlo. The package provides tools for data preparation, model fitting using Stan, and extraction of posterior summaries for comparative inference. Estimation of police officer propensity to escalate force is the primary motivation for the model. For more details see Ridgeway (2026) "A Conditional Ordinal Stereotype Model to Estimate Police Officers’ Propensity to Escalate Force" .

Copy Link

Version

Install

install.packages('cosmic')

Version

0.5

License

MIT + file LICENSE

Maintainer

Ridgeway Greg

Last Published

May 4th, 2026

Functions in cosmic (0.5)

cosmic

Fit the Conditional Ordinal Stereotype Model (COSMIC)
cosmic-package

cosmic: Conditional Ordinal Stereotype Model for Incident-Level Comparison
summary.cosmic_fit

Print and summarize a COSMIC fit
diagnose

Diagnose a COSMIC fit
officer_summary

Summarize officers relative to their peer groups
posterior

Extract posterior draws from a COSMIC model
outlier_report

Create an outlier-focused report table