Dear Statalisters,
I am working on my masterthesis Finance at the moment and I try to calculate the factor sensitivity of companies to subsequently create new stock portfolios. I tried to calculate the factor sensitivity using the rolling regression command in Stata. The code looks like this:
rolling _b, window(60) saving(betas, replace) reject(e(permno) < 24): reg ret factor
permno is the company_ID.
Unfortuantely, the code is working very slow and takes to long on large datasets.
I have searched on the internet and I found the asreg command which does it extremely fast:
bys permno: asreg ret factor, wind(60) min(24)
However, when I am testing the results of both commands on small datasets, I won't get the same results.
Therefore my question, could someone help me with a Stata code which would give me faster results? and where could be the difference between the two codes?
Thank you very much,
Karina
I am working on my masterthesis Finance at the moment and I try to calculate the factor sensitivity of companies to subsequently create new stock portfolios. I tried to calculate the factor sensitivity using the rolling regression command in Stata. The code looks like this:
rolling _b, window(60) saving(betas, replace) reject(e(permno) < 24): reg ret factor
permno is the company_ID.
Unfortuantely, the code is working very slow and takes to long on large datasets.
I have searched on the internet and I found the asreg command which does it extremely fast:
bys permno: asreg ret factor, wind(60) min(24)
However, when I am testing the results of both commands on small datasets, I won't get the same results.
Therefore my question, could someone help me with a Stata code which would give me faster results? and where could be the difference between the two codes?
Thank you very much,
Karina
Comment