Hi all,
I work with a panel dataset including about 3'000 companies (Variable: id) with daily observations (weekdays only) between 2000 to 2015 (Variable: Date). In order to approximate the unsystematic risk, I regress the daily returns of every company (for every year) on the Fama/French 3-Factor model to obtain the annualised root mean standard error (eg. standard deviation of residuals).
So far I came up with the following code:
However it takes incredibly long (a projected 45 hours), which is why I doubt that this is the correct or best solution. How can I make this code more efficient?
Thanks very much!
I work with a panel dataset including about 3'000 companies (Variable: id) with daily observations (weekdays only) between 2000 to 2015 (Variable: Date). In order to approximate the unsystematic risk, I regress the daily returns of every company (for every year) on the Fama/French 3-Factor model to obtain the annualised root mean standard error (eg. standard deviation of residuals).
So far I came up with the following code:
Code:
xtset id Date
forval j = 2000/2015 {
statsby rmse=e(rmse), by(id) saving(SD_Residuals, replace): regress Daily_Return MKT SML HML if Year==`j'
}
Thanks very much!

Comment