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
How to create databases by loopsHi statausers: I'm trying to run a Bootstrap code to get standard errors out of a matrix. The code …
Optimal sample, power and sample sizeHello dear all; I need your assistance on one small issue ,i use micro panel data to investigate imp…
difficulty with forvalues/foreach naminghi all, I'm trying to generate a new set of variables and struggling with the naming -- I have a va…
R-squared is too smallHi, I am doing my research about using Fama-French factors to get the abnormal return. I have collec…
Estimating fixed-effects panel linear regression using gmmI am trying to use `gmm` to replicate the results of using `xtreg, fe`. In short, I'm looking for a …
Subscribe to:
Post Comments (Atom)
0 Response to Rolling Regression for cross section
Post a Comment