berman.test(...)
"berman.test"(X, covariate, which = c("Z1", "Z2"), alternative = c("two.sided", "less", "greater"), ...)
"berman.test"(model, covariate, which = c("Z1", "Z2"), alternative = c("two.sided", "less", "greater"), ...)
"berman.test"(X, covariate, which = c("Z1", "Z2"), alternative = c("two.sided", "less", "greater"), ...)
"berman.test"(model, covariate, which = c("Z1", "Z2"), alternative = c("two.sided", "less", "greater"), ...)
"ppp"
or "lpp"
).
"ppm"
or
"lppm"
).
"im"
)
or a function.
dimyx
and eps
passed to
as.mask
)
or other undocumented features.
"htest"
(hypothesis test)
and also of class "bermantest"
,
containing the results of the test. The return value can be
plotted (by plot.bermantest
) or printed
to give an informative summary of the test.
The function berman.test
is generic, with methods for
point patterns ("ppp"
or "lpp"
)
and point process models ("ppm"
or "lppm"
).
X
is a point pattern dataset (object of class
"ppp"
or "lpp"
), then
berman.test(X, ...)
performs a goodness-of-fit test of the
uniform Poisson point process (Complete Spatial Randomness, CSR)
for this dataset.
model
is a fitted point process model
(object of class "ppm"
or "lppm"
)
then berman.test(model, ...)
performs
a test of goodness-of-fit for this fitted model. In this case,
model
should be a Poisson point process.
The test is performed by comparing the observed distribution
of the values of a spatial covariate at the data points,
and the predicted distribution of the same covariate under the model.
Thus, you must nominate a spatial covariate for this test.
The argument covariate
should be either a function(x,y)
or a pixel image (object of class "im"
containing the values
of a spatial function.
If covariate
is an image, it should have numeric values,
and its domain should cover the observation window of the
model
. If covariate
is a function, it should expect
two arguments x
and y
which are vectors of coordinates,
and it should return a numeric vector of the same length
as x
and y
.
First the original data point pattern is extracted from model
.
The values of the covariate
at these data points are
collected.
Next the values of the covariate
at all locations in the
observation window are evaluated. The point process intensity
of the fitted model is also evaluated at all locations in the window.
which="Z1"
,
the test statistic $Z[1]$ is computed as follows.
The sum $S$ of the covariate values at all data
points is evaluated. The predicted mean $\mu$ and variance
$\sigma^2$ of $S$ are computed
from the values of the covariate at all locations in the window.
Then we compute $Z[1]=(S-\mu)/\sigma$.
Closely-related tests were proposed independently
by Waller et al (1993) and Lawson (1993)
so this test is often termed the
Lawson-Waller test in epidemiological literature.
which="Z2"
,
the test statistic $Z[2]$ is computed as follows.
The values of the covariate
at all locations in the
observation window, weighted by the point process intensity,
are compiled into a cumulative distribution function $F$.
The probability integral transformation is then applied:
the values of the covariate
at the original data points
are transformed by the predicted cumulative distribution function
$F$ into numbers between 0 and 1. If the model is correct,
these numbers are i.i.d. uniform random numbers.
The standardised sample mean of these numbers is the
statistic $Z[2]$.
In both cases the null distribution of the test statistic is the standard normal distribution, approximately.
The return value is an object of class "htest"
containing the
results of the hypothesis test. The print method for this class
gives an informative summary of the test outcome.
Lawson, A.B. (1993) On the analysis of mortality events around a prespecified fixed point. Journal of the Royal Statistical Society, Series A 156 (3) 363--377.
Waller, L., Turnbull, B., Clark, L.C. and Nasca, P. (1992) Chronic Disease Surveillance and testing of clustering of disease and exposure: Application to leukaemia incidence and TCE-contaminated dumpsites in upstate New York. Environmetrics 3, 281--300.
cdf.test
,
quadrat.test
,
ppm
# Berman's data
data(copper)
X <- copper$SouthPoints
L <- copper$SouthLines
D <- distmap(L, eps=1)
# test of CSR
berman.test(X, D)
berman.test(X, D, "Z2")
Run the code above in your browser using DataLab