funsZcell.tct: Types I-IV Cell-specific Z Tests of Segregation based on...

funsZcell.tctR Documentation

Types I-IV Cell-specific Z Tests of Segregation based on NNCTs

Description

Two functions: Zcell.tct.ct and Zcell.tct.

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 types I-IV TCT, T_{ij}, from their 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 \insertCiteceyhan:jkss-posthoc-2017;textualnnspat.

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 T_{ij} values and also names of the test statistics, estimates, null values, the description of the test, and the data set used.

The null hypothesis for each entry i,j is that the corresponding value T_{ij} is equal to the expected value under RL or CSR, see \insertCiteceyhan:jkss-posthoc-2017;textualnnspat for more detail.

See also (\insertCiteceyhan:jkss-posthoc-2017;textualnnspat) and references therein.

Usage

Zcell.tct.ct(
  ct,
  covN,
  type = "III",
  alternative = c("two.sided", "less", "greater"),
  conf.level = 0.95
)

Zcell.tct(
  dat,
  lab,
  type = "III",
  alternative = c("two.sided", "less", "greater"),
  conf.level = 0.95,
  ...
)

Arguments

ct

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

covN

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

type

The type of the cell-specific test, default="III". Takes on values "I"-"IV" (or equivalently 1-4, 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 T_{ij} values

dat

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

lab

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

...

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

Value

A list with the elements

statistic

The matrix of Types I-IV 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 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, i.e., matrix of the observed T_{ij} values which is the TCT

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 T_{ij} values in the 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.tct.ct only

data.name

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

Author(s)

Elvan Ceyhan

References

\insertAllCited

See Also

Zcell.nnct.ct and Zcell.nnct

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<-"I" #try also "II", "III", and "IV"
Zcell.tct(Y,cls,type)
Zcell.tct(Y,cls,type,alt="g")
Zcell.tct(Y,cls,type,method="max")

Zcell.tct.ct(ct,covN)
Zcell.tct.ct(ct,covN,type)
Zcell.tct.ct(ct,covN,type,alt="g")

#cls as a factor
na<-floor(n/2); nb<-n-na
fcls<-rep(c("a","b"),c(na,nb))
Zcell.tct(Y,cls,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)

Zcell.tct(Y,cls,type)
Zcell.tct.ct(ct,covN,type)


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