An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20100617/f4a1cd5b/attachment.pl>
Problem with moran.test function
2 messages · Michael Haenlein, Roger Bivand
On Thu, 17 Jun 2010, Michael Haenlein wrote:
Dear Roger,
As per your suggestion, I moved back to spdep, version 0.5-11, 2010-05-31.
Based on your message I think the problem might have been that the input
file only had two columns and not three. As you might remember from some
previous conversations we had, I'm using spdep in the context of social
network analysis. So my initial input file only included information on who
is connected to whom (e.g., "2 3" or "5 7") but not on how strong/ weak that
connection is. I now included a third column that has the value 1 for all
pairs (e.g., "2 3 1" or "5 7 1") and reading now works fine. Probably
another indication that the read.dat2listw() function had some problems in
the previous version.
Within the new version of spdep also my estimation of Moran's I now works
perfectly fine:
Moran I statistic Expectation Variance
0.0191115263 -0.0002926544 0.0003092456
So I think the issue is solved. If you still would like to look at the input
files, please let me know and I'm happy to send them to you off-list.
I think the missing column is the key here, so I'll add a check to read.dat2listw(). Thanks, Roger
Thanks again for your help -- I appreciate a lot! Michael -----Original Message----- From: Roger Bivand [mailto:Roger.Bivand at nhh.no] Sent: Thursday, June 17, 2010 08:50 To: Michael Haenlein Cc: r-sig-geo at stat.math.ethz.ch Subject: Re: [R-sig-Geo] Problem with moran.test function On Thu, 17 Jun 2010, Michael Haenlein wrote: No, it is definitely better to find out what is wrong with Network.txt, as the change made in April to sn2listw() - called by read.dat2listw() was to trap defective input objects. Please look at traceback() after the error. Do debug() on read.dat2listw, and summary() on wmat and sn. Are there locale issues in reading the text file, perhaps (decimal symbol?)? This would feed downstream into the obviously wrong lagged values seen below. I'd be interested in access to the input file to strengthen defences against unusual weights, or weights seen by the system as unusual. I think that an errant final column is becoming a factor, then converted to numeric (with large n and many unique weights, their integer indices will become large). read.dat2listw() needs to check that there are 3 columns, and that the first two are integer, and the third is numeric, I think. But we need to see why reading the file is failing. Roger [[alternative HTML version deleted]]
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43 e-mail: Roger.Bivand at nhh.no