pspatreg {pspatreg} | R Documentation |
pspatreg: A package to estimate and make inference for spatial and spatio-temporal econometric regression models
Description
pspatreg offers the user a collection of functions to estimate and make inference of geoadditive spatial or spatio-temporal semiparametric regression models of type ps-sim, ps-sar, ps-sem, ps-sarar, ps-sdm, ps-sdem or ps-slx. These type of specifications are very general and they can include parametric and non-parametric covariates, spatial or spatio-temporal non-parametric trends and spatial lags of the dependent and independent variables and/or the noise of the model. The non-parametric terms (either trends or covariates) are modeled using P-Splines. The non-parametric trend can be decomposed in an ANOVA way including main and interactions effects of 2nd and 3rd order. The estimation method can be restricted maximum likelihood (REML) or maximum likelihood (ML).
Details
Some functionalities that have been included in pspatreg package are:
1. Estimation of the semiparametric regression model
pspatreg allows the estimation of geoadditive spatial or spatio-temporal semiparametric regression models which could include:
An spatial or spatio-temporal trend, that is, a geoadditive model either for cross-section data or for panel data. This trend can be decomposed in main and interaction functions in an ANOVA way. The spatial (or spatio-temporal) trend gather the potential spatial heterogeneity of the data.
-
Parametric covariates as usual in regression models.
Non-parametric covariates in which the functional relationship is estimated from the data. Both the trends and non-parametric covariates are modelled using P-splines.
Spatial dependence adding spatial lags of the dependent and independent variables as usual in spatial econometric models. These models gather the potential spatial spillovers.
Once specified, the whole model can be estimated using either restricted maximum-likelihood (REML) or maximum likelihood (ML). The spatial econometric specifications allowed in pspatreg are the following ones:
-
ps-sim: geoadditive semiparametric model without spatial effects (in addition to the spatial or spatio-temporal trend, if it is included).
where:
-
is a smooth spatio-temporal trend of the spatial coordinates
and of the temporal coordinates
.
-
is a matrix including values of parametric covariates.
-
are non-parametric smooth functions of the covariates
.
-
where
if errors are uncorrelated or it follows an AR(1) temporal autoregressive structure for serially correlated errors.
-
-
ps-slx: geoadditive semiparametric model with spatial lags of the regresors (either parametric or non-parametric):
where:
-
is the spatial weights matrix.
-
is an identity matrix of order
(T = 1 for pure spatial data).
-
-
ps-sar: geoadditive semiparametric model with spatial lag of the dependent variable
-
ps-sem: geoadditive semiparametric model with a spatial lag of the noise of the model
-
ps-sdm: geoadditive semiparametric model with spatial lags of the endogenous variable and of the regressors (spatial durbin model)
-
ps-sdem: geoadditive semiparametric model with spatial errors and spatial lags of the endogenous variable and of the regressors
-
ps-sarar: geoadditive semiparametric model with a spatial lag for: both dependent variable and errors
2. Plot of the spatial and spatio-temporal trends
Once estimated
the geoadditive semiparametric model, some functions of pspatreg are
suited to make plots of the spatial or spatio-temporal trends. These
functions, named plot_sp2d
and plot_sp3d
, can deal
either with 'sf' objects or 'dataframe' objects including spatial coordinates
(see the examples of the functions).
The function plot_sptime
allows
to examine temporal trends for each spatial unit. Eventually, it is also
possible to get the plots on nonparametric covariates using
plot_terms
.
3. Impacts and spatial spillovers
It is very common in spatial econometrics to
evaluate the multiplier impacts that a change in the value of a regressor,
in a point in the space, has on the explained variable. The pspatreg
package allows the computation and inference of spatial impacts (direct,
indirect and total) either for parametric covariates or nonparametric
covariates (in the last case, the output are impact functions). The function
named impactspar
compute the impacts for parametric
covariates in the usual way using simulation. On the other hand, the
function impactsnopar
allows the computation of impact
functions for nonparametric covariates. For parametric covariates,
the method to compute the impacts is the same than the
exposed in LeSage and Page (2009). For nonparametric covariates the
method is described in the help of the function impactsnopar
.
Both impact functions have dedicated methods to
get a summary, for the parametric covariates, and
plots, for the nonparametric covariates, of the
direct, indirect and total impacts.
4. Additional methods
The package pspatreg provides the usual methods to extract information of the fitted models. The methods included are:
-
anova
: provides tables of fitted 'pspatreg' models including information criteria (AIC and BIC), log-likelihood and degrees of freedom of each fitted model. Also allows to perform LR tests between nested models. -
print
method is used to print short tables including the values of beta and spatial coefficients as well as p-values of significance test for each coefficient. -
summary
method displays the results of the estimation for spatial and spatio-temporal trends, parametric and nonparametric covariates and spatial parameters. -
coef
extractor function of the parametric and spatial coefficientes. -
fitted
extractor function of the fitted values. -
logLik
extractor function of the log-likelihood. -
residuals
extractor function of the residuals. -
vcov
extractor function of the covariance matrix of the estimated parameters. The argumentbayesian
(default = 'TRUE') allows to choose between sandwich (frequentist) or bayesian method to compute the variances and covariances. See Fahrmeir et al. (2021) for details.
Datasets
pspatreg includes a spatio-temporal panel database
including observations of unemployment, economic variables
and spatial coordinates (centroids) for 103 Italian provinces
in the period 1996-2019.
This database is provided in RData format and can be loaded
using the command data(unemp_it, package = "pspatreg")
.
The database also includes a W spatial neighborhood matrix
of the Italian provinces (computed using queen criterium).
Furthermore, a map of Italian provinces is also included as an sf object.
This map can be used to plot spatial and spatio-temporal trends estimated
for each province. Some examples of spatial and spatio-temporal
fitted trends are included in the help of the main function of
pspatreg package (see especially ?pspatfit
).
See Minguez, Basile and Durban (2020) for additional details about
this database.
source: Italian National Institute of Statistics (ISTAT)
https://www.istat.it
For the spatial pure case, the examples included use the
household database ames
included in AmesHousing package.
See the help of ?AmesHousing::make_ames
for an explanation of the
variables included in this database.
Examples of hedonic models including geoadditive spatial econometric
regressions are included in the examples of pspatreg package.
Author(s)
Roman Minguez | roman.minguez@uclm.es |
Roberto Basile | roberto.basile@univaq.it |
Maria Durban | mdurban@est-econ.uc3m.es |
Gonzalo Espana-Heredia | gehllanza@gmail.com |
References
Basile, R.; Durban, M.; Minguez, R.; Montero, J. M.; and Mur, J. (2014). Modeling regional economic dynamics: Spatial dependence, spatial heterogeneity and nonlinearities. Journal of Economic Dynamics and Control, (48), 229-245. <doi:10.1016/j.jedc.2014.06.011>
Eilers, P. and Marx, B. (1996). Flexible Smoothing with B-Splines and Penalties. Statistical Science, (11), 89-121.
Eilers, P. and Marx, B. (2021). Practical Smoothing. The Joys of P-Splines. Cambridge University Press.
Fahrmeir, L.; Kneib, T.; Lang, S.; and Marx, B. (2021). Regression. Models, Methods and Applications (2nd Ed.). Springer.
Lee, D. and Durban, M. (2011). P-Spline ANOVA Type Interaction Models for Spatio-Temporal Smoothing. Statistical Modelling, (11), 49-69. <doi:10.1177/1471082X1001100104>
Lee, D. J., Durban, M., and Eilers, P. (2013). Efficient two-dimensional smoothing with P-spline ANOVA mixed models and nested bases. Computational Statistics & Data Analysis, (61), 22-37. <doi:10.1016/j.csda.2012.11.013>
LeSage, J. and Pace, K. (2009). Introduction to Spatial Econometrics. CRC Press, Boca Raton.
Minguez, R.; Basile, R. and Durban, M. (2020). An Alternative Semiparametric Model for Spatial Panel Data. Statistical Methods and Applications, (29), 669-708. <doi: 10.1007/s10260-019-00492-8>
Montero, J., Minguez, R., and Durban, M. (2012). SAR models with nonparametric spatial trends: A P-Spline approach. Estadistica Espanola, (54:177), 89-111.
Rodriguez-Alvarez, M. X.; Kneib, T.; Durban, M.; Lee, D.J. and Eilers, P. (2015). Fast smoothing parameter separation in multidimensional generalized P-splines: the SAP algorithm. Statistics and Computing 25 (5), 941-957. <doi:10.1007/s11222-014-9464-2>
Wood, S.N. (2017). Generalized Additive Models. An Introduction with
R
(second edition). CRC Press, Boca Raton.