funs.overall.seg: Overall Segregation Tests for NNCTs

funs.overall.segR Documentation

Overall Segregation Tests for NNCTs

Description

Two functions: overall.seg.ct and overall.seg.

All 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 or TCT. That is, each test is one of Dixon's or Types I-IV overall test of segregation based on NNCTs or TCTs for k ≥ 2 classes. Each overall test is based on the chi-squared approximation of the corresponding quadratic form and are due to \insertCitedixon:1994,dixon:NNCTEco2002;textualnnspat and to \insertCiteceyhan:SJScorrected2010,ceyhan:jkss-posthoc-2017;textualnnspat, respectively. All functions exclude some row and/or column of the TCT, to avoid ill-conditioning of the covariance matrix of the NNCT (for its inversion in the quadratic form), see the relevant functions under See also section below.

The type="dixon" or "nnct" refers to Dixon's overall test of segregation, and type="I"-"IV" refers to types I-IV overall tests, respectively.

Each function yields the test statistic, p-value and df which is k(k-1) for type II and Dixon's test and (k-1)^2 for the other types, description of the alternative with the corresponding null values (i.e. expected values) of TCT entries, sample estimates (i.e. observed values) of the entries in TCT. The functions also provide names of the test statistics, the method and the data set used.

The null hypothesis is that all N_{ij} or T_{ij} entries for the specified type are equal to their expected values under RL or CSR, respectively.

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

Usage

overall.seg.ct(ct, covN, type)

overall.seg(dat, lab, type, ...)

Arguments

ct

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

covN

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

type

The type of the overall test with no default. Takes on values "dixon" or "nnct" for Dixon's overall test and "I"-"IV" for types I-IV cell-specific test (or equivalently 1-6, respectively).

dat

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

lab

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

...

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

Value

A list with the elements

statistic

The overall chi-squared statistic for the specified type

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 type II and Dixon's tests and (k-1)^2 for others.

estimate

Estimates of the parameters, NNCT for Dixon's test and type I-IV TCT for others.

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 or T_{ij} values in the TCT.

null.name

Name of the null values

method

Description of the hypothesis test

ct.name

Name of the contingency table, ct, returned by overall.seg.ct only

data.name

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

Author(s)

Elvan Ceyhan

References

\insertAllCited

See Also

overall.nnct.ct, overall.nnct, 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

type<-"dixon" #try also "nnct", I", "II", "III", and "IV"
overall.seg(Y,cls,type)
overall.seg(Y,cls,type,method="max")
overall.seg(Y,cls,type="I")

overall.seg.ct(ct,covN,type)
overall.seg.ct(ct,covN,type="I")

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

overall.seg(Y,fcls,type="I")
overall.seg.ct(ct,covN,type)

#############
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.seg(Y,cls,type="I")
overall.seg.ct(ct,covN,type)


nnspat documentation built on Aug. 30, 2022, 9:06 a.m.