1

I have a shapefile of panel data (multiple years of observations for each polygon). I am estimating fixed effects spatial regression models with this data. I used one year of this data to generate a spatial weights matrix based on the queen's contiguity neighbors:

spMini = dtaSub[ which(dtaSub$Year=='2001'),]
t2 = as(spMini, 'Spatial')
dta = as.data.frame(dtaSub)
neighbors = poly2nb(t2, queen = TRUE)
matrix_list = nb2listw(neighbors)

#Make shapefile into dataframe for regressions
dta = as.data.frame(dtaSub)

I have used the splm package's maximum likelihood-based functions to specify a spatial lag (assumes rho nonzero), spatial error (assumes lambda nonzero), and spatial autocorrelation (assumes rho and lambda nonzero) model. These are as follows


#Design a model
fm = nmPxlsD ~ cmps_13 + cmps_35 + cmps_57 + cmps_79 + cmp_911 +
  cm_1113 + cm_1315 + cm_1517 + cm_1720 

#Spatial lag model - estimates lambda
spatialError = spml(fm, 
                data=dtaSub,
                listw=matrix_list,
                model="within", 
                effect = "twoway",
               spatial.error = "b",
               )

#Spatial error model (SEM) - estimates rho
spatialLag = spml(fm, 
                  data=dtaSub,
                  listw=matrix_list,
                  model="within", 
                  effect = "twoway",
                  lag = T)

#Spatial autocorrelation model - estimates rho and lambda
spatialAuto = spml(fm, 
                  data=dtaSub,
                  listw=matrix_list,
                  index = c("ID", "Year"),
                  model="within", 
                  effect = "twoway",
                  lag = T,
                  spatial.error = "b") #"b" = "kkp" for a FE model


GNM = spml(fm, 
                   data=dtaSub,
                   listw=matrix_list,
                   listw2=matrix_list,
                   index = c("ID", "Year"),
                   model="within", 
                   effect = "twoway",
                   lag = F) 

I cannot find any documentation on how to use splm to estimate a General Nesting Spatial Model (which assumes rho, lambda, and gamma are nonzero) using maximum likelihood. Is the function different from "spml"?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.