I am trying to replicate a study by Malmendier, Ulrike, and Stefan Nagel. ("Depression babies: do macroeconomic experiences affect risk taking?." The Quarterly Journal of Economics 126.1 (2011): 373-416). In short, the paper estimates the effect of macroeconomic experiences (proxied by annual returns in S&P 500) on financial decision making, and is considered seminal in its field. To this end, I am trying to reconstruct a weighted variable, but I am having difficulties figuring out the best approach.
In their paper, the authors construct a weighted explanatory variable:
I have recreated a fake example of my two dataset:
Notice that λ has been set to 1.5, as Malmendier et.al. estimate in their paper. The id variable corresponds to the unit index i, the year variable to t, ar_pct to Rit and age to ageit. The desired output is the weighted experienced annual return mentioned above. How would you proceed with constructing such a variable? Is there a program that can handle such operations? I am using Stata 16.1, which is running on Windows 10.
I appreciate you help, and being a novice on this forum, I welcome any criticism of my post. Thanks for your time.
In their paper, the authors construct a weighted explanatory variable:
Specifically, for each household i in year t, we calculate the following weighted average of past asset returns,
[ATTACH=CONFIG]n1548741[/ATTACH]
where Rt−k is the return in year t−k. The weights (wit) depend on the age of the household head at time t (ageit), how many years ago the return was realized (k), and a parameter λ, which controls the shape of the weighting function.
[ATTACH=CONFIG]n1548741[/ATTACH]
where Rt−k is the return in year t−k. The weights (wit) depend on the age of the household head at time t (ageit), how many years ago the return was realized (k), and a parameter λ, which controls the shape of the weighting function.
Code:
clear all // First data set frame create annual_return frame change annual_return set seed 1405 set obs 139 gen year = _n+1870 gen ar_pct = (rnormal()*20+8)/100 dataex year ar_pct in 1/10 // Second data set frame create fr_exp_return frame change fr_exp_return set obs 10000 set seed 1405 gen year = floor(runiform()*40)+1980 sort year gen id = _n gen lambda = 1.5 gen age = floor(rnormal(0 1)*40)+40 drop if age < 25 | age > 75 dataex id year age lambda in 1/10
I appreciate you help, and being a novice on this forum, I welcome any criticism of my post. Thanks for your time.
Comment