funsZcell.spec: Cell-specific Z Tests of Segregation for NNCTs

funsZcell.specR Documentation

Cell-specific Z Tests of Segregation for NNCTs

Description

Two functions: Zcell.spec.ct and Zcell.spec.

All functions are objects of class "cellhtest" but with different arguments (see the parameter list below). Each one performs hypothesis tests of deviations of entries of NNCT or types I-IV TCTs from the expected values under RL or CSR for each entry. The test for each entry i,j is based on the normal approximation of the corresponding T_{ij} value and are due to \insertCitedixon:NNCTEco2002;textualnnspat and \insertCiteceyhan:jkss-posthoc-2017;textualnnspat, respectively.

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

Each function yields a contingency table of the test statistics, p-values for the corresponding alternative, expected values (i.e. null value(s)), lower and upper confidence levels and sample estimates (i.e. observed values) for the N_{ij} or T_{ij} values and also names of the test statistics, estimates, null values and the method and the data set used.

The null hypothesis for each entry i,j is that the corresponding value N_{ij} or T_{ij} is equal to the expected value under RL or CSR.

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

Usage

cell.spec.ct(
  ct,
  covN,
  type,
  alternative = c("two.sided", "less", "greater"),
  conf.level = 0.95
)

cell.spec(
  dat,
  lab,
  type,
  alternative = c("two.sided", "less", "greater"),
  conf.level = 0.95,
  ...
)

Arguments

ct

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

covN

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

type

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

alternative

Type of the alternative hypothesis in the test, one of "two.sided", "less" or "greater".

conf.level

Level of the upper and lower confidence limits, default is 0.95, for the N_{ij} or T_{ij} values

dat

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

lab

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

...

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

Value

A list with the elements

statistic

The matrix of cell-specific test statistics

stat.names

Name of the test statistics

p.value

The matrix of p-values for the hypothesis test for the corresponding alternative

LCL,UCL

Matrix of Lower and Upper Confidence Levels for the N_{ij} or T_{ij} values at the given confidence level conf.level and depends on the type of alternative.

conf.int

The confidence interval for the estimates, it is NULL here, since we provide the UCL and LCL in matrix form.

cnf.lvl

Level of the upper and lower confidence limits of the entries, provided in conf.level.

estimate

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

est.name,est.name2

Names of the estimates, both are same in this function

null.value

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

null.name

Name of the null values

alternative

Type of the alternative hypothesis in the test, one of "two.sided", "less" or "greater"

method

Description of the hypothesis test

ct.name

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

data.name

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

Author(s)

Elvan Ceyhan

References

\insertAllCited

See Also

Zcell.nnct.ct, Zcell.nnct, Zcell.tct.ct and Zcell.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)

type<-"IV" #"dixon" #try also "nnct", "I", "II", "III", and "IV"
cell.spec(Y,cls,type)
cell.spec(Y,cls,type,alt="g")

cell.spec.ct(ct,covN,type)
cell.spec.ct(ct,covN,type="II",alt="g")

cell.spec(Y,cls,type,method="max")

#cls as a factor
na<-floor(n/2); nb<-n-na
fcls<-rep(c("a","b"),c(na,nb))
cell.spec(Y,cls,type="I")

#############
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)

cell.spec(Y,cls,type)
cell.spec.ct(ct,covN,type)


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