SLX model for splm package in R
Hi, This is a great question because I faced the same problem a while back. What I did is to obtain the spatial weight matrix as (have spdep installed). S47matrix<-W1%*%S47 and then put it in my data frame and equation. Btw, above W1 is a spatial weights matrix I obtained from a neighbor list (W1=as.matrix(as_dgRMatrix_listw(ccListw))) and S47 is the dependent variable. m2<-data.frame(S41,S46,S47,S65,S68,S47matrix,MAD10000,NQPDA10000,TPBtA10000,DivA10000,Lnk10000) summary(m2<-zeroinfl(S47~MAD10000+NQPDA10000+S47matrix, dist="negbin")) I also wanted to ask whether I was on the right track. Professor Bivand, if this is a common problem could you direct us to a relevant page -if available and if at all possible- please? Your advice would be sincerely appreciated. Kind Regards- Thanks- Burcu --- Burcu H. Ozuduru, Gazi University, Faculty of Architecture, Department of City and Regional Planning Maltepe-Ankara Turkey t: +90-312-5823701 e: bozuduru at gazi.edu.tr http://websitem.gazi.edu.tr/bozuduru
On Mon, Aug 29, 2016 at 12:42 AM, Roger Bivand <Roger.Bivand at nhh.no> wrote:
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 _______________________________________________ R-sig-Geo mailing list R-sig-Geo at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo