# A Review of Software for Spatial Econometrics in R

^{1}

^{2}

^{3}

^{4}

^{*}

^{†}

## Abstract

**:**

## 1. Introduction

**spdep**in R. In recent years, the field of spatial econometrics has experienced a rapid growth in conjunction with the interest and attention received by researchers in mainstream economics and econometrics. A multiplicity of methods and models have been developed for cross-sectional as well as panel data [2,3,4]. Currently, spatial econometrics routines to estimate spatial models are available from many commercial (and non commercial) software, as for example Stata and the PySal module spreg [5]. R [6] is with no doubt the open source environment that contains the richest variety of options.

**splm**, which implements maximum likelihood (ML) and generalized moments (GM) estimation. Section 5 deals with further developments and alternative methods and approaches both for cross-sectional and panel models. Section 6 concludes the paper.

## 2. Preliminaries and Data

#### 2.1. Used Car Prices

`style="W"`in the definition of the list of weights object. Spatial weights matrices are typically very sparse, and while formulae often show them as matrices, they are seldom used as dense matrices.

#### 2.2. Driving under the Influence

`dui`is defined as the alcohol-related arrest rate per 100,000 daily vehicle miles traveled (DVMT). The regressors include

`police`(measured in terms of number of sworn officers per 100,000 DVMT);

`nondui`(non-alcohol-related arrests per 100,000 DVMT);

`vehicles`(number of registered vehicles per 1000 residents), and

`dry`(a dummy for counties that prohibit alcohol sale within their borders, about 10% of counties). An additional dummy variable

`elect`is 1 if a county government faces elections, 0 otherwise, and has 295 non-zero entries.

`police`force is related with the alcohol-arrest rates. Therefore,

`police`is treated as an endogenous variable. [12] also assume that the dummy variable

`elect`make a proper instrument for

`police`.

`nb2listw`serves to transform the neighbors into an actual (row-standardized) weights matrix. The last three lines of code define the formulas. In particular,

`fm2`is the main formula that relates

`dui`to the explanatory variables from which police is excluded because of endogeneity and is added separately. Finally, the last line of code below defines that the variable

`elect`should be used as instrument.

#### 2.3. Rice Farming

`RiceFarms`and

`riceww`; the spatial weights do not change over time, and are of size $N\times N$, while there are $N\times T$ observations.

#### 2.4. Crime in North Carolina

`lcrmrte`) to a set of controls for the return to legal activities, and to a number of deterrent variables (probability of arrest, probability of conviction conditional on arrest, and probability of imprisonment conditional on conviction). The crime rate variable is the ratio between an FBI index that measures the number of crimes, and county population (i.e., crime per-capita in the county). The ratio of arrest to offenses is a proxy for the probability of arrest (

`lprbarr`); the ratio of convictions to arrest is a proxy for the probability of conviction (

`lprbconv`), and, finally, the proportion of total convictions resulting in prison sentences is a proxy for the probability of imprisonment (

`lprbpris`). A measure of sanction severity (

`lavgsen`) measured by the average prison sentence length in days is included in the model as well.

`lwcon`); transportation, utilities, and communications (

`lwtuc`); wholesale and retail trade (

`lwtrd`); finance, insurance, and real estate (

`lwfir`); services (

`lwser`); manufacturing (

`lwmfg`); and federal (

`lwfed`), state (

`lwsta`), and local government (

`lwloc`). The dummy variable (

`urban`) controls for differences in participation in the legal sector that may occur between urban and rural environment. A similar role is played by the density variable (

`ldensity`) which measures the ratio between county population and county land area.

`lpctymle`), as well as the proportion of the population that is minority (

`lpctmin`). Finally, regional or cultural factors that may affect the crime rate are picked up with the inclusion of a central and western dummies. Ref. [17] estimates the model both by the between and the within estimators and find quite impressive differences. Since they are concerned by the heterogeneity in their sample, they reject estimators that do not condition on country effects. This decision is clearly based on the evidence of a Hausman test.

## 3. Cross Sectional Models

#### 3.1. Initial Development in R: The **spdep** Package

**spdep**package was first published on the Comprehensive R Archive Network (CRAN) in March 2002, replacing and merging

**spweights**and

**sptests**first available from September 2001, and the short-lived

**spsarlm**package on CRAN in February 2002.

**spdep**inherited the ML estimation functions from

**spsarlm**; there have been other simpler implementations, for instance [23].

#### 3.1.1. Spatial Dependence and the OLS Model

#### 3.1.2. The Development of the Moran and LM Tests for Spatial Dependence (Error and Lag)

#### 3.1.3. Early ML Estimation

**spdep**uses line search over the single spatial coefficient, calculating the other coefficients once that is found. The development in [26] only addresses the simultaneous autoregressive (SAR) approach, but [32] and the rich literature based on his work prefers to treat spatial lattice regression in a Markov random field setting (conditional autoregressive, CAR), with spatially structured random effects included in an otherwise aspatial model. Reference [33] summarizes these developments and relates the SAR and CAR approaches.

**spdep**, sparse Cholesky alternatives were available for cases in which finding the eigenvalues of a large weights matrix would be impracticable.

`errorsarlm()`function yields the same results at those reported in the article. All the model estimation functions from the

**spdep**package have been split out into

**spatialreg**[34], mostly because most users need

**spdep**for creating spatial neighbour objects and for testing for autocorrelation. A separate model estimation package permits faster development of the model fitting functions without disturbing other work. The model fitting functions follow the structure for R functions of this kind, using a formula interface. The list of weights object is required, and when no method is specified for the computation of the log Jacobian to which we will return later, the eigenvalues of the spatial weights matrix are used [30].

`Durbin=`argument to

`TRUE`adds the spatially lagged covariates, omitting the lagged intercept when the spatial weights are row standardized.

`spautolm()`function, which will not be presented here.

#### 3.2. The “Advent” of The GMM

- In the first step, the first equation in (8) is estimated by two-stage least square (2SLS) using the matrix of instruments$$\mathbf{H}=(\mathbf{X},\mathbf{WX},{\mathbf{W}}^{\mathbf{2}}\mathbf{X},\cdots ,{\mathbf{W}}^{q}\mathbf{X})$$
- In the second step, the residuals from the first step are employed to obtain an estimate of $\rho $ by solving a non-linear system of three equations resulting from the specification of the three following quadratic moment conditions:$$E{n}^{-1}{\epsilon}^{\prime}\epsilon ={\sigma}^{2}\phantom{\rule{0.277778em}{0ex}}\phantom{\rule{0.277778em}{0ex}}\phantom{\rule{0.277778em}{0ex}}\phantom{\rule{0.277778em}{0ex}}E{n}^{-1}{\overline{\epsilon}}^{\prime}\overline{\epsilon}={\sigma}^{2}{n}^{-1}tr{\mathbf{M}}^{\prime}\mathbf{M}\phantom{\rule{0.277778em}{0ex}}\phantom{\rule{0.277778em}{0ex}}\phantom{\rule{0.277778em}{0ex}}\phantom{\rule{0.277778em}{0ex}}E{n}^{-1}{\overline{\epsilon}}^{\prime}\epsilon =0$$
- With the estimate of $\rho $ obtained in the second step, a transformation of the model is taken to filter out the spatial parameter and the transformed model is estimated again by 2SLS.

`GMerrorsar`function takes advantage of this and therefore in the demonstration below there will be a standard error for $\rho $.)

**spdep**:

`stsls`for the SLM,

`GMerrorsar`for the SEM, initially contributed by Luc Anselin, and

`gs2sls`for the SARAR model. These functions, along with many others, recently migrated into

**spatialreg**.

**spdep**allow for additional endogenous variables.

#### An Early Version of **sphet**

**spdep**, [40] developed a new package for estimating and testing spatial models with heteroskedastic innovations. The library was mainly based on GM estimators and semi-parametric methods for the estimation of the coefficient’s variance-covariance matrix.

**sphet**was complementing but not overlapping with

**spdep**. In fact,

**sphet**focused only on GM and instrumental variables (IV) methods, leaving aside ML, and dealt with potential heteroskedasticity in the error term, features that was only partly taken into account in

