Hello Everyone!
I have a very basic question regarding fixed effects which is bothering me.
I have a dataset that has a tsset on school and year.
The model that I am running is a simple one:
Where the dependent variable is total enrollment and the remainder variable are all binary
Suppose I wanted to add district and time fixed effects. The regression then (I believe) will become:
Q 1. Will this mean that I have 3 fixed effects in this model? One for school, district and year?
Q 2. What if I did not want school fixed effects but rather just required district and year fixed effects? Can i simply run the same regression above without the fe option? (This doesnt make sense to me)
Q 3. The other thing I was thinking of doing in order to run a district and year fixed effects only was to tsset by district and add a i.year to the model with a ,fe option? Does this make more sense or the second option is more practical?
I have a very basic question regarding fixed effects which is bothering me.
I have a dataset that has a tsset on school and year.
The model that I am running is a simple one:
Code:
xtreg total_enr drink_water toilets boundary_wall computer sports library main_gate sewerage electricity play_ground, robust
Suppose I wanted to add district and time fixed effects. The regression then (I believe) will become:
Code:
xtreg total_enr drink_water toilets boundary_wall computer sports library main_gate sewerage electricity play_ground i.dist_id i.year, fe robust
Q 2. What if I did not want school fixed effects but rather just required district and year fixed effects? Can i simply run the same regression above without the fe option? (This doesnt make sense to me)
Q 3. The other thing I was thinking of doing in order to run a district and year fixed effects only was to tsset by district and add a i.year to the model with a ,fe option? Does this make more sense or the second option is more practical?
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input int dist_id long emiscode int year float total_enr byte(drink_water toilets boundary_wall computer sports library main_gate sewerage electricity play_ground) 311 31110001 2004 935 1 1 1 1 1 1 1 0 1 1 311 31110001 2005 1032 1 1 1 1 1 1 1 0 1 1 311 31110001 2006 1316 1 1 1 1 1 1 1 0 1 1 311 31110001 2007 1450 1 1 1 1 1 1 0 0 1 1 311 31110002 2004 1009 1 1 1 1 1 1 1 1 1 0 311 31110002 2005 1145 1 1 1 1 1 1 1 1 1 0 311 31110002 2006 1050 1 1 1 1 1 1 1 1 1 0 311 31110002 2007 1068 1 1 1 1 1 1 1 1 1 0 311 31110003 2004 571 1 1 1 0 0 1 1 1 1 0 311 31110003 2005 620 1 1 1 0 0 1 1 1 1 0 311 31110003 2006 739 1 1 1 0 0 1 1 1 1 0 311 31110003 2007 805 1 1 1 0 1 1 1 1 1 0 311 31110004 2004 467 1 1 1 0 1 1 1 0 1 1 311 31110004 2005 579 1 1 1 0 1 1 1 0 1 1 311 31110004 2006 669 1 1 1 0 1 1 1 0 1 1 311 31110004 2007 624 1 1 1 0 0 1 1 0 1 0 311 31110005 2004 662 1 1 1 0 1 1 1 0 1 1 311 31110005 2005 788 1 1 1 0 1 1 1 0 1 1 311 31110005 2006 943 1 1 1 0 1 1 1 0 1 1 311 31110005 2007 938 1 1 1 0 1 1 1 0 1 1 311 31110006 2004 388 1 0 1 0 0 1 1 0 1 0 311 31110006 2005 435 1 0 1 0 0 1 1 0 1 0 311 31110006 2006 425 1 0 1 0 0 1 1 0 1 0 311 31110006 2007 409 1 0 1 0 0 1 1 0 1 0 311 31110007 2004 306 1 0 0 0 1 1 1 0 1 1 311 31110007 2005 359 1 0 0 0 1 1 1 0 1 1 311 31110007 2006 411 1 0 0 0 1 1 1 0 1 1 311 31110007 2007 437 1 0 0 0 1 1 1 0 1 1 311 31110008 2004 410 1 1 1 0 0 1 1 0 1 0 311 31110008 2005 507 1 1 1 0 0 1 1 0 1 0 311 31110008 2006 568 1 1 1 0 0 1 1 0 1 0 311 31110008 2007 593 1 1 1 0 1 1 1 0 1 0 311 31110009 2004 279 1 1 1 0 0 1 1 0 1 0 311 31110009 2005 299 1 1 1 0 0 1 1 0 1 0 311 31110009 2006 358 1 1 1 0 0 1 1 0 1 0 311 31110009 2007 499 1 1 1 0 0 1 1 0 1 0 311 31110010 2004 777 1 1 1 0 1 1 1 1 1 1 311 31110010 2005 824 1 1 1 0 1 1 1 1 1 1 311 31110010 2006 861 1 1 1 0 1 1 1 1 1 1 311 31110010 2007 858 1 1 1 0 0 1 1 1 1 1 311 31110011 2004 377 1 0 1 0 1 1 0 0 1 1 311 31110011 2005 436 1 0 1 0 1 1 0 0 1 1 311 31110011 2006 564 1 0 1 0 1 1 0 0 1 1 311 31110011 2007 453 1 0 0 0 1 1 0 0 1 1 311 31110012 2004 314 1 1 1 0 1 1 1 1 1 1 311 31110012 2005 407 1 1 1 0 1 1 1 1 1 1 311 31110012 2006 531 1 1 1 0 1 1 1 1 1 1 311 31110012 2007 618 1 1 1 0 1 1 1 1 1 1 311 31110013 2004 439 1 1 0 0 1 1 1 1 1 1 311 31110013 2005 574 1 1 0 0 1 1 1 1 1 1 311 31110013 2006 611 1 1 0 0 1 1 1 1 1 1 311 31110013 2007 577 1 1 1 0 1 1 1 1 1 1 311 31110014 2004 479 1 1 0 0 1 1 1 0 1 1 311 31110014 2005 588 1 1 0 0 1 1 1 0 1 1 311 31110014 2006 663 1 1 0 0 1 1 1 0 1 1 311 31110014 2007 698 1 1 1 0 0 1 1 0 1 0 311 31110015 2004 274 1 0 0 0 1 1 1 0 1 1 311 31110015 2005 309 1 0 0 0 1 1 1 0 1 1 311 31110015 2006 382 1 0 0 0 1 1 1 0 1 1 311 31110015 2007 384 1 1 0 0 0 1 0 0 1 0 311 31110017 2004 358 1 1 0 0 1 1 1 0 1 1 311 31110017 2005 377 1 1 0 0 1 1 1 0 1 1 311 31110017 2006 457 1 1 0 0 1 1 1 0 1 1 311 31110017 2007 436 1 1 0 0 1 1 1 0 1 1 311 31110018 2004 900 1 1 1 0 1 1 1 0 1 0 311 31110018 2005 914 1 1 1 0 1 1 1 0 1 0 311 31110018 2006 927 1 1 1 0 1 1 1 0 1 0 311 31110018 2007 786 1 1 1 0 1 1 1 0 1 0 311 31110019 2004 493 1 1 1 0 0 1 1 1 1 0 311 31110019 2005 559 1 1 1 0 0 1 1 1 1 0 311 31110019 2006 543 1 1 1 0 0 1 1 1 1 0 311 31110019 2007 451 1 1 1 0 0 1 1 1 1 0 311 31110020 2004 1659 1 1 1 0 1 1 1 1 1 1 311 31110020 2005 1766 1 1 1 0 1 1 1 1 1 1 311 31110020 2006 1827 1 1 1 0 1 1 1 1 1 1 311 31110020 2007 1619 1 1 1 0 1 1 1 1 1 1 311 31110021 2004 1139 1 1 1 1 1 1 1 0 1 1 311 31110021 2005 1413 1 1 1 1 1 1 1 0 1 1 311 31110021 2006 1282 1 1 1 1 1 1 1 0 1 1 311 31110021 2007 1344 1 1 1 1 1 1 1 0 1 1 311 31110022 2004 377 1 1 1 0 0 0 1 0 1 0 311 31110022 2005 396 1 1 1 0 0 0 1 0 1 0 311 31110022 2006 390 1 1 1 0 0 0 1 0 1 0 311 31110022 2007 377 1 1 1 0 0 0 1 0 1 0 311 31110023 2004 362 1 1 0 0 1 1 0 0 1 1 311 31110023 2005 441 1 1 0 0 1 1 0 0 1 1 311 31110023 2006 533 1 1 0 0 1 1 0 0 1 1 311 31110023 2007 594 1 1 0 0 1 1 0 0 1 1 311 31110024 2004 448 1 1 0 0 0 1 0 1 1 0 311 31110024 2005 435 1 1 0 0 0 1 0 1 1 0 311 31110024 2006 438 1 1 0 0 0 1 0 1 1 0 311 31110024 2007 462 1 1 0 0 1 1 1 1 1 0 311 31110025 2004 382 1 1 1 0 1 1 1 0 1 0 311 31110025 2005 371 1 1 1 0 1 1 1 0 1 0 311 31110025 2006 361 1 1 1 0 1 1 1 0 1 0 311 31110025 2007 337 1 1 1 0 1 1 1 0 1 0 311 31110026 2004 381 1 1 1 0 1 1 1 1 1 1 311 31110026 2005 402 1 1 1 0 1 1 1 1 1 1 311 31110026 2006 458 1 1 1 0 1 1 1 1 1 1 311 31110026 2007 487 1 1 1 0 1 1 1 1 1 1 end label values drink_water yesno0 label values sports yesno0 label def yesno0 1 "Yes", modify label def yesno0 0 "No", modify label values toilets yesno label values boundary_wall yesno label values computer yesno label values library yesno label values main_gate yesno label values sewerage yesno label values electricity yesno label values play_ground yesno label def yesno 0 "No", modify label def yesno 1 "Yes", modify
Comment