Appendix 4: Non-linear spatial models

The R commands related to the various procedures to estimate the spatial version of the probit and logit models are contained in the library (McSpatial). In all cases we assume that we want to estimate a probit/logit model where the latent variable is expressed as: y* = /io + (iX + fcZ + XWy* +£ and we also assume that the observations of the variables у, X and Z are stored in the active R session. As for the weight matrix W we have to use the mat specification and not the listw as in the linear models.

Let us now consider the various estimators of a spatial probit model. To start with, if we want to estimate the parameters of a spatial probit model using the ML technique, type the command:

> models <- spprobitml(y~x+z,wmat=W,stdprobit=F)

If we want estimate the same model using a generalized method of moments approach, we need to initialize the parameter p before starting the iterative search of a solution. So, before starting the procedure we have to type:

> rho=rhoO

rhoO being any value such that |rhoO | < 1. The robustness of the results with respect to different initial values should be tested in any practical circumstances. Having done so, now type:

> model9 <-gmmprobit(y~x+z,wmat=W,startrho=rho)

and similarly gmmlogit for the logit version.

Finally, if we wish to estimate the same model using the linearized generalized method of moments approach, type instead:

> modellO<-spprobit(y~x+z,wmat=W)

And, again, splogit for the logit version.

For the spatial tobit, instead, we use the following command contained in the library jspatialprobit):

> modelll<-sartobit(y~x+z,listw=W)

Appendix 5: Space–time models

The procedures for estimating spatial panels are contained in the R package called (splm) (Millo and Piras, 2012). With this command we also automatically load the (plm) package (Croissant and Millo, 2008) for the estimation of non- spatial models.

Both packages have very few formal requirements. The dataset can be stored in a regular dataset object, provided it contains the pair of indices related to individual locations and time so as to be unambiguously identified. The packages assume that the individual index are stored in the first column of the dataset and the time index the second column. If data are arranged in a different way, this must be stated explicitly.

The two main functions to be used are spml (spatial panel maximum likelihood) for ML estimation and spgm (spatial panel generalized method of moments) for GMM estimation.

If we ignore space, we use the plm function included in the (plm) package. The a-spatial fixed effects model, then can be simply estimated typing:

> modelO <- plm(y~x+z)

If we add the option model=“pooling” we can estimate a model with OLS model by pooling together all data (spatial and temporal):

> modelO <- plm(y ~ x+z, model="pooling", data=datafile)

For the spatial models estimated with ML the command is spml. This function makes use of three arguments:

  • - “Model”, which could assume the value of “random” or “fixed”
  • - “Spatial.error”, which may include the error component or not. This could assume the values n for no component, kkp for the Kapor—Kalejian-Prucha specification or b for Baltagi specification
  • - “Lag”, which may include the dependent variable lag component or not specified assuming the values TRUE or FALSE

In case of a random effect, we distinguish 4 cases.

i No spatial component, when both spatial.error and lag arc both set to null. In this case the ML estimation can be performed using the command spml with the following specifications:

> modell <- spml(y~x+z, listw=W, model="random", spatial . error="n" , lag=FALSE) where W is the usual weight matrix.

ii Spatial lag. In this case we must set the lag argument to TRUE:

> model2 <- spml(y~x+z, listw=W, mode1="random", spatial .error="n", lag=TRUE)

iii Spatial error using the Baltagi specification discussed in Section 5.3. In this case we set the lag argument to FALSE and the spatial.error argument to “b”:

> model3 <- spml(y~x+z, listw=W, mode1="random", spatial .error="b", lag=FALSE)

iv Spatial error using the Kapor-Kelejian-Prucha specification expressed in Section 5.3. In this case we set the lag argument to FALSE and the spatial.error argument to “kkp”:

> model4 <- spml(y~x+z, listw=W, mode1="random", spatial .error="kkp", lag=FALSE)

If, alternatively, we wish to use the generalized method of moments instead of the maximum likelihood we use the command spgm with similar arguments:

> models <- spgm(y~x+z, listw=W, mode1="random", spatial. error="kkp", lag=FALSE)

For fixed effects models estimated with maximum likelihood the command is always spml and the logic is similar. We only need to exclude the argument mod- el=“random” which by default considers the fixed effect.

If we wish to add a spatial lag to the specification, we can estimate it with the additional argument lag=TRUE:

> model7 <- spml(y~x+z, listw=W, spatial.error="none", lag=TRUE)

If, conversely we want to specify a spatial error component, we add the argument spatial. error=“b”:

> models <- spml(y~x+z, listw=W, spatial.error="b", lag=FALSE)

 
Source
< Prev   CONTENTS   Source   Next >