`stsls`. From a theoretical point of view, the procedures implemented in

**sphet**were derived in [41,42]. The point of departure of [41] was the SARAR model with potential heteroskedasticity in the innovations. A noticeable difference of [41] is that they gave results for the spatial error coefficient for both consistency and asymptotic normality. Of course, this enabled to perform statistical inference on both spatial parameters. Moreover, the moment conditions were slightly different from their earlier paper, thus leading to a different system of equations, that, in turn, resulted in a different estimates for the spatial error parameter.

**sphet**is called

`gstslshet`. The syntax of the function is pretty straightforward: the first argument is a description of the model to be estimated, then the optional argument containing the data set, and, finally, the (mandatory) object of class

`"listw"`.

**sphet**is

`stslshac`. The procedure is based on the choice of a distance function that along with a kernel determines the non-zero observations in the variance-covariance matrix.

`stsls`in

**spatialreg**. The table reports two standard errors (second and third columns): For each coefficient, the second column has the usual 2SLS standard error, while the third is produced with the HAC. Interestingly, the differences in standard errors do not change the overall conclusions that all but one variable are statistically significant.

#### 3.3. Further Development in R: The **spdep** Package and the Improvement of **sphet**

**spdep**. LeSage and Pace [2] appeared shortly afterwards, significantly “raising the bar” as expressed by Elhorst [44] in an extended review. Reference [45] discussed in detail both how to estimate an extended range of nested models using ML, and how to handle model interpretation, pursuing topics presented in Halleck Vega and Elhorst [46] and LeSage [47].

**spdep**package, moving these components to the new

**spatialreg**package. At about the same time, Bayesian fitting methods were added, based on porting of MATLAB Spatial Econometrics Toolbox code carried out by Virgilio Gómez-Rubio and Abhirup Mallik.

**sphet**, and, in particular, the inclusion of the wrapper function

`spreg`. We will turn to this after describing the evolution of the ML estimation in the next subsection.

#### 3.3.1. Evolution of the ML Estimation

#### 3.3.2. Interpretation and Impacts Evaluation

`impacts()`method, when the spatial weights matrix is inverted inside the method:

`m=`):

#### 3.3.3. Evolution of the GMM and Recent Developments

**sphet**had gone under a process of serious revisions that culminated with the inclusion of the wrapper function

`spreg`. Specifyfing a

`model`argument,

`spreg`allows to estimate all of the specifications nested in the general model of Equation (1). The re are mainly two advantages of GMM compared to ML: On the one hand, GMM can deal with very large sets of data since it does not require inversion of large matrices. On the other hand, dealing with additional (other than the spatial lag) endogeneous variables is simple, provided that one has proper and valid instruments.

`police`force is most likely related with the alcohol-arrest rates. The refore,

`police`can be treated as an endogenous variable. As we anticipated earlier, ref. [12] also assume that the dummy variable

`elect`(where elect is 1 if a county government faces an election, 0 otherwise) make a valid instrument for

`police`.

`spreg`uses different moment conditions. Despite this fact, results are very close to the one presented before and similar conclusions can be drawn. In particular, the spatial error parameter is not statistically significant, while the positive spatial lag coefficient is small but strongly statistically significant. This means that the DUI related arrests in neighbouring counties affects the alcohol related arrests for a given county. This result can be explained in terms of copycat policies or a certain level of coordination in police enforcement between counties. In terms of the explanatory variables in the model, nondui is the only one that is not statistically signicant. The estimated coefficient for police is large and positive in all three models. Moving to the specifications that treat police as endogenous the results are quite different particularly in terms of the magnitude of the coefficient estimates. Moreover, police turns out to be negative once endogeneity is controlled for. Two additional things have to be noted. The first relates to the SARAR model. The summary method for SARAR models automatically performs a Wald test that both $\rho $ and $\lambda $ are statistically significant. The second relates to the SLM as well as to the SARAR model. Once again for models that are specified in terms of a spatial lag of the dependent variable appropriate summary measures needs to be used to take into account for simultaneity. This is the reason why appropriate spatial effects are calculated for the SAR and SARAR models. However, when additional endogenous variables are present, the calculation of the impacts is quite complicated. Ref. [57] show how to approximate that calculation but since is very case specific, it has not been implemented (yet) in

**sphet**.

## 4. Spatial Panel Data Models

**splm**described here (see [62]); and, some years later, with the Stata add-on package ’xsmle’ [63] (in this latter case, while the package is provided in the open domain, the base software system is not; still, Stata is a de facto standard in econometrics and most researchers are likely to have access to a copy).

#### 4.1. Static Spatial Panels

#### The Pooled Spatial Model

#### 4.2. Tests

#### 4.2.1. LM Tests

#### Conditional and Joint Tests for Spatial or Random Effects

- ${H}_{0}^{a}:\lambda ={\sigma}_{\mu}^{2}=0$ under the alternative that at least one component is not zero
- ${H}_{0}^{b}:{\sigma}_{\mu}^{2}=0$ (assuming $\lambda $ = 0), under the one-sided alternative that the variance component is greater than zero
- ${H}_{0}^{c}:\lambda =0$ assuming no random effects (${\sigma}_{\mu}^{2}=0$), under the two-sided alternative that the spatial autocorrelation coefficients is different from zero
- ${H}_{0}^{d}:\lambda =0$ assuming the possible existence of random effects (${\sigma}_{\mu}^{2}$ may or may not be zero), under the two-sided alternative that the spatial autocorrelation coefficient is different from zero
- ${H}_{0}^{e}:{\sigma}_{\mu}^{2}=0$ assuming the possible existence of spatial autocorrelation ($\lambda $ may or may not be zero)and the one-sided alternative that the variance component is greater than zero.

#### Local CD Test

#### 4.2.2. Individual Effects: Fixed or Random

#### 4.3. ML Estimation

#### 4.3.1. Individual Effects and Spatial Errors

**splm**can perform the Lee and Yu correction.

**splm**works instead on untransformed data and approaches random effects together with any other feature of the error covariance, spatial dependence included [74]. This has the advantage of keeping some components of the error term (most notably, the random effects) out of the spatial dependence, which can remain a feature of the idiosyncratic error only, as in most applications in the literature (see, e.g., [44,58,59,60,61,70,71,72,75,76,77,78,79,80,81,82,83,84,85]) but entails some computational complications. The alternative specification where the individual effects follow the same spatial process as the idiosyncratic errors, as in [86], which is also considered below, is much easier to compute.

#### 4.3.2. Fixed Effects

`plm`, the most robust specification—the FE—is the default choice in the estimator function:

**splm**it is indeed possible to estimate a model containing both effects to assess the significance of each through a Wald test. We only report estimation results for the relevant coefficients:

#### 4.3.3. Independent Random Effects

#### 4.3.4. Spatially Correlated Random Effects

#### 4.4. Serial and Spatial Correlation

- ${H}_{0}^{a}:\lambda =\rho ={\sigma}_{\mu}^{2}=0$ under under the alternative that at least one component is not zero (J)
- ${H}_{0}^{h}:\lambda =0$, assuming $\rho \ne 0,{\sigma}_{\mu}^{2}>0$: test for spatial correlation, allowing for serial correlation and random individual effects (C.1)
- ${H}_{0}^{i}:\rho =0$, assuming $\lambda \ne 0,{\sigma}_{\mu}^{2}>0$: test for serial correlation, allowing for spatial correlation and random individual effects (C.2)
- ${H}_{0}^{j}:{\sigma}_{\mu}^{2}=0$, assuming $\lambda \ne 0,\rho \ne 0$: test for random individual effects, allowing for spatial and serial correlation (C.3)

`bsjktest`with J and C.1-3 appearing in the new splm package for R [62].

#### 4.5. Endogeneity in Static Panel Data Models

`spgm`implements the procedure described in [88] with the extra feature of considering additional (other than the spatial lag) endogenous variables.

`lag`and

`error`arguments to

