[R-sig-Geo] R-sig-Geo Digest, Vol 65, Issue 1
Christopher Moore
moor0554 at umn.edu
Mon Jan 5 17:42:41 CET 2009
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
moor0554 at umn.edu
http://www.tc.umn.edu/~moor0554/
On Jan 1 2009, r-sig-geo-request at stat.math.ethz.ch wrote:
>Date: Wed, 31 Dec 2008 12:36:57 +0100 (CET)
>From: Roger Bivand <Roger.Bivand at nhh.no>
>Subject: Re: [R-sig-Geo] Spatial Lags Excluding Neighbors' Missing
> Attribute Values
>To: Christopher Moore <moor0554 at umn.edu>
>Cc: r-sig-geo at stat.math.ethz.ch
>Message-ID: <alpine.LRH.2.00.0812311223420.5052 at 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
>
More information about the R-sig-Geo
mailing list