funs.overall.nnct: Dixon's Overall Test of Segregation for NNCT

funs.overall.nnctR Documentation

Dixon's Overall Test of Segregation for NNCT

Description

Two functions: overall.nnct.ct and overall.nnct.

Both functions are objects of class "Chisqtest" but with different arguments (see the parameter list below). Each one performs hypothesis tests of deviations of cell counts from the expected values under RL or CSR for all cells (i.e., entries) combined in the NNCT. That is, each test is Dixon's overall test of segregation based on NNCTs for k \ge 2 classes. This overall test is based on the chi-squared approximation of the corresponding quadratic form and are due to \insertCitedixon:1994,dixon:NNCTEco2002;textualnnspat. Both functions exclude the last column of the NNCT (in fact any column will do and last column is chosen without loss of generality), to avoid ill-conditioning of the covariance matrix (for its inversion in the quadratic form).

Each function yields the test statistic, p-value and df which is k(k-1), description of the alternative with the corresponding null values (i.e., expected values) of NNCT entries, sample estimates (i.e., observed values) of the entries in NNCT. 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 N_{ij} entries are equal to their expected values under RL or CSR.

See also (\insertCitedixon:1994,dixon:NNCTEco2002,ceyhan:eest-2010,ceyhan:jkss-posthoc-2017;textualnnspat) and the references therein.

Usage

overall.nnct.ct(ct, covN)

overall.nnct(dat, lab, ...)

Arguments

ct

A nearest neighbor contingency table, used in overall.nnct.ct only

covN

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

dat

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

lab

The vector of class labels (numerical or categorical), used in overall.nnct only

...

are for further arguments, such as method and p, passed to the dist function. used in overall.nnct only

Value

A list with the elements

statistic

The overall chi-squared statistic

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) for this function.

estimate

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

est.name, est.name2

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

null.value

Matrix of hypothesized null values for the parameters which are expected values of the 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 overall.nnct.ct only

data.name

Name of the data set, dat, returned by overall.nnct only

Author(s)

Elvan Ceyhan

References

\insertAllCited

See Also

overall.seg.ct, overall.seg, overall.tct.ct and overall.tct

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) #default is byrow

overall.nnct(Y,cls)
overall.nnct.ct(ct,covN)

overall.nnct(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)

overall.nnct(Y,fcls)
overall.nnct.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)

overall.nnct(Y,cls)
overall.nnct.ct(ct,covN)


nnspat documentation built on May 29, 2024, 10:03 a.m.