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

Peter Karpestam roypeter77 at hotmail.com
Mon Dec 7 11:06:36 CET 2015


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/tillvaxttest2.dta')
> mydata1=read.table('C:/Users/Peter/Documents/R/win-library/3.2/ENHR/avstand6.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!

Peter 
 		 	   		  
	[[alternative HTML version deleted]]



More information about the R-help mailing list