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.
- 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.
raw_data.csv
: the raw dataset, downloaded from Robert Shiller's webpage. This paper only uses three columns of the dataset.date
: in the formatyear.month
p
: S&P 500 indexD
: Dividend
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 bymaster1_data_cleaning.R
.
The following Rscripts contain the user-defined functions used in master2_estimation.R
.
CUE.R
: XMMEL.R
: EXLMfunc5.R
: a collection of useful functions for the estimation procedures.
- No extra software is needed to run
master1_data_cleaning.R
. - The numerical optimization in
master2_estimation.R
depends onNLOPT
andMOSEK
via the R packagesnloptr
andRMOSEK
. The software must be installed to run the code.
R --vanilla <master1_data_generation.R> data.out &
R --vanilla <master2_estimation.R> est.out &