Below is the code that i used to calculate monthly residuals following Fama and French three Factor model using within month daily data:
egen ccode = group(stock)
egen count_check = count(rt), by(stock month)
drop if count_check <17
egen ccode_month_year = group(stock month year)
gen resid_reg =.
egen max = max(ccode_month_year)
disp max
for values i = 1(1)6022 {
regress rt mkt smb hml if ccode_month_year==`i'
predict temp , resid
replace resid_reg = temp if ccode_month_year==`i'
drop temp
}
Could someone help me to modify this code so that instead of saving regression residuals each month, it generates sum of three slope coefficients of the regression as output.
Related Posts with Rolling Regression for cross section
Margins with tobit for elasticity estimatesI am running a tobit regression to model education expenditures (zero forsome households) and tried …
The meaning of cov option in meglm model?I‘m learning the meglm for GLMMs. I noticed that we can use the "cov" option to define the variance-…
Doubts on how to correctly declare a dataset to be survival timeDear all,
I am a new Stata user and this is the first time I use this forum.
I need to conduct a s…
Extracting the Beta Coeff from regressionHello all,
I am running a linear regression, with 2 sets of dummy variables age (25-65) and cohort(…
Force empty observations to be included in analysis?If you have data that was collected with the intent all observations be used in analysis because eac…
Subscribe to:
Post Comments (Atom)
0 Response to Rolling Regression for cross section
Post a Comment