`FALSE`and specifying endogenous variables along with instruments. To obtain the second model the user has to include both spatial lag and error parameters. The data set to produce Table 12 where presented in Section 2.4 and relates to an economic model of crime estimated by [17]. Keep in mind that [17] had a genuine concern about the endogeneity of police per-capita ad the probability of arrest. The refore, those two variables are instrumented using per-capita tax revenue and a mix of different types of offense. The spatial lag parameter at the bottom of the second column in Table 12 is positive and statistically significant and then justifies the spatial specification. The spatial connection are driven from the fact that counties with high (low) levels of crime are generally clustered. This may be due to some sort of copy-cat policies occurring within the counties.

## 5. Developments and Alternative Approaches

#### 5.1. Developments and Alternative Approaches in Cross-Sectional Models

`State`. The MRF smooth requires manual adjustment of the number of knots, because here we are not using a multi-level approach and so approach the upper bound on the number of parameters to be estimated. In addition, the MRF approach does not row-standardize the spatial weights, using a conditional rather than a simultaneous autoregression.

**spatialreg**for ML estimators); this has obvious extensions to spillover between training, validation and test data sets in machine learning contexts.

#### 5.1.1. Limited Dependent Variables Models

#### 5.1.2. Multi-Level Models

#### 5.1.3. Spatial Filtering Methods

**spdep**and moved to

**spatialreg**[34], with two steps, first to select eigenvectors taken from the spatial weights matrix doubly centred using the hat matrix of the actual regression, then using

`lm`to fit the model, effectively removing residual autocorrelation:

**spdep**by Pedro Peres-Neto and moved now to

**spatialreg**as

`ME`analogous with

`SpatialFiltering`, but centering the spatial weights matrix on the null model hat matrix, and using bootstrap methods in evaluating the the choice of eigenvectors. The correlations between the implied cumulated outcomes of these methods are shown in Table 13. Reference [117] describe many of the underlying motivations, including the view that Moran eigenvector spatial filtering approaches may permit both spatial autocorrelation and spatial scale tto be accommodate in a single model; a further implementation is given in [118].

`meigen`function subsets the full set of eigenvectors before the data are seen, then

`esf`calls

`lm`itself while further subsetting the eigenvectors.

#### 5.1.4. Heterogeneity in Space: GWR and Regime Models

**spgwr**. A different approach to this extreme case would be assuming that spatial heterogeneity can be classified into a limited number of spatial regimes characterized by different values of the regression parameters. One of the future directions for spatial models in R would be geared towards the development of such regime models.

#### 5.1.5. Higher Order Spatial Models

**sphet**would be considering higher order spatial models [122,123]. The presence of additional lags (either of the dependent variable, of the regressors, or of the error term) would allow to test different types of interactions and make the model interpretation richer.

#### 5.1.6. Systems of Spatial Equations

**splm**included codes to estimate spatial simultaneous equation and spatial seemingly unrelated regression equations. By the time

**splm**was published the routine for those models migrated into a new package

**spse**that, unfortunately, never saw the light.

**spse**contained two major functions:

`spsegm`and

`spseml`.

`spsegm`implemented the feasible generalized three stages least square estimator (FGS3SLS) for simultaneous systems of spatially interrelated cross sectional equations put forward by [124], while

`spseml`implemented ML estimation of simultaneous systems of spatial seemingly unrelated regression equation following the lines in [1]. The package is now hosted on Github (https://github.com/gpiras/spse) and is (again) under development. Future plans will include the extension to simultaneous equation combined with higher order spatial interactions [125]. (In a similar context, the package

**spsur**[126] also deals with seemingly unrelated regression equations.)

#### 5.1.7. Machine Learning and Spatial Econometrics

#### 5.2. Developments and Alternative Approaches in Spatial Panels

#### 5.2.1. Dynamic Spatial Panels

#### 5.2.2. Heterogeneous SAR Panels

## 6. Conclusions

## Author Contributions

## Funding

## Data Availability Statement

## Conflicts of Interest

## References

