[R-sig-Geo] Error while performing Lagrange Multiplier test (bsktest)
Rolando Valdez
rv@|dezr @end|ng |rom gm@||@com
Wed Jun 26 20:51:11 CEST 2019
Dear all:
I am trying to compute a Lagrange Multiplier test through the function
bsktest for panel data sets.
This is what I am doing:
library(rgdal)
library(spdep)
library(sf)
library(spatialreg)
spatialreg::set.ZeroPolicyOption(TRUE)
spdep::set.ZeroPolicyOption(TRUE)
shell.exec("
https://drive.google.com/open?id=1PHm5NX9IPoeo6vgv7Zb3VolNfOoApm6c&authuser=rvaldez35@uabc.edu.mx&usp=drive_fs
")
headmuns <- readOGR(".", "head_muns_2013") #Reading shapefile with
localities
IDs <- row.names(headmuns)
wgs84 <- "+proj=longlat +ellps=WGS84"
headmunsWGS84 <- spTransform(headmuns, CRS(wgs84)) # Changing CRS
headmunsxy <-coordinates(headmunsWGS84)
#Creating a neighbor matrix with 20 km threshold distance
nb20 <- dnearneigh(headmunsxy, 0, 20, longlat = TRUE, row.names = IDs)
w20 <- nb2listw(nb20, style = "W", zero.policy = TRUE)
### The dataset
shell.exec("
https://drive.google.com/file/d/1aeeetHi1p6YbFiWRAmI7dGqDoqBnsdAx/view?usp=sharing
")
library(splm)
library(plm)
dbout <- read_dta("dbout.dta", package = "haven")
pdbout <- pdata.frame(dbout, index = c("geocode", "yr"))
spdbout <- pdbout[order(pdbout$yr),]
restmod <- ilny ~ ilnk + factor(yr)
bsktest(x = restmod, data = spdbout, listw = w20, test = "CLMlambda")
Then I get the next error:
Error in (WpsW) %*% q :
Cholmod error 'X and/or Y have wrong dimensions' at file
../MatrixOps/cholmod_sdmult.c, line 90
--
Rol~
[[alternative HTML version deleted]]
More information about the R-sig-Geo
mailing list