I am clear on the model I want to create,
𝑦𝑖𝑡 = 𝛼 + 𝜌𝑖 + 𝜆𝑡 + 𝛽𝑡𝐷𝑖 + 𝜖𝑖𝑡,
Where 𝑦𝑖𝑡 is the Saidin Index for hospital 𝑖 in year 𝑡, 𝜌𝑖 and 𝜆𝑡 are fixed effects for the hospital and year, respectively, 𝐷𝑖 is a treatment status dummy, and 𝜖𝑖𝑡 is a hospital-year specific error term. 𝛽𝑡 is the treatment effect specific to year 𝑡, and is allowed to vary over time.
This is how my dataset looks like,
[CODE]
* Example generated by -dataex-. For more info, type help dataex
clear
input str6 prov_id int year byte(tech_1 tech_2 tech_3 tech_4 teach) int beds byte(nonprof govt treat merge) float(N_t saidin)
"11z111" 2001 0 0 0 0 0 35 0 1 0 3 1305 .53716475
"11z111" 2002 0 0 0 0 0 35 0 1 0 3 1305 .1494253
"11z111" 2003 0 0 0 0 0 35 0 1 0 3 1305 .1586207
To run the model, I am using the code,
encode prov_id, gen(prov_id_num)
xtset prov_id_num year
xtreg saidin treat i.year i.prov_id_num, fe
output:
question 1: Do i have to group my prov_id? run this code before running regression, egen hospital_fe = group(prov_id)
question 2: I am unable to understand the output why all the prov_id are ommitted. Does this means something is wrong with the code?
I am using the command xtreg and working with panel data for the first time. Need help!
𝑦𝑖𝑡 = 𝛼 + 𝜌𝑖 + 𝜆𝑡 + 𝛽𝑡𝐷𝑖 + 𝜖𝑖𝑡,
Where 𝑦𝑖𝑡 is the Saidin Index for hospital 𝑖 in year 𝑡, 𝜌𝑖 and 𝜆𝑡 are fixed effects for the hospital and year, respectively, 𝐷𝑖 is a treatment status dummy, and 𝜖𝑖𝑡 is a hospital-year specific error term. 𝛽𝑡 is the treatment effect specific to year 𝑡, and is allowed to vary over time.
This is how my dataset looks like,
[CODE]
* Example generated by -dataex-. For more info, type help dataex
clear
input str6 prov_id int year byte(tech_1 tech_2 tech_3 tech_4 teach) int beds byte(nonprof govt treat merge) float(N_t saidin)
"11z111" 2001 0 0 0 0 0 35 0 1 0 3 1305 .53716475
"11z111" 2002 0 0 0 0 0 35 0 1 0 3 1305 .1494253
"11z111" 2003 0 0 0 0 0 35 0 1 0 3 1305 .1586207
To run the model, I am using the code,
encode prov_id, gen(prov_id_num)
xtset prov_id_num year
xtreg saidin treat i.year i.prov_id_num, fe
output:
| Results for Model | ||||||
| saidin | Coefficient | Std. err. | t | P>|t| | [95% conf. interval] | |
| treat | 0 | (omitted) | ||||
| year | ||||||
| 2002 | -0.0484937 | 0.0661613 | -0.73 | 0.464 | -0.1781809 | 0.0811935 |
| 2003 | 0.4161865 | 0.0661613 | 6.29 | 0 | 0.2864993 | 0.5458737 |
| 2004 | 0.9485885 | 0.0661613 | 14.34 | 0 | 0.8189013 | 1.078276 |
| 2005 | 1.843522 | 0.0661613 | 27.86 | 0 | 1.713835 | 1.973209 |
| 2006 | 2.033128 | 0.0661613 | 30.73 | 0 | 1.903441 | 2.162815 |
| 2007 | 2.774456 | 0.0661613 | 41.93 | 0 | 2.644769 | 2.904143 |
| 2008 | 2.968962 | 0.0661613 | 44.87 | 0 | 2.839274 | 3.098649 |
| 2009 | 3.236261 | 0.0661613 | 48.91 | 0 | 3.106574 | 3.365949 |
| 2010 | 3.335228 | 0.0661613 | 50.41 | 0 | 3.20554 | 3.464915 |
| prov_id_num | ||||||
| 11z113 | 0 | (omitted) | ||||
| 11z132 | 0 | (omitted) | ||||
| 11z135 | 0 | (omitted) | ||||
| 11z13z | 0 | (omitted) |
| _cons | 0.978769 | 0.0467831 | 20.92 | 0 | 0.8870662 | 1.070472 |
question 2: I am unable to understand the output why all the prov_id are ommitted. Does this means something is wrong with the code?
I am using the command xtreg and working with panel data for the first time. Need help!
