Dear Roger,
I am glad to hear that the NAOK argument will be implemented in the next
release. Will it be implemented in functions besides lag.listw, such as
moran.plot?
I agree that "missing data is missing, really," which motivated me to
develop an ad hoc alternative to treating NA as zero, one that uses all
available information in a manner similar to pairwise deletion. I can not
make a case for including that approach in the spdep package (which is
great, by the way). However, I do think the approach is worthy of further
methodological inquiry, perhaps as a complement to multiple imputation on
the attribute side.
Thanks,
Chris
--
Christopher Moore, M.P.P.
Doctoral Student
Quantitative Methods in Education
University of Minnesota
moor0...@umn.edu
http://www.tc.umn.edu/~moor0554/
On Jan 1 2009, r-sig-geo-requ...@stat.math.ethz.ch wrote:
Date: Wed, 31 Dec 2008 12:36:57 +0100 (CET)
From: Roger Bivand <roger.biv...@nhh.no>
Subject: Re: [R-sig-Geo] Spatial Lags Excluding Neighbors' Missing
Attribute Values
To: Christopher Moore <moor0...@umn.edu>
Cc: r-sig-geo@stat.math.ethz.ch
Message-ID: <alpine.lrh.2.00.0812311223420.5...@reclus.nhh.no>
Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII
On Tue, 30 Dec 2008, Christopher Moore wrote:
Greetings,
I posted a request for assistance on 12/27/08:
<https://stat.ethz.ch/pipermail/r-sig-geo/2008-December/004733.html>.
I developed a satisfactory solution, which is posted below for others
who wish to similarly exclude neighbors' missing attribute values from W
style spatial lags.
Well, this is quite a detailed question, and this isn't the best time of
year to get rapid response. I don't think that your solution is
satisfactory - and I don't think that there is any viable alternative to
either imputing to fill all the missing values (I wouldn't do that), or
subsetting out incomplete cases and using the same subset on the "nb"
object (there are subset methods). What happens now is that in the
compiled code in "lagw" the sum is not incremented when the value is not
finite:
sum = 0.0;
for (j=0; j<INTEGER_POINTER(card)[i]; j++) {
k = INTEGER_POINTER(VECTOR_ELT(nb, i))[j];
wt = NUMERIC_POINTER(VECTOR_ELT(weights, i))[j];
tmp = NUMERIC_POINTER(x)[k-ROFFSET];
if (R_FINITE(tmp)) sum += tmp * wt;
}
NUMERIC_POINTER(ans)[i] = sum;
in src/lagw.c. In fact the NAOK argument is not being used, and should be,
so in the next release you will either get an error, or, for NAOK=TRUE,
you'll get an NA for the lagged value - that was the intention. If you can
make a case for a third choice, essentially doing what you describe, I can
consider it, but being conservative, missing data is missing, really,
isn't it?
Best wishes,
Roger
_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo