[R] Spatial Panel Model by Maximum Likelihood: error message

Linus Holtermann holtermann at hwwi.org
Mon Dec 7 16:06:05 CET 2015

Maybe "e" has the wrong class. Probably it is a matrix. Try listw = mat2listw(e)

Mit freundlichen Grüßen

Linus Holtermann
Hamburgisches WeltWirtschaftsInstitut gemeinnützige GmbH (HWWI)
Heimhuder Straße 71
20148 Hamburg
Tel +49-(0)40-340576-336
Internet: www.hwwi.org
Email: holtermann at hwwi.org
Amtsgericht Hamburg HRB 94303
Geschäftsführer: Prof. Dr. Henning Vöpel
Prokura: Dipl. Kauffrau Alexis Malchin
Umsatzsteuer-ID: DE 241849425

-----Ursprüngliche Nachricht-----
Von: R-help [mailto:r-help-bounces at r-project.org] Im Auftrag von Peter Karpestam
Gesendet: Montag, 7. Dezember 2015 11:07
An: r-help at r-project.org
Betreff: [R] Spatial Panel Model by Maximum Likelihood: error message

Dear R-users!

Beforehand I do apologize for this fundamental type of question. But I am new to R, and I have indeed spent several hours online trying to avoid spamming this forum with basic questions.
I am still not able to find out what's wrong.

I attach my code! I nead to estimate a spatial panel model. In doing so, I have installed and loaded the "splm package".

> b<- 
> read.dta13('C:/Users/Peter/Documents/R/win-library/3.2/ENHR/tillvaxtte
> st2.dta') 
> mydata1=read.table('C:/Users/Peter/Documents/R/win-library/3.2/ENHR/av
> stand6.txt', header=FALSE)
> e=matrix(mydata, nrow=286, ncol=286)
> tillvaxt<-pdata.frame(b)
> fm<-dlnypc~Totinfly+totutfly
> fespaterr <- spml(fm, data = tillvaxt,listw =e,
+ model="within", spatial.error="b", Hess = FALSE)
Error in listw2mat(x) : non-positive number of entities

The error message is found in the last line. I am checking my "weighting matrix" and according to my understanding, the matrix fulfills the requirement (i.e. the diagonal elements are zero, whereas remaining elements are positive). It is a symmetric 286X286 matrix.

Obviuosly, there is something wrong with my e-matrix, but I can't figure out how. There are in fact no negative elements in the matrix.

Thank you in advance!

	[[alternative HTML version deleted]]

R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list