Hello Stata Community,
I have a balanced Panel Data set and am trying to run the market model (i.e. E(R)=a+b*Rmkt). In order to do this, I need to run a regression for each day on the past 200 days.
So, I am looking for:
My Dataset looks like this:
input date companynum company return returnSP end
Thank you for your help!
I have a balanced Panel Data set and am trying to run the market model (i.e. E(R)=a+b*Rmkt). In order to do this, I need to run a regression for each day on the past 200 days.
So, I am looking for:
- how can I estimate the intercepts and slopes based on the past 200 trading days and for each firm individually? Basically, it needs to be estimated on the range of 200 days prior to the specific date.
- how can I save the intercepts and slopes for each observation?
list company companynum in 1/4114, sepby (company)
xtset companynum xtset companynum date, daily
xtset companynum xtset companynum date, daily
input date companynum company return returnSP end
+------------------------------------------------ --------------+
. date companynum company return returnSP |
. |---------------------------------------------------------------|
1. | 3/21/2001 1 ESDI 0.04 0.65 |
2. | 3/22/2001 1 ESDI 0.78 6.75 |
... | ... ... ... . .. .................................................. ...... |
4115.| 3/21/2001 2 VWI -0.065 0.65 |
4116.| 3/22/2001 2 VWI 1.6 6.75 |
+--------------------------------------------------------------+
. date companynum company return returnSP |
. |---------------------------------------------------------------|
1. | 3/21/2001 1 ESDI 0.04 0.65 |
2. | 3/22/2001 1 ESDI 0.78 6.75 |
... | ... ... ... . .. .................................................. ...... |
4115.| 3/21/2001 2 VWI -0.065 0.65 |
4116.| 3/22/2001 2 VWI 1.6 6.75 |
+--------------------------------------------------------------+
Comment