Xsq.nnsym {nnspat}R Documentation

Overall NN Symmetry Test with Chi-square Approximation

Description

An object of class "Chisqtest" performing the hypothesis test of equality of the expected values of the off-diagonal cell counts (i.e., entries) under RL or CSR in the NNCT for k \ge 2 classes. That is, the test performs Dixon's or Pielou's (first type of) overall NN symmetry test which is appropriate (i.e., have the appropriate asymptotic sampling distribution) for completely mapped data or for sparsely sample data, respectively. (See Pielou (1961); Dixon (1994); Ceyhan (2014) for more detail).

The type="dixon" refers to Dixon's overall NN symmetry test and type="pielou" refers to Pielou's first type of overall NN symmetry test. The symmetry test is based on the chi-squared approximation of the corresponding quadratic form and type="dixon" yields an extension of Dixon's NN symmetry test, which is extended by Ceyhan (2014) and type="pielou" yields Pielou's overall NN symmetry test.

The function yields the test statistic, p-value and df which is k(k-1)/2, description of the alternative with the corresponding null values (i.e., expected values) of differences of the off-diagonal entries,(which is 0 for this function) and also the sample estimates (i.e., observed values) of absolute differences of the off-diagonal entries of NNCT (in the upper-triangular form). The functions also provide names of the test statistics, the description of the test and the data set used.

The null hypothesis is that all E(N_{ij})=E(N_{ji}) for i \ne j in the k \times k NNCT (i.e., symmetry in the mixed NN structure) for k \ge 2. In the output, if if type="pielou", the test statistic, p-value and the df are valid only for (properly) sparsely sampled data.

See also (Pielou (1961); Dixon (1994); Ceyhan (2014)) and the references therein.

Usage

Xsq.nnsym(dat, lab, type = "dixon", ...)

Arguments

dat

The data set in one or higher dimensions, each row corresponds to a data point.

lab

The vector of class labels (numerical or categorical)

type

The type of the overall NN symmetry test with default="dixon". Takes on values "dixon" and "pielou" for Dixon's and Pielou's (first type) overall NN symmetry test

...

are for further arguments, such as method and p, passed to the dist function

Value

A list with the elements

statistic

The chi-squared test statistic for Dixon's or Pielou's (first type of) overall NN symmetry test

stat.names

Name of the test statistic

p.value

The p-value for the hypothesis test

df

Degrees of freedom for the chi-squared test, which is k(k-1)/2 for this function.

estimate

Estimates, i.e., absolute differences of the off-diagonal entries of NNCT (in the upper-triangular form).

est.name, est.name2

Names of the estimates, former is a shorter description of the estimates than the latter.

null.value

Hypothesized null values for the differences between the expected values of the off-diagonal entries, which is 0 for this function.

method

Description of the hypothesis test

data.name

Name of the data set, dat, or name of the contingency table, ct

Author(s)

Elvan Ceyhan

References

Ceyhan E (2014). “Testing Spatial Symmetry Using Contingency Tables Based on Nearest Neighbor Relations.” The Scientific World Journal, Volume 2014, Article ID 698296.

Dixon PM (1994). “Testing spatial segregation using a nearest-neighbor contingency table.” Ecology, 75(7), 1940-1948.

Pielou EC (1961). “Segregation and symmetry in two-species populations as studied by nearest-neighbor relationships.” Journal of Ecology, 49(2), 255-269.

See Also

Znnsym.ss, Znnsym.dx and Znnsym2cl

Examples

n<-20  #or try sample(1:20,1)
Y<-matrix(runif(3*n),ncol=3)
cls<-sample(1:2,n,replace = TRUE)  #or try cls<-rep(1:2,c(10,10))

Xsq.nnsym(Y,cls)
Xsq.nnsym(Y,cls,method="max")
Xsq.nnsym(Y,cls,type="pielou")

#cls as a factor
na<-floor(n/2); nb<-n-na
fcls<-rep(c("a","b"),c(na,nb))

Xsq.nnsym(Y,fcls)
Xsq.nnsym(Y,fcls,type="pielou")

#############
n<-40
Y<-matrix(runif(3*n),ncol=3)
cls<-sample(1:4,n,replace = TRUE)  #or try cls<-rep(1:2,c(10,10))

Xsq.nnsym(Y,cls)
Xsq.nnsym(Y,cls,type="pielou")


[Package nnspat version 0.1.2 Index]