On Tue, 16 Mar 2004, Koen Hufkens wrote:

> Hi all,
> 
> Followup on my questions concerning R + spdep:
> 
> I used dnearneigh() instead of knearneigh() to get the point point 
> relationships I wanted.
> 
> The old version looked like this:
> 
> http://users.pandora.be/requested/thesis/oldconnections.png
> 
> notice the sparse connection pattern between the points, certainly in the 
> centre.
> 
> I used dnearneight() to change this into this:
> 
> http://users.pandora.be/requested/thesis/connections.png
> 
> so the center points get more connections/interactions.
> 
> all ok, for the weights... but as before the weights are relative to the 
> connection and not to the distance and the connection. A consequence from 
> a binary spatial connectivity matrix I presume. nbdists() gives me a matix 
> of all the distances in the neighbourhood directions but I can't use them 
> to be a relative measure to convert the old weights into distance weighted 
> ones.

Towards the bottom of the examples on the help page for nb2listw(), you 
see:

     dlist <- nbdists(col.gal.nb, coords)
     dlist <- lapply(dlist, function(x) 1/x)
     col.w.d <- nb2listw(col.gal.nb, glist=dlist)
     summary(unlist(col.w$weights))
     summary(unlist(col.w.d$weights))

as an example for imposing inverse distance weights on a weights object. 
In your case, many distances will be equal, I think.

> 
> Question is, what's the influence of this on the final result?
> 
> Old results:
> 
>          Moran's I test under normality
> 
> Moran I statistic standard deviate = 0.2911, p-value = 0.771
> alternative hypothesis: two.sided
> sample estimates:
> Moran I statistic       Expectation          Variance
>         -0.03762590       -0.08333333        0.02464896
> 
> New results with the same data and a new weights matrix:
> 
> data:  a1$data
> weights: a1.listw
> 
>          Moran's I test under normality
> 
> Moran I statistic standard deviate = 0.3303, p-value = 0.7412
> alternative hypothesis: two.sided
> sample estimates:
> Moran I statistic       Expectation          Variance
>        -0.03703572       -0.08333333        0.01964896
> 
>          Moran's I test under randomisation
> 
> Moran I statistic standard deviate = 0.3305, p-value = 0.741
> alternative hypothesis: two.sided
> sample estimates:
> Moran I statistic       Expectation          Variance
>        -0.03703572       -0.08333333        0.01962520
> 

So it appears that, according to Moran's I, there is no (significant) 
spatial autocorrelation detected in your data. Have you looked at 
moran.plot() too? With few points it will be difficult to detect much, I 
think.


>          Monte-Carlo simulation of Moran's I
> 
> number of simulations + 1: 1000
> 
> statistic = -0.037, observed rank = 673, p-value = 0.327
> alternative hypothesis: greater
> 
> You can see that the p-value drops over normal, random to the MC 
> simulation.
> But I don't come to a significant difference between the statistic and the 
> expected value. I think I can conclude that in this case there is a slight 
> to zero spatial autocorrelation between samples and this could as well 
> been a set of data sampled at random in this particular plot.
> 
> Just for the record: I don't see the difference between what is done in 
> the test under randomisation and the test using MC simulation.
> 

Under randomisation, only the analytical formulae are used, the MC 
simulation actually permutes the data on the tesselation.

> As I may quote:
> 
> "With a Monte Carlo test the significance of an observed test statistic is 
> assessed by comparing it with as a sample of test statistics obtained by 
> generating random samples using some assumed model. If the assumed model 
> implies that all data orderings are equally likely then this amounts to a 
> randomisation test with random sampling of the randomisation distribution" 
> - "Brian F. J. Manly - Randomization, bootstrap and monte carlo methods in 
> biology"
> 
> But this last one is something for the people who wrote the code I think.
> 
The person (me) writing the code was (is) reproducing the literature given 
in references, so that those needing one or other can try out possibly 
appropriate functions. Yes, they should be the same or similar, and 
usually are, also here, where the number of observations is small and 
their relative values seem not to exhibit spatial dependence.