- Anselin, L. Spatial Econometrics: Methods and Models; Kluwer Academic Publishers: Dordrecht, The Netherlands, 1988. [Google Scholar]
- LeSage, J.; Pace, R.K. Introduction to Spatial Econometrics; Chapman and Hall/CRC: Boca Raton, FL, USA, 2009. [Google Scholar]
- Kelejian, H.; Piras, G. Spatial Econometrics; Academic Press: London, UK, 2017. [Google Scholar]
- Arbia, G. A Primer for Spatial Econometrics, with Applications in R; Palgrave: Basingstoke, UK, 2014. [Google Scholar]
- Anselin, L.; Rey, S.J. Modern Spatial Econometrics in Practice: A Guide to GeoDa, GeoDaSpace and PySal; GeoDa Press LLC: Chicago, IL, USA, 2014. [Google Scholar]
- R Core Team. R: A Language and Environment for Statistical Computing; R Foundation for Statistical Computing: Vienna, Austria, 2020. [Google Scholar]
- Hanna, F.A. Effects of Regional Differences in Taxes and Transportation Charges on Automobile Consumption. In Papers on Regional Statistical Studies; Ostry, S., Rymes, T.K., Eds.; University of Toronto Press: Toronto, ON, Canada, 1966; pp. 90–104. [Google Scholar]
- Hepple, L.W. A maximum likelihood model for econometric estimation with spatial series. In Theory and Practice in Regional Science; London Papers in Regional Science; Masser, I., Ed.; Pion: London, UK, 1976; pp. 90–104. [Google Scholar]
- Li, H.; Calder, C.A.; Cressie, N. Beyond Moran’s I: Testing for spatial dependence based on the spatial autoregressive model. Geogr. Anal.
**2007**, 39, 357–375. [Google Scholar] [CrossRef] - Li, H.; Calder, C.A.; Cressie, N. One-step estimation of spatial dependence parameters: Properties and extensions of the APLE statistic. J. Multivar. Anal.
**2012**, 105, 68–84. [Google Scholar] [CrossRef] [Green Version] - Drukker, D.M.; H Peng, I.R.P.; Raciborski, R. Creating and managing spatial-weighting matrices with the spmat command. Stata J.
**2013**, 13, 242–286. [Google Scholar] [CrossRef] [Green Version] - Drukker, D.M.; Prucha, I.R.; Raciborski, R. A command for estimating spatial-autoregressive models with spatial-autoregressive disturbances and additional endogenous variables. Stata J.
**2013**, 13, 287–301. [Google Scholar] [CrossRef] [Green Version] - Drukker, D.M.; Prucha, I.R.; Raciborski, R. Maximum likelihood and generalized spatial two-stage least-squares estimators for a spatial-autoregressive model with spatial-autoregressive disturbances. Stata J.
**2013**, 13, 221–241. [Google Scholar] [CrossRef] [Green Version] - Powers, E.L.; Wilson, J.K. Access Denied: The Relationship between Alcohol Prohibition and Driving under the Influence. Sociol. Inq.
**2004**, 74, 318–337. [Google Scholar] [CrossRef] - Case, A. Spatial Patterns in household demand. Econometrica
**1991**, 59, 953–965. [Google Scholar] [CrossRef] [Green Version] - Druska, V.; Horrace, W.C. Generalized moments estimation for spatial panel data: Indonesian rice farming. Am. J. Agric. Econ.
**2004**, 86, 185–198. [Google Scholar] [CrossRef] - Cornwell, C.; Trumbull, W.N. Estimating the Economic Model of Crime with Panel Data. Rev. Econ. Stat.
**1994**, 76, 360–366. [Google Scholar] [CrossRef] - Baltagi, B. Econometric Analysis of Panel Data; John Wiley & Sons: Hoboken, NJ, USA, 2008. [Google Scholar]
- Bivand, R.; Gebhardt, A. Implementing functions for spatial statistical analysis using the R language. J. Geogr. Syst.
**2000**, 2, 307–317. [Google Scholar] [CrossRef] - Bivand, R. Implementing spatial data analysis software tools in R. Geogr. Anal.
**2006**, 38, 23–40. [Google Scholar] [CrossRef] - Bivand, R. Spatial econometrics functions in R: Classes and methods. J. Geogr. Syst.
**2002**, 4, 405–421. [Google Scholar] [CrossRef] [Green Version] - Bivand, R.S. Progress in the R ecosystem for representing and handling spatial data. J. Geograph. Syst.
**2020**. [Google Scholar] [CrossRef] - McMillen, D. McSpatial: Nonparametric Spatial Data Analysis; R Package Version 2.0; R Foundation for Statistical Computing: Vienna, Austria, 2013. [Google Scholar]
- Smith, T.E.; Lee, K.L. The effects of spatial autoregressive dependencies on inference in ordinary least squares: A geometric approach. J. Geogr. Syst.
**2012**, 14, 91–124. [Google Scholar] [CrossRef] - McMillen, D.P. Spatial Autocorrelation or Model Misspecification? Int. Reg. Sci. Rev.
**2003**, 26, 208–217. [Google Scholar] [CrossRef] - Cliff, A.D.; Ord, J.K. Spatial Autocorrelation; Pion: London, UK, 1973. [Google Scholar]
- Cliff, A.D.; Ord, J.K. Spatial Processes; Pion: London, UK, 1981. [Google Scholar]
- Anselin, L.; Bera, A.K.; Florax, R.; Yoon, M.J. Simple diagnostic tests for spatial dependence. Reg. Sci. Urban Econ.
**1996**, 26, 77–104. [Google Scholar] [CrossRef] - Anselin, L.; Bera, A. Spatial dependence in linear regression models with an introduction to spatial econometrics. In Handbook of Applied Economic Statistics; Ullah, A., Giles, D., Eds.; Marcel Dekker: New York, NY, USA, 1998; pp. 237–289. [Google Scholar]
- Ord, J. Estimation methods for models of spatial interaction. J. Am. Stat. Assoc.
**1975**, 70, 120–126. [Google Scholar] [CrossRef] - Haining, R.P. Specification and Estimation Problems in Models of Spatial Dependence; Technical Report; Department of Geography, Northwestern University: Evanston, IL, USA, 1978. [Google Scholar]
- Besag, J. Spatial interaction and the statistical analysis of latttice systems (with discussion). J. R. Stat. Soc. Ser. B
**1974**, 36, 192–236. [Google Scholar] - Ripley, B.D. Spatial Statistics; Wiley: New York, NY, USA, 1981. [Google Scholar]
- Bivand, R.; Piras, G. Spatialreg: Spatial Regression Analysis. 2020. Available online: https://CRAN.R-project.org/package=spatialreg (accessed on 18 April 2021).
- Pace, R.K.; LeSage, J.P. A spatial Hausman test. Econ. Lett.
**2008**, 101, 282–284. [Google Scholar] [CrossRef] - Waller, L.A.; Gotway, C.A. Applied Spatial Statistics for Public Health Data; John Wiley & Sons: Hoboken, NJ, USA, 2004. [Google Scholar]
- Kelejian, H.; Prucha, I. Generalized spatial two-stage least squares procedure for estimating a spatial autoregressive model with autoregressive disturbances. J. R. Estate Financ. Econ.
**1998**, 17, 99–121. [Google Scholar] [CrossRef] - Kelejian, H.H.; Prucha, I.R. A Generalized Moments Estimator for the Autoregressive Parameter in a Spatial Model. Int. Econ. Rev.
**1999**, 40, 509–533. [Google Scholar] [CrossRef] [Green Version] - Lee, L.F. Asymptotic Distributions of Quasi-Maximum Likelihood Estimators for Spatial Autoregressive Models. Econometrica
**2004**, 72, 1899–1925. [Google Scholar] [CrossRef] - Piras, G. Sphet: Spatial Models with Heteroskedastic Innovations in R. J. Stat. Softw.
**2010**, 35, 1–21. [Google Scholar] [CrossRef] [Green Version] - Kelejian, H.H.; Prucha, I.R. Specification and estimation of spatial autoregressive models with autoregressive and heteroskedastic disturbances. J. Economet.
**2010**, 157, 53–67. [Google Scholar] [CrossRef] [Green Version] - Kelejian, H.H.; Prucha, I.R. HAC estimation in a spatial framework. J. Economet.
**2007**, 140, 131–154. [Google Scholar] [CrossRef] [Green Version] - Bivand, R.S.; Pebesma, E.; Gomez-Rubio, V. Applied Spatial Data Analysis with R; Springer: New York, NY, USA, 2008. [Google Scholar]
- Elhorst, J.P. Applied Spatial Econometrics: Raising the Bar. Spat. Econ. Anal.
**2010**, 5, 9–28. [Google Scholar] [CrossRef] - Bivand, R.S. After “Raising the Bar”: Applied maximum likelihood estimation of families of models in spatial econometrics. Estadística Española
**2012**, 54, 71–88. [Google Scholar] [CrossRef] [Green Version] - Halleck Vega, S.; Elhorst, J.P. The SLX model. J. Reg. Sci.
**2015**, 55, 339–363. [Google Scholar] [CrossRef] - LeSage, J.P. What Regional Scientists need to know about Spatial Econometrics. Rev. Reg. Stud.
**2014**, 44, 13–32. [Google Scholar] [CrossRef] - Bivand, R.S.; Hauke, J.; Kossowski, T. Computing the Jacobian in Gaussian Spatial Autoregressive Models: An Illustrated Comparison of Available Methods. Geogr. Anal.
**2013**, 45, 150–179. [Google Scholar] [CrossRef] [Green Version] - Pace, R.K.; Barry, R.P. Fast CARs. J. Stat. Comput. Simulat.
**1997**, 59, 123–145. [Google Scholar] [CrossRef] - Barry, R.P.; Pace, R.K. Monte Carlo estimates of the log determinant of large sparse matrices. Linear Algebra Appl.
**1999**, 289, 41–54. [Google Scholar] [CrossRef] [Green Version] - Gomez-Rubio, V.; Bivand, R.S.; Rue, H. Estimating Spatial Econometrics Models with Integrated Nested Laplace Approximation. arxiv
**2017**, arXiv:stat.CO/1703.01273. [Google Scholar] - Bivand, R.S.; Piras, G. Comparing Implementations of Estimation Methods for Spatial Econometrics. J. Stat. Softw.
**2015**, 63, 1–36. [Google Scholar] [CrossRef] [Green Version] - Kelejian, H.H.; Tavlas, G.S.; Hondroyiannis, G. A Spatial Modelling Approach to Contagion Among Emerging Economies. Open Econ. Rev.
**2006**, 17, 423–441. [Google Scholar] [CrossRef] - LeSage, J.; Fischer, M. Spatial Growth Regression: Model Specification, Estimation and Interpretation. Spat. Econ. Anal.
**2008**, 3, 275–304. [Google Scholar] [CrossRef] [Green Version] - Anselin, L.; Lozano-Gracia, N. Errors in variables and spatial effects in hedonic house price models of ambient air quality. Empir. Econ.
**2008**, 34, 5–34. [Google Scholar] [CrossRef] - Ward, M.D.; Gleditsch, K.S. Spatial Regression Models; Sage: Thousand Oaks, CA, USA, 2008. [Google Scholar]
- Kelejian, H.H.; Piras, G. Spillover effects in spatial models: Generalizations and extensions. J. Reg. Sci.
**2020**, 60, 425–442. [Google Scholar] [CrossRef] - Elhorst, J. Specification and estimation of spatial panel data models. Int. Reg. Sci. Rev.
**2003**, 26, 244–268. [Google Scholar] [CrossRef] - Baltagi, B.; Song, S.; Koh, W. Testing panel data regression models with spatial error correlation. J. Econom.
**2003**, 117, 123–150. [Google Scholar] [CrossRef] - Anselin, L.; Le Gallo, J.; Jayet, H. Spatial Panel Econometrics. In The Econometrics of Panel Data, Fundamentals and Recent Developments in Theory and Practice, 3rd ed.; Matyas, L., Sevestre, P., Eds.; Springer: Berlin/Heidelberg, Germany, 2008; pp. 624–660. [Google Scholar]
- Elhorst, J. Spatial Panel Data Models. In Handbook of Applied Spatial Analysis; Fischer, M.M., Getis, A., Eds.; Springer: New York, NY, USA, 2009. [Google Scholar]
- Millo, G.; Piras, G. splm: Spatial panel data models in R. J. Stat. Softw.
**2012**, 47, 1–38. [Google Scholar] [CrossRef] [Green Version] - Belotti, F.; Hughes, G.; Mortari, A.P. Spatial panel-data models using Stata. Stata J.
**2017**, 17, 139–180. [Google Scholar] [CrossRef] [Green Version] - Breusch, T.S.; Pagan, A.R. The Lagrange multiplier test and its applications to model specification in econometrics. Rev. Econ. Stud.
**1980**, 47, 239–253. [Google Scholar] [CrossRef] - Pesaran, M.H. General diagnostic tests for cross-sectional dependence in panels. Empir. Econ.
**2004**, 1–38. [Google Scholar] - Millo, G.; Carmeci, G. Non-life insurance consumption in Italy: A sub-regional panel data analysis. J. Geogr. Syst.
**2011**, 13, 273–298. [Google Scholar] [CrossRef] - Croissant, Y.; Millo, G. Panel Data Econometrics in R: The plm Package. J. Stat. Softw.
**2008**, 27, 1–43. [Google Scholar] [CrossRef] [Green Version] - Wooldridge, J.M. Econometric Analysis of Cross Section and Panel Data; MIT Press: Cambridge, MA, USA, 2010. [Google Scholar]
- Hausman, J.A. Specification tests in econometrics. Economet. J. Econ. Soc.
**1978**, 1251–1271. [Google Scholar] [CrossRef] [Green Version] - Mutl, J.; Pfaffermayr, M. The Hausman test in a Cliff and Ord panel model. Econom. J.
**2011**, 14, 48–76. [Google Scholar] [CrossRef] - Lee, L.; Yu, J. Some recent development in spatial panel data models. Reg. Sci. Urban Econ.
**2010**, 40, 255–271. [Google Scholar] [CrossRef] - Lee, L.; Yu, J. Estimation of spatial autoregressive panel data models with fixed effects. J. Econom.
**2010**, 154, 165–185. [Google Scholar] [CrossRef] - Millo, G.; Pasini, G. Does Social Capital Reduce Moral Hazard? A Network Model for Non-Life Insurance Demand. Fisc. Stud.
**2010**, 31, 341–372. [Google Scholar] [CrossRef] - Millo, G. Maximum likelihood estimation of spatially and serially correlated panels with random effects. Comput. Stat. Data Anal.
**2014**, 71, 914–933. [Google Scholar] [CrossRef] - Baltagi, B.; Song, S.; Jung, B.; Koh, W. Testing for serial correlation, spatial autocorrelation and random effects using panel data. J. Econom.
**2007**, 140, 5–51. [Google Scholar] [CrossRef] - Baltagi, B.; Egger, P.; Pfaffermayr, M. A generalized spatial panel data model with random effects. Econom. Rev.
**2013**, 32, 650–685. [Google Scholar] [CrossRef] [Green Version] - Baltagi, B.; Liu, L. Testing for random effects and spatial lag dependence in panel data models. Stat. Probab. Lett.
**2008**, 78, 3304–3306. [Google Scholar] [CrossRef] [Green Version] - Baltagi, B.; Egger, P.; Pfaffermayr, M. Estimating models of complex FDI: Are there third-country effects? J. Econom.
**2007**, 140, 260–281. [Google Scholar] [CrossRef] [Green Version] - Debarsy, N.; Ertur, C. Testing for spatial autocorrelation in a fixed effects panel data model. Reg. Sci. Urban Econ.
**2010**, 40, 453–470. [Google Scholar] [CrossRef] [Green Version] - Elhorst, J.; Freret, S. Yardstick competition among local governments: French evidence using a two -regimes spatial panel data model. J. Reg. Sci.
**2009**, 49, 931–951. [Google Scholar] [CrossRef] - Elhorst, J. Serial and Spatial error correlation. Econ. Lett.
**2008**, 100, 422–424. [Google Scholar] [CrossRef] - Elhorst, J.; Piras, G.; Arbia, G. Growth and Convergence in a multi-regional model with space-time dynamics. Geogr. Anal.
**2010**, 42, 338–355. [Google Scholar] [CrossRef] - Lee, L.; Yu, J. A spatial dynamic panel data model with both time and individual fixed effects. Econom. Theor.
**2010**, 26, 564–597. [Google Scholar] [CrossRef] [Green Version] - Lee, L.; Yu, J. A Unified Transformation Approach to the Estimation of Spatial Dynamic Panel Data Models: Stability, Spatial Cointegration and Explosive Roots; Ohio State University: Columbus, OH, USA, 2009. [Google Scholar]
- Mutl, J. Dynamic Panel Data Models with Spatially Autocorrelated Disturbances. Ph.D. Thesis, University of Maryland, College Park, MD, USA, 2006. [Google Scholar]
- Kapoor, M.; Kelejian, H.; Prucha, I. Panel data model with spatially correlated error components. J. Econom.
**2007**, 140, 97–130. [Google Scholar] [CrossRef] [Green Version] - Lee, L.f.; Yu, J. Spatial panels: Random components versus fixed effects. Int. Econ. Rev.
**2012**, 53, 1369–1412. [Google Scholar] [CrossRef] - Piras, G. Efficient GMM Estimation of a Cliff and Ord Panel Data Model with Random Effects. Spat. Econ. Anal.
**2013**, 8, 370–388. [Google Scholar] [CrossRef] - Baltagi, B.; Liu, L. Instrumental Variable Estimation of a Spatial Autoregressive Panel Model with Random Effects. Econ. Lett.
**2011**, 111, 135–137. [Google Scholar] [CrossRef] [Green Version] - Baltagi, B. Simultaneous equations with error components. J. Econom.
**1981**, 17, 189–200. [Google Scholar] [CrossRef] - Wood, S. Generalized Additive Models: An Introduction with R, 2nd ed.; Chapman and Hall/CRC: Boca Raton, FL, USA, 2017. [Google Scholar]
- Wood, S. Mgcv: Mixed GAM Computation Vehicle with Automatic Smoothness Estimation; R Package Version 1.8-34; R Foundation for Statistical Computing: Vienna, Austria, 2021. [Google Scholar]
- Alam, M.; Rönnegård, L.; Shen, X. Fitting Conditional and Simultaneous Autoregressive Spatial Models in hglm. R J.
**2015**, 7, 5–18. [Google Scholar] [CrossRef] [Green Version] - Alam, M.; Ronnegard, L.; Shen, X. Hglm: Hierarchical Generalized Linear Models; R Package Version 2.2-1; R Foundation for Statistical Computing: Vienna, Austria, 2019. [Google Scholar]
- Suesse, T. Estimation of spatial autoregressive models with measurement error for large data sets. Comput. Stat.
**2018**, 33, 1627–1648. [Google Scholar] [CrossRef] - Suesse, T.; Zammit-Mangion, A. Computational aspects of the EM algorithm for spatial econometric models with missing data. J. Stat. Comput. Simul.
**2017**, 87, 1767–1786. [Google Scholar] [CrossRef] - Suesse, T. Marginal maximum likelihood estimation of SAR models with missing data. Comput. Stat. Data Anal.
**2018**, 120, 98–110. [Google Scholar] [CrossRef] - Goulard, M.; Laurent, T.; Thomas-Agnan, C. About predictions in spatial autoregressive models: Optimal and almost optimal strategies. Spat. Econ. Anal.
**2017**, 12, 304–325. [Google Scholar] [CrossRef] [Green Version] - Wilhelm, S.; de Matos, M.G. Estimating Spatial Probit Models in R. R J.
**2013**, 5, 130–143. [Google Scholar] [CrossRef] [Green Version] - Wilhelm, S.; de Matos, M.G. Spatialprobit: Spatial Probit Models; R Package Version 0.9-11; R Foundation for Statistical Computing: Vienna, Austria, 2015. [Google Scholar]
- Klier, T.; McMillen, D.P. Clustering of Auto Supplier Plants in the United States: Generalized Method of Moments Spatial Logit for Large Samples. J. Bus. Econ. Stat.
**2008**, 26, 460–471. [Google Scholar] [CrossRef] - McMillen, D.P. Quantile Regression for Spatial Data; Springer: Berlin/Heidelberg, Germany, 2013; p. 66. [Google Scholar]
- Dong, G.; Harris, R. Spatial autorgressive models for geographically hierarchical data structures. Geogr. Anal.
**2015**, 47, 173–191. [Google Scholar] [CrossRef] - Dong, G.; Harris, R.; Jones, K.; Yu, J. Multilevel modeling with spatial interaction effects with application to an emerging land market in Beijing, China. PLoS ONE
**2015**, 10. [Google Scholar] [CrossRef] - Dong, G.; Ma, J.; Harris, R.; Price, G. Spatial Random Slope Multilevel Modeling Using Multivariate Conditional Autoregressive Models: A Case Study of Subjective Travel Satisfaction in Beijing. Ann. Am. Assoc. Geogr.
**2016**, 106, 19–35. [Google Scholar] [CrossRef] [Green Version] - Dong, G.; Harris, R.; Mimis, A. HSAR: Hierarchical Spatial Autoregressive Model; R Package Version 0.5.1; R Foundation for Statistical Computing: Vienna, Austria, 2020. [Google Scholar]
- Umlauf, N.; Adler, D.; Kneib, T.; Lang, S.; Zeileis, A. Structured Additive Regression Models: An R Interface to BayesX. J. Stat. Softw.
**2015**, 63, 1–46. [Google Scholar] [CrossRef] [Green Version] - Umlauf, N.; Kneib, T.; Lang, S.; Zeileis, A. R2BayesX: Estimate Structured Additive Regression Models with ‘BayesX’; R Package Version 1.1-1; R Foundation for Statistical Computing: Vienna, Austria, 2017. [Google Scholar]
- Bivand, R.; Sha, Z.; Osland, L.; Thorsen, I.S. A comparison of estimation methods for multilevel models of spatially structured data. Spat. Stat.
**2017**, 21, 440–459. [Google Scholar] [CrossRef] - Griffith, D.A. Spatial Autocorrelation and Spatial Filtering; Springer: New York, NY, USA, 2003. [Google Scholar]
- Patuelli, R.; Schanne, N.; Griffith, D.A.; Nijkamp, P. Persistence of regional unemployment: Application of a spatial filtering approach to local labor markets in Germany. J. Reg. Sci.
**2012**, 52, 300–323. [Google Scholar] [CrossRef] - Griffith, D.A. Spatial Filtering. In Handbook of Applied Spatial Analysis; Fischer, M., Getis, A., Eds.; Springer: Berlin, Germany, 2010; pp. 18, 301–318. [Google Scholar]
- Griffith, D.A.; Paelinck, J. Non-Standard Spatial Statistics and Spatial Econometrics; Springer: Berlin, Germany, 2011. [Google Scholar]
- Tiefelsdorf, M.; Griffith, D.A. Semiparametric filtering of spatial autocorrelation: The eigenvector approach. Environ. Plan. A
**2007**, 39, 1193–1221. [Google Scholar] [CrossRef] - Dray, S.; Legendre, P.; Peres-Neto, P.R. Spatial modeling: A comprehensive framework for principle coordinate analysis of neighbor matrices (PCNM). Ecol. Model.
**2006**, 196, 483–493. [Google Scholar] [CrossRef] - Griffith, D.A.; Peres-Neto, P.R. Spatial modeling in ecology: The flexibility of eigenfunction spatial analyses. Ecology
**2006**, 87, 2603–2613. [Google Scholar] [CrossRef] - Dray, S.; Couteron, P.; Fortin, M.J.; Legendre, P.; Peres-Neto, P.R.; Bellier, E.; Bivand, R.; Blanchet, F.G.; de Cáceres, M.; Dufour, A.B.; et al. Community ecology in the age of multivariate multiscale spatial analysis. Ecol. Monogr.
**2012**, 82, 257–275. [Google Scholar] [CrossRef] - Dray, S.; Bauman, D.; Blanchet, G.; Borcard, D.; Clappe, S.; Guenard, G.; Jombart, T.; Larocque, G.; Legendre, P.; Madi, N.; et al. Adespatial: Multivariate Multiscale Spatial Analysis; R Package Version 0.3-13; R Foundation for Statistical Computing: Vienna, Austria, 2021. [Google Scholar]
- Murakami, D.; Griffith, D.A. Eigenvector Spatial Filtering for Large Data Sets: Fixed and Random Effects Approaches. Geogr. Anal.
**2019**, 51, 23–49. [Google Scholar] [CrossRef] [Green Version] - Murakami, D. Spmoran: Moran Eigenvector-Based Scalable Spatial Additive Mixed Models; R Package Version 0.2.1; R Foundation for Statistical Computing: Vienna, Austria, 2021. [Google Scholar]
- Fotheringham, A.S.; Brunsdon, C.; Charlton, M.E. Geographically Weighted Regression: The Analysis of Spatially Varying Relationships; Wiley: Chichester, UK, 2002. [Google Scholar]
- Badinger, H.; Egger, P. Estimation of higher-order spatial autoregressive cross-section models with heteroscedastic disturbances. J. Reg. Sci.
**2010**, 90, 213–235. [Google Scholar] [CrossRef] - Elhorst, J.; Lacombe, D.J.; Piras, G. On model specification and parameter space definitions in higher order spatial econometric models. Reg. Sci. Urban Econ.
**2012**, 42, 211–220. [Google Scholar] [CrossRef] - Kelejian, H.H.; Prucha, I.R. Estimation of Simultaneous systems of spatially interrelated cross sectional equations. J. Econom.
**2004**, 118, 27–50. [Google Scholar] [CrossRef] [Green Version] - Drukker, D.M.; Egger, P.H.; Prucha, I.R. Simultaneous Equations Models with Higher-Order Spatial or Social Network, Interactions; Working Paper; Department of Economics, University of Maryland: College Park, MD, USA, 2017. [Google Scholar]
- Angulo, A.; Lopez, F.A.; Minguez, R.; Mur, J. Spsur: Spatial Seemingly Unrelated Regression Models; R Package Version 1.0.1.6; R Foundation for Statistical Computing: Vienna, Austria, 2020. [Google Scholar]
- Wagner, M.; Zeileis, A. Heterogeneity and Spatial Dependence of Regional Growth in the EU: A Recursive Partitioning Approach. Ger. Econ. Rev.
**2019**, 20, 67–82. [Google Scholar] [CrossRef] - Wagner, M.; Zeileis, A. lagsarlmtree: Spatial Lag Model Trees; R Package Version 1.0-1; R Foundation for Statistical Computing: Vienna, Austria, 2019. [Google Scholar]
- Nickell, S. Biases in dynamic models with fixed effects. Econom. J. Econom. Soc.
**1981**, 49, 1417–1426. [Google Scholar] [CrossRef] - Arellano, M.; Bond, S. Some tests of specification for panel data: Monte Carlo evidence and an application to employment equations. Rev. Econ. Stud.
**1991**, 58, 277–297. [Google Scholar] [CrossRef] [Green Version] - Elhorst, J.P. Dynamic models in space and time. Geogr. Anal.
**2001**, 33, 119–140. [Google Scholar] [CrossRef] [Green Version] - Elhorst, J.P. Unconditional maximum likelihood estimation of linear and log-linear dynamic models for spatial panels. Geogr. Anal.
**2005**, 37, 85–106. [Google Scholar] [CrossRef] - Yu, J.; De Jong, R.; Lee, L.F. Quasi-maximum likelihood estimators for spatial dynamic panel data with fixed effects when both n and T are large. J. Econom.
**2008**, 146, 118–134. [Google Scholar] [CrossRef] [Green Version] - Elhorst, J.P. Dynamic spatial panels: Models, methods, and inferences. J. Geogr. Syst.
**2012**, 14, 5–28. [Google Scholar] [CrossRef] - Aquaro, M.; Bailey, N.; Pesaran, M.H. Estimation and inference for spatial models with heterogeneous coefficients: An application to US house prices. J. Appl. Econom.
**2020**. [Google Scholar] [CrossRef] - Pesaran, M.H.; Smith, R. Estimating long-run relationships from dynamic heterogeneous panels. J. Econom.
**1995**, 68, 79–113. [Google Scholar] [CrossRef] - Aquaro, M.; Belotti, F.; Johnsson, I.; Millo, G. Estimation and Inference for Spatial Models with Heterogeneous Coefficients in MATLAB, Python, R, and Stata.
**2021**. Unpublished. [Google Scholar] - Croissant, Y.; Millo, G. Panel Data Econometrics with R; Wiley Online Library: Hoboken, NJ, USA, 2019. [Google Scholar]
- Peng, R.D. Reproducible research in computational science. Science
**2011**, 334, 1226–1227. [Google Scholar] [CrossRef] [PubMed] [Green Version]

