Peter Karpestam
2015-Dec-07 10:06 UTC
[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/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]]
Linus Holtermann
2015-Dec-07 15:06 UTC
[R] Spatial Panel Model by Maximum Likelihood: error message
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 Fax+49-(0)40-340576-776 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! Peter [[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.
Peter Karpestam
2015-Dec-07 15:43 UTC
[R] Spatial Panel Model by Maximum Likelihood: error message
Thank you but no! I have tried that as well and I get: "Error in mat2listw(e) : (list) object cannot be coerced to type 'double'"> From: holtermann at hwwi.org > To: roypeter77 at hotmail.com; r-help at r-project.org > Subject: AW: [R] Spatial Panel Model by Maximum Likelihood: error message > Date: Mon, 7 Dec 2015 15:06:05 +0000 > > 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 > Fax+49-(0)40-340576-776 > 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! > > Peter > > [[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.[[alternative HTML version deleted]]