I am trying to use Entity fixed panel regression for my data set. I have cross sectional data for each county in the US and for 1971 to 2020 (yearly). I have two indices: STCTID which is county ID and Date. Below is how my dataset looks like:
Apart from the date index, I have Year column as an explanatory variable too. Below is my code for fitting panel regression using linearmodels, I keep the entity fixed effects but no time effect:
from linearmodels import PanelOLS
formula1 = "Yld ~ Year + Prec + GDD + KDD + VPD + Irg +Irg*Prec
+ Irg*GDD + Irg*KDD + Irg*VPD + EntityEffects"
mod = PanelOLS.from_formula(formula1, data=df_all_semw)
panelOLS_res = mod.fit(cov_type="clustered", cluster_entity=True)
Printing panelOLS_res gives the details about the regression coefficients and information. What I found strange is that the model gives regression coefficients for each year in Year variable. See below:
Parameter Std. Err. T-stat P-value Lower CI Upper CI
GDD 0.0560 0.0028 20.148 0.0000 0.0505 0.0614
Irg 0.0008 0.0002 4.2808 0.0000 0.0005 0.0012
KDD -0.1646 0.0058 -28.269 0.0000 -0.1760 -0.1532
Prec -0.0006 0.0016 -0.3816 0.7028 -0.0037 0.0025
VPD -5.4312 1.4328 -3.7907 0.0002 -8.2395 -2.6228
Year[T.1971] 14.009 4.7535 2.9471 0.0032 4.6917 23.326
Year[T.1972] 20.115 4.9404 4.0715 0.0000 10.432 29.799
Year[T.1973] 20.867 5.0448 4.1364 0.0000 10.979 30.756
Year[T.1974] 6.5041 4.7447 1.3708 0.1704 -2.7959 15.804
Year[T.1975] 8.6791 5.0379 1.7228 0.0849 -1.1955 18.554
Year[T.1976] 14.602 4.8642 3.0020 0.0027 5.0683 24.136
Year[T.1977] 15.879 5.1194 3.1018 0.0019 5.8451 25.914
Year[T.1978] 28.605 4.9551 5.7728 0.0000 18.893 38.317
... and so on
I found this is because the datatype of Year is object, when I change it to int, I dont get these coefficients for each year, but then the R-squared drops down. Could somebody explain me the reason behind this? Is there any problem with the current model (with each year getting coefficient), if no, how can I explain it to others?
