Skip to contents

opin is an R package used for decomposing aggregate change in public opinion data into three constituent parts. In its current version, opin allows researchers to:

  • Decompose the overall change in public opinion estimates into composition effects (changing group shares), within-group change (groups shifting their outcomes), and an interaction effect between the two,
  • Handle group entry and exit across time periods,
  • Plot the decomposition results as stacked bar charts across time.

I rely on Beheim and Baldini (2012) and Sobchuk and Beheim (2025) for this strategy.

Installation

You can install the development version of opin from Github with:

# install.packages("devtools")
devtools::install_github("tkeskinturk/opin")

References

Beheim, Bret A, and Ryan Baldini. 2012. “Evolutionary Decomposition and the Mechanisms of Cultural Change.” Cliodynamics: The Journal of Quantitative History and Cultural Evolution 3 (2): 217–33. https://doi.org/10.21237/C7CLIO3212123.
Sobchuk, Oleg, and Bret Beheim. 2025. “Does Literature Evolve One Funeral at a Time?” Proceedings of the Royal Society B: Biological Sciences 292 (2040): 20242033. https://doi.org/10.1098/rspb.2024.2033.