Skip to content
Replication data and code for "Structural Estimation of Behavioral Heterogeneity"
R
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
CUE.R
EL.R
README.md
_config.yml
estimation.R
func5.R
master1_data_generation.R
master2_estimation.R
raw_data.csv

README.md

Structural Estimation of Behavioral Heterogeneity

Zhentao Shi and Huanhuan Zheng (2018), "Structural Estimation of Behavioral Heterogeneity," Journal of Applied Econometrics, 33(5), 690-707 [arxiv]

We provide code of XMM and ELXM that replicates the empirical results.

Hosts

  • A static copy is hosted at Journal of Applied Econometrics Data Archive.
  • A dynamic copy is hosted at Github with Version 1.0 exactly the same as the copy in JAE Data Archive. The authors will maintain it for future update.

Data

  • raw_data.csv: the raw dataset, downloaded from Robert Shiller's webpage. This paper only uses three columns of the dataset.
    • date: in the format year.month
    • p: S&P 500 index
    • D: Dividend

Code

  • master1_data_cleaning.R: generate the detrended time series for each period. After running this script, three Rdata files will be saved in the folder.
  • master2_estimation.R: estimation by XMM and ELXM using the Rdata files generated by master1_data_cleaning.R.

The following Rscripts contain the user-defined functions used in master2_estimation.R.

  • CUE.R: XMM
  • EL.R: EXLM
  • func5.R: a collection of useful functions for the estimation procedures.

Environment

  • No extra software is needed to run master1_data_cleaning.R.
  • The numerical optimization in master2_estimation.R depends on NLOPT and MOSEK via the R packages nloptr and RMOSEK. The software must be installed to run the code.

Implementation

  1. R --vanilla <master1_data_generation.R> data.out &
  2. R --vanilla <master2_estimation.R> est.out &
You can’t perform that action at this time.