quadrat.test.ppm {spatstat.model}R Documentation

Dispersion Test for Spatial Point Pattern Based on Quadrat Counts

Description

Performs a test of Complete Spatial Randomness for a given point pattern, based on quadrat counts. Alternatively performs a goodness-of-fit test of a fitted inhomogeneous Poisson model. By default performs chi-squared tests; can also perform Monte Carlo based tests.

Usage


## S3 method for class 'ppm'
quadrat.test(X, nx=5, ny=nx, 
                          alternative=c("two.sided", "regular", "clustered"),
                           method=c("Chisq", "MonteCarlo"),
                           conditional=TRUE, CR=1, df.est=NULL,
                           ..., 
                           xbreaks=NULL, ybreaks=NULL, tess=NULL,
                           nsim=1999)

## S3 method for class 'slrm'
quadrat.test(X, nx=5, ny=nx, 
                           alternative=c("two.sided", "regular", "clustered"),
                           method=c("Chisq", "MonteCarlo"),
                           conditional=TRUE, CR=1, df.est=NULL,
                           ..., 
                           xbreaks=NULL, ybreaks=NULL, tess=NULL,
                           nsim=1999)

Arguments

X

A point pattern (object of class "ppp") to be subjected to the goodness-of-fit test. Alternatively a fitted point process model (object of class "ppm" or "slrm") to be tested. Alternatively X can be the result of applying quadratcount to a point pattern.

nx, ny

Numbers of quadrats in the xx and yy directions. Incompatible with xbreaks and ybreaks.

alternative

Character string (partially matched) specifying the alternative hypothesis.

method

Character string (partially matched) specifying the test to use: either method="Chisq" for the chi-squared test (the default), or method="MonteCarlo" for a Monte Carlo test.

conditional

Logical. Should the Monte Carlo test be conducted conditionally upon the observed number of points of the pattern? Ignored if method="Chisq".

CR

Optional. Numerical value. The exponent for the Cressie-Read test statistic. See Details.

df.est

Optional. Advanced use only. The number of fitted parameters, or the number of degrees of freedom lost by estimation of parameters.

...

Ignored.

xbreaks

Optional. Numeric vector giving the xx coordinates of the boundaries of the quadrats. Incompatible with nx.

ybreaks

Optional. Numeric vector giving the yy coordinates of the boundaries of the quadrats. Incompatible with ny.

tess

Tessellation (object of class "tess" or something acceptable to as.tess) determining the quadrats. Incompatible with nx, ny, xbreaks, ybreaks.

nsim

The number of simulated samples to generate when method="MonteCarlo".

Details

These functions perform χ2\chi^2 tests or Monte Carlo tests of goodness-of-fit for a point process model, based on quadrat counts.

The function quadrat.test is generic, with methods for point patterns (class "ppp"), split point patterns (class "splitppp"), point process models (class "ppm" or "slrm") and quadrat count tables (class "quadratcount").

In all cases, the window of observation is divided into tiles, and the number of data points in each tile is counted, as described in quadratcount. The quadrats are rectangular by default, or may be regions of arbitrary shape specified by the argument tess. The expected number of points in each quadrat is also calculated, as determined by CSR (in the first case) or by the fitted model (in the second case). Then the Pearson X2X^2 statistic

X2=sum((observedexpected)2/expected) X^2 = sum((observed - expected)^2/expected)

is computed.

If method="Chisq" then a χ2\chi^2 test of goodness-of-fit is performed by comparing the test statistic to the χ2\chi^2 distribution with mkm-k degrees of freedom, where m is the number of quadrats and kk is the number of fitted parameters (equal to 1 for quadrat.test.ppp). The default is to compute the two-sided pp-value, so that the test will be declared significant if X2X^2 is either very large or very small. One-sided pp-values can be obtained by specifying the alternative. An important requirement of the χ2\chi^2 test is that the expected counts in each quadrat be greater than 5.

If method="MonteCarlo" then a Monte Carlo test is performed, obviating the need for all expected counts to be at least 5. In the Monte Carlo test, nsim random point patterns are generated from the null hypothesis (either CSR or the fitted point process model). The Pearson X2X^2 statistic is computed as above. The pp-value is determined by comparing the X2X^2 statistic for the observed point pattern, with the values obtained from the simulations. Again the default is to compute the two-sided pp-value.

If conditional is TRUE then the simulated samples are generated from the multinomial distribution with the number of “trials” equal to the number of observed points and the vector of probabilities equal to the expected counts divided by the sum of the expected counts. Otherwise the simulated samples are independent Poisson counts, with means equal to the expected counts.

If the argument CR is given, then instead of the Pearson X2X^2 statistic, the Cressie-Read (1984) power divergence test statistic

2nI=2CR(CR+1)i[(XiEi)CR1] 2nI = \frac{2}{CR(CR+1)} \sum_i \left[ \left( \frac{X_i}{E_i} \right)^CR - 1 \right]

is computed, where XiX_i is the iith observed count and EiE_i is the corresponding expected count. The value CR=1 gives the Pearson X2X^2 statistic; CR=0 gives the likelihood ratio test statistic G2G^2; CR=-1/2 gives the Freeman-Tukey statistic T2T^2; CR=-1 gives the modified likelihood ratio test statistic GM2GM^2; and CR=-2 gives Neyman's modified statistic NM2NM^2. In all cases the asymptotic distribution of this test statistic is the same χ2\chi^2 distribution as above.

The return value is an object of class "htest". Printing the object gives comprehensible output about the outcome of the test.

The return value also belongs to the special class "quadrat.test". Plotting the object will display the quadrats, annotated by their observed and expected counts and the Pearson residuals. See the examples.

Value

An object of class "htest". See chisq.test for explanation.

The return value is also an object of the special class "quadrattest", and there is a plot method for this class. See the examples.

Author(s)

Adrian Baddeley Adrian.Baddeley@curtin.edu.au and Rolf Turner rolfturner@posteo.net

References

Cressie, N. and Read, T.R.C. (1984) Multinomial goodness-of-fit tests. Journal of the Royal Statistical Society, Series B 46, 440–464.

See Also

quadrat.test.splitppp, quadratcount, quadrats, quadratresample, chisq.test, cdf.test.

To test a Poisson point process model against a specific alternative, use anova.ppm.

Examples


  # fitted model: inhomogeneous Poisson
  fitx <- ppm(simdat ~ x)
  quadrat.test(fitx)

  # an equivalent test (results differ due to discretisation effects):
  quadrat.test(simdat, lambda=predict(fitx), df.est=length(coef(fitx)))


[Package spatstat.model version 3.3-1 Index]