**Figure 1.**Composition of used car prices, US states. Upper panel, average used car prices in 1960 for cars that were new in 1955–1959 and graph of contiguous states shown in blue; lower panel left: transport costs of new cars; right: state taxes on new cars.

**Figure 3.**Four eigenvectors chosen by the Tiefelsdorf and Griffith [114] approach to spatial filtering.

**Figure 4.**First four eigenvectors chosen by the [119] approach to spatial filtering.

**Table 1.**Simulation of the power of a t-test on the regression coefficient at the nominal level of $0.05$ for uncorrelated y and x and spatial dependence for the response ${\rho}_{y}$ and the covariate ${\rho}_{x}$, following Smith and Lee [24].

${\mathit{\rho}}_{\mathit{x}}$ 0 | ${\mathit{\rho}}_{\mathit{x}}$ 0.2 | ${\mathit{\rho}}_{\mathit{x}}$ 0.5 | ${\mathit{\rho}}_{\mathit{x}}$ 0.8 | |
---|---|---|---|---|

${\rho}_{y}$ 0 | 0.0505 | 0.0504 | 0.0499 | 0.0502 |

${\rho}_{y}$ 0.2 | 0.0497 | 0.0561 | 0.0647 | 0.0802 |

${\rho}_{y}$ 0.5 | 0.0496 | 0.0647 | 0.1002 | 0.1625 |

