[R-sig-Geo] SLX model for splm package in R
dfamaral at usp.br
dfamaral at usp.br
Mon Aug 29 00:48:18 CEST 2016
Dear Professor and colleagues,
Thank you for the response. X is a matrix and tb is a data.frame:
> class(X)
[1] "matrix"
> class(tb)
[1] "data.frame"
I do not know how to apply slag to tb or X.
I also looked at spdep::create_WX and I understand its purpose is for "spatial simultaneous autoregressive error models", but in my case I just want a model such as:
y = beta1*X + beta2*WX + e
So, if anyone can give any help, I thank you again.
Daniel.
----- Mensagem original -----
> 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.
> > _______________________________________________
> > 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