Replication Code: Animal-Spirits Hypothesis of Consumer Sentiment: New Evidence from a Dynamic Factor Model of Consumption

Published: 10 March 2026| Version 2 | DOI: 10.17632/8x4bhmpmz6.2
Contributors:
Aram Balagyozyan,

Description

This repository contains replication code for the paper "Animal-Spirits Hypothesis of Consumer Sentiment: New Evidence from a Dynamic Factor Model of Consumption" by Aram Balagyozyan and Iordanis Petsas. The code estimates nine specifications of a Bayesian dynamic factor model using Gibbs sampling (via JAGS), where a latent common factor is extracted jointly from three consumption categories. The nine specifications differ in which macroeconomic controls are included alongside the factor (income growth, real interest rates, financial wealth, inflation, and unemployment), as well as in the AR lag order of the idiosyncratic errors and the latent factor. The most complete specification (Model 9) includes all five controls and an AR(3) structure for both the error terms and the latent factor. Data are sourced from the Federal Reserve Economic Data (FRED) database and cover January 1978 to January 2020.

Files

Steps to reproduce

1. Install JAGS (see System Requirements above). 2. Open PullingAllResultsTogether.Rmd in RStudio. 3. At the top of the file, set the runFromScratch flag: -- runFromScratch <- 1 — converts all nine .Rmd files to .R scripts via knitr::purl(), re-estimates all models from scratch, and saves a .RData workspace for each model. Warning: this is computationally intensive and may take several hours. Only necessary on the first run. -- runFromScratch <- 0 — skips re-estimation and loads the pre-saved .RData workspaces directly. Use this on subsequent runs once the .RData files have been generated. 4. Knit PullingAllResultsTogether.Rmd to reproduce all tables and figures from the paper.

Institutions

Categories

Aggregate Consumption, Public Sentiment

Licence