${\rho}_{y}$ 0.8 | 0.0532 | 0.0848 | 0.1650 | 0.3134 |

(1) | (2) | (3) | |
---|---|---|---|

(Intercept) | 1435.971 | 1404.473 | 1436.256 |

(27.178) | (23.200) | (11.515) | |

I(transp + salesTax) | 0.686 | ||

(0.173) | |||

transp | 1.297 | ||

(0.189) | |||

salesTax | −0.073 | −0.080 | |

(0.211) | (0.214) | ||

${\sigma}^{2}$ | 3181.985 | 2139.748 | 2206.494 |

**Table 3.**Tabulation of Moran’s I for regression residuals for three model specifications; alternative hypothesis: spatially autocorrelated residuals.

(1) | (2) | (3) | |
---|---|---|---|

Observed Moran I | 0.5738 | 0.5385 | 0.5917 |

Expectation | −0.0297 | −0.0361 | −0.0175 |

Variance | 0.0089 | 0.0090 | 0.0094 |

Standard deviate | 6.4071 | 6.0731 | 6.2897 |

Pr(z != 0) | 1.4830e−10 | 1.2543e−09 | 3.1804e−10 |

(1) | (2) | (3) | |
---|---|---|---|

LMerr | 1.4160e−08 | 1.0208e−07 | 4.9702e−09 |