> Any comments, would be appreciated... It's uncharted territory for me so..
> 
> Best regards,
> 
> Koen.
> 
> ------- Forwarded message -------
> From: Roger Bivand <[EMAIL PROTECTED]>
> To: Koen Hufkens <[EMAIL PROTECTED]>
> Subject: Re: AI-GEOSTATS: Moran's I
> Date: Sun, 14 Mar 2004 17:43:53 +0100 (CET)
> 
> > On Sun, 14 Mar 2004, Koen Hufkens wrote:
> >
> >> Hi list,
> >>
> >> I have some coding and theoretical questions regarding the Moran's I 
> >> index
> >> and the R + spdep packages.
> >>
> >> - To illustrate the situation of the sampling plot:
> >>
> >> http://users.pandora.be/requested/thesis/a1grid.gif
> >> (coordinates in lat lon projection, point size representative for sample
> >> value)
> >>
> >> - The data distribution:
> >>
> >> http://users.pandora.be/requested/thesis/hista1.gif
> >> (haven't tested for normality yet)
> >
> > First, thanks for including links to your figures, makes helping easier.
> >>
> >>
> >> => My method to get my Moran's I index in R + spdep:
> >>
> >> a1.knn <- knearneigh(a1$coords, k=4, lonlat=TRUE)
> >> #with a1$coords the latlon coords out of a geoR geodata file
> >>
> >> a1.nb <- knn2nb(a1.knn)
> >> # conversion to nb object
> >>
> >> a1.listw <- nb2listw(a1.nb)
> >> # conversion to listw object, requested for moran.test()
> >
> > Note that you have called nb2listw() with the default style, which is
> > row-standardised ("W") - so with 4 neighbours for each object, all thw
> > weights will be 1/4. With style="B", the weights would all be 1. This
> > isn't a full analogy of a rook pattern, because those around the edges
> > will already be queen style or more. Look at plot(a1.nb, a1$coords) to 
> > see
> > this.
> >
> >>
> >> results <- moran.test(a1$data, a1.listw, randomization=FALSE,
> >> alternative="two.sided")
> >>
> >> The results show the following statistics:
> >>
> >> > moran.test(a1$data, a1.listw, randomisation=FALSE,
> >> > alternative="two.sided")
> >>
> >>          Moran's I test under normality
> >>
> >> data:  a1$data
> >> weights: a1.listw
> >>
> >> Moran I statistic standard deviate = 0.2911, p-value = 0.771
> >> alternative hypothesis: two.sided
> >> sample estimates:
> >> Moran I statistic       Expectation          Variance
> >>        -0.03762590       -0.08333333        0.02464896
> >>
> >> With a Moran's I of -0.04 and a p-value of 0.771 I would say this isn't
> >> much of a statistic or not exactly what I expected.
> >>
> > Well, looking at your figure (just eyeballing), there are quite a lot of
> > big/small neighbours as well as small/small and big/big. Did you try
> > looking at a Moran scatterplot to get a feel for what is going on?
> > moran.plot() is the function to try. I think you'll see that all four
> > quadrants of the plot have observations, leading to a very flat and
> > non-significant relationships. Maybe this is because the k-nearest
> > neighbours weights are not reflecting what you want - could you try using
> > dnearneigh() for the appropriate number of km instead, or use edit.nb() 
> > to
> > cut out the possibly disturbing long links?
> >
> >> I would think that since I evaluate ecological/biophysical paramters it
> >> wouldn't be possible to get negative correlations since in vegetations
> >> there is always some kind of autocorrelation involved. It could be just 
> >> a
> >> little but certainly not negative.
> >
> > Note that it is still greater than its expectation (which shows that you
> > only have the 13 observations shown on the figure), but with the variance
> > you have is not significantly different from its expectation. Why did you
> > use normality rather than randomisation (or Monte Carlo)? With so few
> > observations, this may be an issue.
> >
> >>
> >> Strange thing is that I get the same weights in my weights class of my
> >> a1.listw file
> >>
> > Explained above - this was what you asked for. For distance weighted see
> > nbdists(), though your points are regularly spaced.
> >
> >> > a1.listw$weights
> >> [[1]]
> >> [1] 0.25 0.25 0.25 0.25
> >>
> >> [[2]]
> >> [1] 0.25 0.25 0.25 0.25
> >>
> >> [[3]]
> >> [1] 0.25 0.25 0.25 0.25
> >> ...
> >>
> >> I think it has something to do with the k-value in knearneigh(), but 
> >> even
> >> if I change it to 8 (changing from bishops/rooks to queens case?) they
> >> stay the same. Any idea why this is the case?
> >>
> >> So maybe the strange statistics could be a problem of a faulty weights
> >> matrix. So if you have any comments on the code/method used it would be
> >> appreciated.
> >>
> >> Best regards,
> >> Koen.
> >>
> >> --
> >> * To post a message to the list, send it to [EMAIL PROTECTED]
> >> * As a general service to the users, please remember to post a summary 
> >> of any useful responses to your questions.
> >> * To unsubscribe, send an email to [EMAIL PROTECTED] with no subject 
> >> and "unsubscribe ai-geostats" followed by "end" on the next line in the 
> >> message body. DO NOT SEND Subscribe/Unsubscribe requests to the list
> >> * Support to the list is provided at http://www.ai-geostats.org
> >>
> >
> 
> 
> 
> 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Breiviksveien 40, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93
e-mail: [EMAIL PROTECTED]



--
* To post a message to the list, send it to [EMAIL PROTECTED]
* As a general service to the users, please remember to post a summary of any useful 
responses to your questions.
* To unsubscribe, send an email to [EMAIL PROTECTED] with no subject and "unsubscribe 
ai-geostats" followed by "end" on the next line in the message body. DO NOT SEND 
Subscribe/Unsubscribe requests to the list
* Support to the list is provided at http://www.ai-geostats.org

Reply via email to