funs.base.class.spec {nnspat}R Documentation

Base Class-specific Chi-square Tests based on NNCTs

Description

Two functions: base.class.spec.ct and base.class.spec.

Both functions are objects of class "classhtest" but with different arguments (see the parameter list below). Each one performs class specific segregation tests due to Dixon for k \ge 2 classes. That is, each one performs hypothesis tests of deviations of entries in each row of NNCT from the expected values under RL or CSR for each row. Recall that row labels in the NNCT are base class labels. The test for each row i is based on the chi-squared approximation of the corresponding quadratic form and are due to Dixon (2002).

Each function yields the test statistic, p-value and df for each base class i, description of the alternative with the corresponding null values (i.e., expected values) for the row i, estimates for the entries in row i for i=1,\ldots,k. The functions also provide names of the test statistics, the description of the test and the data set used.

The null hypothesis for each row is that the corresponding N_{ij} entries in row i are equal to their expected values under RL or CSR.

See also (Dixon (2002); Ceyhan (2009)) and the references therein.

Usage

base.class.spec.ct(ct, covN)

base.class.spec(dat, lab, ...)

Arguments

ct

A nearest neighbor contingency table, used in base.class.spec.ct only

covN

The k^2 \times k^2 covariance matrix of row-wise vectorized entries of NNCT, ct; used in base.class.spec.ct only.

dat

The data set in one or higher dimensions, each row corresponds to a data point, used in base.class.spec only

lab

The vector of class labels (numerical or categorical), used in base.class.spec only

...

are for further arguments, such as method and p, passed to the dist function. used in base.class.spec only

Value

A list with the elements

type

Type of the class-specific test, which is "base" for this function

statistic

The vector of base class-specific test statistics

stat.names

Name of the test statistics

p.value

The vector of p-values for the hypothesis test

df

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

estimate

Estimates of the parameters, NNCT, i.e., matrix of the observed N_{ij} values which is the NNCT.

null.value

Matrix of hypothesized null values for the parameters which are expected values of the N_{ij} values in the NNCT.

null.name

Name of the null values

method

Description of the hypothesis test

ct.name

Name of the contingency table, ct, returned by base.class.spec.ct only

data.name

Name of the data set, dat, returned by base.class.spec only

Author(s)

Elvan Ceyhan

References

Ceyhan E (2009). “Class-Specific Tests of Segregation Based on Nearest Neighbor Contingency Tables.” Statistica Neerlandica, 63(2), 149-182.

Dixon PM (2002). “Nearest-neighbor contingency table analysis of spatial segregation for several species.” Ecoscience, 9(2), 142-151.

See Also

NN.class.spec.ct, NN.class.spec, class.spec.ct and class.spec

Examples

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

W<-Wmat(ipd)
Qv<-Qvec(W)$q
Rv<-Rval(W)
varN<-var.nnct(ct,Qv,Rv)
covN<-cov.nnct(ct,varN,Qv,Rv)

base.class.spec(Y,cls)
base.class.spec.ct(ct,covN)
base.class.spec(Y,cls,method="max")

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

base.class.spec(Y,fcls)
base.class.spec.ct(ct,covN)

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

W<-Wmat(ipd)
Qv<-Qvec(W)$q
Rv<-Rval(W)
varN<-var.nnct(ct,Qv,Rv)
covN<-cov.nnct(ct,varN,Qv,Rv)

base.class.spec(Y,cls)
base.class.spec.ct(ct,covN)


[Package nnspat version 0.1.2 Index]