Skip to content
Prev 27472 / 29559 Next

[FORGED] Simple Ripley's CRS test for market point patters

Thanks to Marcelino for chiming in on this.  I should have responded 
earlier, but was "busy on a personal matter".

To add to what Marcelino said:

(1) Your post in HTML was horribly garbled and a struggle to read. 
*PLEASE* set your email client so that it does *NOT* post in HTML when 
posting to this list.

(2) A very minor point:  Your construction of "syn.ppp" was 
unnecessarily complicated and convoluted.  You could simply do:

     syn.ppp  <- ppp(x=xp,y=yp,window=W,marks=area)

(3) You appear to be confused as to the distinction between "marks" and 
"covariates".   These are superficially similar but conceptually 
completely different.  What you are dealing with is *marks*.  There are
no covariates involved.  See [1], p. 147.

(4) Your calls to envelope() are mal-formed; the expression "area >= 0" 
and "area < 25" will be taken as the values of "nrank" and ... who knows 
what?  Did you not notice the warning messages you got about there being 
something wrong with "nrank"?

You are being hopelessly na?ve in expecting envelope() to interpret 
"area >= 0" and "area < 25" in the way you want it to interpret them.
The spatstat package does not read minds.

Marcelino has shown you how to make a proper call.

(5) Since you are interested in categorising "area" into groups, rather 
than being interested in the *numerical* value of area, you should do 
the categorisation explicitly:

acat <- cut(area,breaks=c(-Inf,25,55,Inf),right=FALSE,
             labels=c("s","m","l")
# right=FALSE since you want "area < 25" rather than
# "area <= 25" --- although this makes no difference for the
# area values actually used.

syn.ppp <- ppp(x=xp,y=yp,marks=acat)

(6) It is not clear to me what your "research question" is.  Do you want 
to test whether the intensities differ between the area categories? 
Unless my thinking is hopelessly confused, this has nothing to do with 
(or at least does not require the use of) the envelope() function:

f1 <- ppm(syn.ppp) # Same (constant) intensity for each area category.
f2 <- ppm(syn.ppp ~ marks) # Allows different (constant) intensity
                            # for each area category.
anova(f1,f2,test="Chi")

This test (not surprisingly) rejects the hypothesis that the intensities 
are the same; p-value = 0.0020.

If this is not the hypothesis that you are interested in, please clarify 
your thinking and your question, and get back to us.

cheers,

Rolf Turner