[R-sig-Geo] SLX model for splm package in R

Roger Bivand Roger.Bivand at nhh.no
Sun Aug 28 23:42:29 CEST 2016


On Sun, 28 Aug 2016, dfamaral at usp.br wrote:

> Dear colleagues,
>
> Does anyone know how to implement Spatial Lag of X (SLX) model for panel 
> data using splm package? I tried the following to create a WX matrix and 
> then apply Fixed and Random Effects:
>
> tb <- read.csv2("panel.csv", header = TRUE, sep = ";", dec = ".")
> time <- length(unique(tb$year))
> X <- as.matrix(tb[ ,3:20])

class(X) is not "pseries", is it?

> WX <- slag(X, listw, maxlag = 1)
>
> I see that slag is applicable for vectors of pseries, but this command 
> led to the error message: "Error in UseMethod("slag"): no applicable 
> method for 'slag' applied to an object of class "c('matrix', 'double', 
> 'numeric')"

slag.default() takes a vector, slag.pseries() a "pseries" object.

>
> Is there any way to implement this SLX model for panel series?

Did you look at spdep::create_WX?

>
> Regards,
>
> Daniel.
>
> 	[[alternative HTML version deleted]]
>

Please do not post HTML - like insects, HTML carries infectious payloads 
and wastes bandwidth and server processing capacity.

> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

-- 
Roger Bivand
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 91 00
e-mail: Roger.Bivand at nhh.no
http://orcid.org/0000-0003-2392-6140
https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en
http://depsy.org/person/434412



More information about the R-sig-Geo mailing list