Hi everyone,
I am running a panel data analysis.
In my model, I have 6 continuous independent variables and one categorical independent variable.
The categorical independent variable is binary and time-invariant - it refers to geographical location and stays constant throughout the 4 years panel data.
Based on what I read from this document,
I can use either least square dummy variable model
OR
Both gave me the same coefficients for x1 - x6.
However, there are three differences:
Thank you very much.
I am running a panel data analysis.
In my model, I have 6 continuous independent variables and one categorical independent variable.
The categorical independent variable is binary and time-invariant - it refers to geographical location and stays constant throughout the 4 years panel data.
Based on what I read from this document,
I can use either least square dummy variable model
Code:
xi: reg y x1 x2 x3 x4 x5 x6 i(location) i(entity)
Code:
xtset id year xtreg y x1 x2 x3 x4 x5 x6 i(location), fe
However, there are three differences:
- Using xtreg dropped the coefficient for the location categorical variable, whereas the former would retain the coefficient.
- Using xtreg did not give me the fixed effect intercept for each entity in my panel data, whereas using the former did.
- Using xtreg, R-sq within = 0.4027, R-sq between = 0.9028, R-sq overall = 0.8938 whereas the former gave me R2 = 0.9874.
- I am quite puzzled with No. 1 - if xtreg dropped the time-invariant categorical variable, how can it still give me the same coefficient for x1 - x6 as using xi: reg?
- Which command should I use? I am actually estimating a cost function. My dependent variable, y is actually total cost. I would like to use the coefficients to estimate marginal cost and average incremental cost. Deriving average incremental cost using xi: reg and xtreg would produce different values as the former gave an additional coefficient (the binary categorical variable) than the latter.
- What is the implication of the differences in R2 estimated using both commands?
Thank you very much.
Comment