This post summarizes the work of the PySAL Project on Panel Data Spatial Econometrics. The work is divided in the following sections. First, I explain the utilities used to handle panel data in spreg
. Second, I show the diagnostics implemented for spatial - panel estimations. Finally, I detail the different models that can be estimated.
The notebook Panel_example.ipynb offers an overview of the new estimations that can be useful from the user perspective.
The utilities for the panel data estimation are located in the file panel_utils.py
.
-
The function
check_panel
handles the structure of the panel data in the estimations ofspreg
. This function converts a panel from wide to long format if needed. -
The function
demean_panel
transforms the variables for the estimations ofspreg
. The transformation assigns a weight from 0 to 1 attached to the cross-sectional component of the data.
Diagnostic statistics for the panel data estimation are located in the file diagnostics_panel.py
.
-
Lagrange Multiplier test: functions that calculate the classic Lagrange Multiplier test and the robust version for spatial lag and error specifications.
-
Hausman test: functions to test fixed vs. random effects specifications.
The four basic estimations of panel data with spatial interactions are located in the files panel_fe.py
and panel_re.py
.
-
panel_fe.py
-
Panel_FE_Lag: Fixed Effects estimation with spatial lagged dependent variable.
-
Panel_FE_Error: Fixed Effects estimation with spatial error interaction.
-
-
panel_re.py
-
Panel_RE_Lag: Random Effects estimation with spatial lagged dependent variable.
-
Panel_RE_Error: Random Effects estimation with spatial error interaction.
-
The step by step explanation of the preceding estimations can be found on the notebooks:
Finally, all the work can be found in the following pull requests:
- Random Effects Panel #50
- Fixed Effects Panel - Spatial Error #45
- Fixed Effects Panel - Spatial Lag #41
There are three issues outside the scope of the original project that is considered for future work:
- POLS class for Pooled OLS regresion of panel data.
- Add the diagnostics tests at the end of POLS summary.
- Lee-Yu bias correction for fixed effects estimation.