Learn R Programming

dbmss (version 1.2.4)

GoFtest: Goodness of Fit test between a distance based measure of spatial structure and simulations of its null hypothesis

Description

Calculates the risk to reject the null hypothesis erroneously, based on the distribution of the simulations.

Usage

GoFtest(ActualValues, SimulatedValues, r)

Arguments

ActualValues
A vector containing the values of a function (K, M,...) at several distances.
SimulatedValues
A matrix containing the simulated values (each line is a simulation, each column a value of a function(R).
r
A vector of distances.

Value

  • A p-value.

Details

This test was introduced by Diggle(1983) and extensively developped by Loosmore and Ford (2006) for K, and applied to M by Marcon et al. (2012).

References

Diggle, P. J. (1983). Statistical analysis of spatial point patterns. Academic Press, London. 148 p. Loosmore, N. B. and Ford, E. D. (2006). Statistical inference using the G or K point pattern spatial statistics. Ecology 87(8): 1925-1931. Marcon, E., F. Puech, et al. (2012). Characterizing the relative spatial structure of point patterns. International Journal of Ecology 2012(Article ID 619281): 11.

See Also

Ktest

Examples

Run this code
# Simulate a Matern (Neyman Scott) point pattern
nclust <- function(x0, y0, radius, n) {
  return(runifdisc(n, radius, centre=c(x0, y0)))
}
X <- rNeymanScott(20, 0.2, nclust, radius=0.3, n=10)
plot(X)

# Calculate K
r <- seq(0, 0.3, 0.01)
ActualValues.X <- K.r(X, r)

# Calculate confidence envelope (should be 1000 simulations, reduced to 50 to save time)
NumberOfSimulations <- 50
Alpha <- .10
LocalEnvelope.X <- KEnvelope(NumberOfSimulations, Alpha, X, r)

# Plot
PlotResults(r, DivideByPiR2(ActualValues.X, r), lapply(LocalEnvelope.X, DivideByPiR2, r), 
    ylab="K / (pi R^2)", ReferenceValue=1)

# GoF test. Power is correct if enough simulations are run (say >1000).
paste("p-value =", GoFtest(ActualValues.X, LocalEnvelope.X$Simulations, r))

Run the code above in your browser using DataLab