LMlag | 1.5194e−10 | 6.4062e−09 | 8.8371e−09 |

RLMerr | 0.839688 | 0.615013 | 0.015588 |

RLMlag | 0.0028841 | 0.0176952 | 0.0296537 |

SARMA | 1.2226e−09 | 4.2232e−08 | 3.5187e−09 |

**Table 5.**Fitted spatial regression model coefficients for model (2): average 1960 prices of 1955–1955 cars, with transport cost and sales tax covariates (standard error estimates in parentheses).

OLS | SEM | SLM | SDM | |
---|---|---|---|---|

(Intercept) | 1404.473 | 1445.411 | 441.828 | 516.990 |

(23.200) | (36.934) | (150.080) | (166.969) | |

transp | 1.297 | 0.873 | 0.466 | 0.230 |

(0.189) | (0.299) | (0.168) | (0.454) | |

salesTax | −0.073 | 0.043 | −0.053 | −0.161 |

(0.211) | (0.122) | (0.143) | (0.156) | |

lag(transp) | 0.317 | |||

(0.536) | ||||

lag(salesTax) | −0.474 | |||

(0.301) | ||||

$\rho $ | 0.721 | |||

(0.100) | ||||

$\lambda $ | 0.683 | 0.645 | ||

(0.105) | (0.115) | |||

${\sigma}^{2}$ | 2139.748 | 999.691 | 974.969 | 942.052 |

**Table 6.**Fitted spatial regression model coefficients for SLM, SEM, and SARAR: DUI data (standard error estimates in parentheses).

SEM | SLM | SARAR | |
---|---|---|---|

(Intercept) | −5.432 | −6.410 | −6.410 |

(0.229) | (0.418) | (0.418) | |

nondui | 0.000 | 0.000 | 0.000 |

(0.001) | (0.001) | (0.001) | |

vehicles | 0.016 | 0.016 | 0.016 |

(0.001) | (0.001) | (0.001) | |

dry | 0.104 | 0.106 | 0.106 |

(0.035) | (0.035) | (0.035) | |

police | 0.600 | 0.598 | 0.598 |

(0.015) | (0.015) | (0.015) | |

$\rho $ | 0.051 | 0.001 | |

(0.080) | |||

$\lambda $ | 0.047 | 0.047 | |

(0.017) | (0.017) |

**Table 7.**Fitted spatial regression model coefficients for SARAR using

`gstslshet`: DUI data (standard error estimates in parentheses).

SARAR Het | |
---|---|

(Intercept) | −6.410 |

(0.446) | |

nondui | 0.000 |

(0.001) | |

vehicles | 0.016 |

(0.001) | |

dry | 0.106 |

(0.034) | |

police | 0.598 |

(0.018) | |

$\lambda $ | 0.047 |

(0.018) | |

$\rho $ | −0.000 |

(0.037) |

**Table 8.**Fitted spatial regression model coefficients for LAG: dui data (standard error estimates in parentheses).

LAG HAC | s.e. (2SLS) | s.e. (HAC) | |
---|---|---|---|

(Intercept) | −6.410 | (0.418) | (0.466) |

nondui | 0.000 | (0.001) | (0.001) |

vehicles | 0.016 | (0.001) | (0.001) |

dry | 0.106 | (0.035) | (0.034) |

police | 0.598 | (0.015) | (0.020) |

$\lambda $ | 0.047 | (0.017) | (0.019) |

**Table 9.**Spatial error model estimates and timings for the DUI data set: GMM, ML (eigenvalue and sparse Cholesky log Jacobian), MCMC using sparse LU griddy Gibbs log Jacobian and INLA using the experimental

`"slm"`latent model.

GMM | Eigen | Cholesky | MCMC | INLA | |
---|---|---|---|---|---|

$\rho $ | 0.0509 | 0.0459 | 0.0459 | 0.0464 | 0.0461 |

(Intercept) | −5.4319 | −5.4329 | −5.4329 | −5.4344 | −5.4331 |

nondui | 0.0003 | 0.0003 | 0.0003 | 0.0003 | 0.0003 |

vehicles | 0.0156 | 0.0156 | 0.0156 | 0.0156 | 0.0156 |

dry | 0.1037 | 0.1039 | 0.1039 | 0.1049 | 0.1039 |

police | 0.5999 | 0.5998 | 0.5998 | 0.5995 | 0.5998 |

$\rho $ s.e. | 0.0805 | 0.0299 | 0.0302 | 0.0299 | |

LR test | 0.1287 | 0.1287 | |||

