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
Replace some observation for String variableHello, Assume I have two variables Region and Oceania with large observation. Example: Region Oce…
Cluster standard error for random effect logit model - without vce(bootstrap)?[COLOR=rgba(0, 0, 0, 0.87)]Hello everyone, I have an issue with Stata and I would be grateful for yo…
MIMIC (SEM) Models with panel (longitudinal) dataIS it possible to estimate a MIMIC (SEM) model for a panel of countries and years? Could I replicate…
How to resolve numeric overflow while performing xtset,fe in stata?Dear all, I am getting error r(1400): combinations results in numeric overflow; computations cannot …
Phillips and Sul techniqueDear all, I am using the Phillips and Sul (2007) technique for convergence test and club identifica…
Subscribe to:
Post Comments (Atom)
0 Response to Rolling Regression for cross section
Post a Comment