De: "Roger Bivand" <Roger.Bivand at nhh.no>
Para: dfamaral at usp.br
Cc: r-sig-geo at r-project.org
Enviadas: Domingo, 28 de Agosto de 2016 18:42:29
Assunto: Re: [R-sig-Geo] SLX model for splm package in R
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.