Set up | 11.8420 s | 0.0390 s | 4.3530 s | 0.6579 s | |

Fitting | 0.0170 s | 0.0820 s | 25.1193 s | ||

Sampling | 2.9090 s | ||||

Completion | 92.8660 s | 0.1140 s | 0.0000 s | 0.6290 s |

**Table 10.**Fitted spatial regression model coefficients for SLM, SEM, and SARAR: dui data (standard error estimates in parentheses).

SEM | SEM-End | SLM | SLM-End | SARAR | SARAR-End | |
---|---|---|---|---|---|---|

(Intercept) | −5.432 | 15.782 | −6.410 | 11.850 | −6.410 | 11.920 |

(0.229) | (1.606) | (0.418) | (1.724) | (0.416) | (1.696) | |

nondui | 0.000 | −0.000 | 0.000 | −0.000 | 0.000 | −0.000 |

(0.001) | (0.003) | (0.001) | (0.003) | (0.001) | (0.003) | |

vehicles | 0.016 | 0.094 | 0.016 | 0.094 | 0.016 | 0.094 |

(0.001) | (0.006) | (0.001) | (0.006) | (0.001) | (0.006) | |

dry | 0.104 | 0.400 | 0.106 | 0.400 | 0.106 | 0.401 |

(0.035) | (0.092) | (0.035) | (0.092) | (0.035) | (0.092) | |

police | 0.600 | −1.365 | 0.598 | −1.366 | 0.598 | −1.367 |

(0.015) | (0.144) | (0.015) | (0.143) | (0.015) | (0.142) | |

$\rho $ | 0.047 | −0.005 | −0.006 | −0.0819 | ||

(0.030) | (0.025) | (0.035) | (0.0304) | |||

$\lambda $ | 0.047 | 0.188 | 0.047 | 0.186 | ||

(0.017) | (0.047) | (0.017) | (0.046) |

**Table 11.**Parameter estimates from all spatial panel models for the Rice Farming dataset; left to right: pooled SEM, SAR-RE, SEM-FE, SAREM-FE, SEM-RE, SEM-RE (KKP version), SAREM-AR(1)-RE and SAREM-AR(1)-RE (KKP version). Standard errors are reported only for the spatial parameters.

(1) | (2) | (3) | (4) | (5) | (6) | (7) | (8) | |
---|---|---|---|---|---|---|---|---|

(Intercept) | 5.2240 | 2.9114 | 5.2359 | 5.2400 | 4.7440 | 4.5834 | ||

log(seed) | 0.1224 | 0.0916 | 0.1025 | 0.1033 | 0.1153 | 0.1155 | 0.1146 | 0.1151 |

log(urea) | 0.1430 | 0.1301 | 0.1043 | 0.1045 | 0.1280 | 0.1286 | 0.1266 | 0.1270 |

phosphate | 0.0006 | 0.0014 | 0.0006 | 0.0006 | 0.0006 | 0.0006 | 0.0006 | 0.0006 |

log(totlabor) | 0.2200 | 0.2370 | 0.2350 | 0.2344 | 0.2301 | 0.2289 | 0.2336 | 0.2326 |

log(size) | 0.5076 | 0.4547 | 0.4830 | 0.4859 | 0.5021 | 0.5031 | 0.5021 | 0.5035 |

pesticide | −0.0117 | 0.0366 | −0.0178 | −0.0152 | −0.0106 | −0.0109 | −0.0110 | −0.0111 |

high yield | 0.1212 | 0.0260 | 0.0983 | 0.0983 | 0.1149 | 0.1178 | 0.1107 | 0.1133 |

mixed | 0.0894 | 0.0798 | 0.1073 | 0.1075 | 0.0980 | 0.0990 | 0.0954 | 0.0962 |

wet season | 0.0630 | −0.0390 | 0.0849 | 0.0165 | 0.0689 | 0.0687 | 0.0488 | 0.0405 |

lambda | 0.3433 | 0.2135 | 0.0734 | 0.0984 | ||||

S.E.lambda | 0.0286 | 0.0956 | 0.0835 | 0.0842 | ||||

rho | 0.7225 | 0.7691 | 0.6902 | 0.7488 | 0.7421 | 0.7192 | 0.7039 | |

S.E.rho | 0.0332 | 0.0275 | 0.0531 | 0.0304 | 0.0310 | 0.0433 | 0.0454 | |

psi | 0.0899 | 0.0943 | ||||||

S.E.psi | 0.0409 | 0.0411 |

EC2SLS | (std. err.) | Spatial EC2SLS | (std. err.) | |
---|---|---|---|---|

lprbarr | −0.413 | (0.097) | −0.340 | (0.059) |

lpolpc | 0.435 | (0.090) | 0.354 | (0.050) |

(Intercept) | −0.954 | (1.284) | −0.698 | (1.144) |

lprbconv | −0.323 | (0.054) | −0.275 | (0.031) |

lprbpris | −0.186 | (0.042) | −0.164 | (0.033) |

lavgsen | −0.010 | (0.027) | −0.014 | (0.025) |

ldensity | 0.429 | (0.055) | 0.446 | (0.049) |

lwcon | −0.007 | (0.040) | −0.005 | (0.037) |

lwtuc | 0.045 | (0.020) | 0.039 | (0.017) |

lwtrd | −0.008 | (0.041) | −0.012 | (0.039) |

lwfir | −0.004 | (0.029) | −0.006 | (0.027) |

lwser | 0.006 | (0.020) | 0.004 | (0.019) |

lwmfg | −0.204 | (0.080) | −0.185 | (0.074) |

lwfed | −0.164 | (0.159) | −0.067 | (0.141) |

lwsta | −0.054 | (0.106) | −0.041 | (0.097) |

lwloc | 0.163 | (0.120) | 0.118 | (0.110) |

lpctymle | −0.108 | (0.140) | −0.066 | (0.116) |

lpctmin | 0.189 | (0.041) | 0.185 | (0.036) |

west | −0.227 | (0.100) | −0.224 | (0.089) |

central | −0.194 | (0.060) | −0.210 | (0.056) |

urban | −0.225 | (0.116) | −0.179 | (0.100) |

d82 | 0.011 | (0.026) | 0.006 | (0.020) |

d83 | −0.084 | (0.031) | −0.064 | (0.026) |

d84 | −0.103 | (0.037) | −0.077 | (0.032) |

d85 | −0.096 | (0.049) | −0.073 | (0.044) |

d86 | −0.069 | (0.060) | −0.057 | (0.054) |

d87 | −0.031 | (0.071) | −0.034 | (0.064) |

$\lambda $ | 0.268 | (0.069) |

HGLM | GAM | SF | ESF | ME | SAR | |
---|---|---|---|---|---|---|

HGLM | 1.0000 | 0.9593 | 0.4443 | 0.9046 | 0.9588 | 0.9500 |

GAM | 0.9593 | 1.0000 | 0.4064 | 0.8833 | 0.8856 | 0.8462 |

SF | 0.4443 | 0.4064 | 1.0000 | 0.2635 | 0.4570 | 0.4992 |

ESF | 0.9046 | 0.8833 | 0.2635 | 1.0000 | 0.8751 | 0.8336 |

ME | 0.9588 | 0.8856 | 0.4570 | 0.8751 | 1.0000 | 0.9410 |

SAR | 0.9500 | 0.8462 | 0.4992 | 0.8336 | 0.9410 | 1.0000 |

Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |

© 2021 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Bivand, R.; Millo, G.; Piras, G.
A Review of Software for Spatial Econometrics in R. *Mathematics* **2021**, *9*, 1276.
https://doi.org/10.3390/math9111276

**AMA Style**

Bivand R, Millo G, Piras G.
A Review of Software for Spatial Econometrics in R. *Mathematics*. 2021; 9(11):1276.
https://doi.org/10.3390/math9111276

**Chicago/Turabian Style**

Bivand, Roger, Giovanni Millo, and Gianfranco Piras.
2021. "A Review of Software for Spatial Econometrics in R" *Mathematics* 9, no. 11: 1276.
https://doi.org/10.3390/math9111276