[R-sig-Geo] error in splm()

GEMA FERNANDEZ-AVILES CALDERON Gema.FAviles at uclm.es
Thu Jan 22 12:00:50 CET 2015


Dear list:


I'm new in spatial panel data. I try to do a simple model but I have the following error in splm library. Please, could you help me?


Best,

Gema



*****************************************************************************
## Read the data
library(splm)
library("spdep")
madrid     #my data: 10 years, 179 municipalities, 38 variables

> str(madrid)
'data.frame':   1790 obs. of  38 variables:
 $ id                      : Factor w/ 179 levels "Acebeda (La)",..: 1 1 1 1 1 1 1 1 1 1 ...
 $ year                    : num  2000 2001 2002 2003 2004 ...
 $ pop                     : num  57 56 53 55 55 60 59 58 57 61 ...
 $ Extensión..km2.         : num  22.1 22.1 22.1 22.1 22.1 22.1 22.1 22.1 22.1 22.1 ...
 $ Altit                   : num  1269 1269 1269 1269 1269 ...
 $ DistaMadrid             : num  88 88 88 88 88 88 88 88 88 88 ...
 $ longit                  : num  446704 446704 446704 446704 446704 ...
 $ latit                   : num  4549417 4549417 4549417 4549417 4549417 ...
...
...

?fm <- log(nox) ~  log(EEC_pc) +  log(car_1000_ab)

### W-Matrix
library(maptools)
mmapa= readShapePoly("MadriMunAgrup.shp")
plot(mmapa)
wq.mad <- poly2nb(mmapa, queen=T)  # Queen matrix (binaria)
madww <- nb2listw(wq.mad, style="W", zero.policy=TRUE) # Matriz std

### The model
sararremod <- spml(formula = fm, data = madrid, index = NULL,
  listw = madww, model = "random", lag = TRUE, spatial.error = "b")

?Error en if (e1 == 0) return(spam(0, nrow(e2), ncol(e2))) else { :
  valor ausente donde TRUE/FALSE es necesario




Gema Fernández-Avilés

Statistics Department
University of Castile-La Mancha at Toledo
http://www.uclm.es/profesorado/gemafaviles/

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list