qnn.test: q Nearest Neighbors Test

View source: R/qnn.test.R

qnn.testR Documentation

q Nearest Neighbors Test

Description

qnn.test calculates statistics related to the q nearest neighbors method of comparing case and control point patterns under the random labeling hypothesis.

Usage

qnn.test(x, q = 5, case = 2, nsim = 499, longlat = FALSE)

Arguments

x

A ppp object with marks for the case and control groups.

q

A vector of positive integers indicating the values of q for which to do the q nearest neighbors test.

case

The name of the desired "case" group in levels(x$marks). Alternatively, the position of the name of the "case" group in levels(x$marks). Since we don't know the group names, the default is 2, the second position of levels(x$marks). x$marks is assumed to be a factor. Automatic conversion is attempted if it is not.

nsim

The number of simulations from which to compute p-value.

longlat

A logical value indicating whether Euclidean distance (FALSE) or Great Circle (WGS84 ellipsoid, FALSE) should be used. Default is FALSE, i.e., Euclidean distance.

Value

Returns a list with the following components:

qsum

A dataframe with the number of neighbors (q), test statistic (Tq), and p-value for each test.

consum

A dataframe with the contrasts (contrast), test statistic (Tcon), and p-value (pvalue) for the test of contrasts.

Author(s)

Joshua French

References

Waller, L.A., and Gotway, C.A. (2005). Applied Spatial Statistics for Public Health Data. Hoboken, NJ: Wiley.

Cuzick, J., and Edwards, R. (1990). Spatial clustering for inhomogeneous populations. Journal of the Royal Statistical Society. Series B (Methodological), 73-104.

Alt, K.W., and Vach, W. (1991). The reconstruction of "genetic kinship" in prehistoric burial complexes-problems and statistics. Classification, Data Analysis, and Knowledge Organization, 299-310.

Examples

data(grave)
qnn.test(grave, case = "affected", q = c(3, 5, 7, 9, 11, 13, 15))

smacpod documentation built on Sept. 22, 2023, 1:06 a.m.

Related to qnn.test in smacpod...