Skip to content
R scripts for figures and analysis for paper on using Bayesian hierarchical latent variable models for analyzing economic survey data
R
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
data
posteriors
simulations
.gitattributes
.gitignore
README.md
card_analysis.R
dhs_analysis.R
mich_analysis.R
utils.R

README.md

Replication code for "Latent Dirichlet Analysis of Categorical Survey Data"

Author: Evan Munro and Serena Ng

This repository contains data and code for a working paper with Serena Ng.

It contains three folders:

  • data contains:
    1. Raw data and associated description files in text format for Michigan data
    2. Recoded Card data in RData format and description files in text format
    3. README with sources and data guide
  • posteriors Contains saved model posterior means that are used to create the tables for the paper
  • simulations Contains mcmc_simulations.R for the simulations recorded in Table 1 in the paper

And some scripts:

  • utils.R contain utility functions for plotting data
  • card_analysis.R, mich_analysis.R, and dhs_analysis.R produce tables and figures for the application section of the paper, either from the saved model posteriors or from a newly estimated model. Set re-estimate=T in order to re-estimate the models (can be computationally intensive).

Requirements

It is is necessary to install the R package dhlvm for the models in the paper from Github using the R package devtools:

devtools::install_github("evanmunro/dhlvm")

The scripts also require the following R packages, which are available on CRAN:

MCMCpack, reshape2, ggplot2
You can’t perform that action at this time.