[R-sig-Geo] compilepcf VS pcfcross

Quets Jan Jan.Quets at ua.ac.be
Wed Nov 23 16:46:49 CET 2011


Can compilepcf() be used as an alternative to pcfcross()?

I know already (from this list) that the pcf function of a point pattern X can also be calculated with compilepcf()  [when using pairdist(X) among other arguments as an input for compilepcf()].

Is it thus possible to use (for instance compilepcf) to calculate pcfcross of a multi-(two)-type point pattern? e.g. by using a matrix analogue to pairdist(X) as an input?

The reason is that I want to subtract disc radii from interpoint-distances (the points are centers of discs) of the point (or disc) pattern.

Thank you,
Jan
________________________________________
Van: Adrian.Baddeley at csiro.au [Adrian.Baddeley at csiro.au]
Verzonden: donderdag 17 november 2011 5:10
Aan: Quets Jan; r-sig-geo at r-project.org
CC: r.turner at auckland.ac.nz; Adrian.Baddeley at csiro.au
Onderwerp: RE: compilepcf

Jan Quets <Jan.Quets at ua.ac.be> heeft gevraagd:

   > How to make pcf and compilepcf do the same job

This is a query about the package 'spatstat'.

It is a query about an _undocumented, internal_ feature of 'spatstat'. There are no guarantees that this feature will continue.

compilepcf() has an argument 'denom' which is the denominator for the pair correlation estimator. Under normal circumstances with a 2D point pattern, 'denom' should be an estimate of lambda^2 * A where lambda is the point process intensity and A is the area of the window containing the data. So take denom = npoints(X)^2/area.owin(as.owin(X)).

compilepcf() has an argument 'weights' which contains the edge correction weights for the pairwise distances. To get agreement between pcf.ppp() and compilepcf() you would also have to insert the same edge correction weights. In pcf.ppp() these are computed by the (undocumented!) functions edge.Trans and edge.Ripley. So set weights=edge.Trans(X) for example.

compilepcf() has arguments "..." which are passed to density.default to control the smoothing. In pcf.ppp() the smoothing parameter is (by default) selected by Stoyan's rule of thumb but can be overridden by the argument 'bw'. To get agreement between pcf.ppp() and compilepcf() you would have to specify the same value of 'bw' to both.

compilepcf() uses the Gaussian smoothing kernel by default, while pcf.ppp() uses the Epanechnikov kernel by default. So you'd have to specify kernel="gaussian" in the call to pcf.ppp.

Finally you need to set 'endcorrect=FALSE' in compilepcf() because .... never mind.

Example:

bw <- bw.stoyan(redwood)
f1 <- pcf(redwood, kernel="gaussian", bw=bw)
r <- with(f1, r)
denom <- npoints(redwood)^2/area.owin(as.owin(redwood))
f2 <- compilepcf(D, r=r,
                 denom=denom, weights=edge.Trans(redwood), bw=bw,
                 endcorrect=FALSE)
f2 <- with(f2, ./(2 * pi * r))
plot(f1, trans ~ r)
plot(f2, add=TRUE)



============
Prof Adrian Baddeley (UWA/CSIRO)
CSIRO Mathematics, Informatics & Statistics
Leeuwin Centre, 65 Brockway Road, Floreat WA 6014, Australia
Tel: 08 9333 6177 | Fax: 08 9333 6121 | Mob: 0410 447 821
Skype: adrian.baddeley



More information about the R-sig-Geo mailing list