funsZcell.tct {nnspat} | R 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 Ceyhan (2017).
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 Ceyhan (2017)
for more detail.
See also (Ceyhan (2017)) 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 |
covN |
The |
type |
The type of the cell-specific test,
default= |
alternative |
Type of the alternative hypothesis in the test,
one of |
conf.level |
Level of the upper and lower confidence limits,
default is |
dat |
The data set in one or higher dimensions,
each row corresponds to a data point,
used in |
lab |
The |
... |
are for further arguments,
such as |
Value
A list
with the elements
statistic |
The |
stat.names |
Name of the test statistics |
p.value |
The |
LCL , UCL |
Matrix of lower and upper confidence levels for
the |
conf.int |
The confidence interval for the estimates,
it is |
cnf.lvl |
Level of the upper and
lower confidence limits of the entries,
provided in |
estimate |
Estimates of the parameters,
i.e., matrix of the observed |
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
|
null.name |
Name of the null values |
alternative |
Type of the alternative hypothesis in the test,
one of |
method |
Description of the hypothesis test |
ct.name |
Name of the contingency table, |
data.name |
Name of the data set, |
Author(s)
Elvan Ceyhan
References
Ceyhan E (2017). “Cell-Specific and Post-hoc Spatial Clustering Tests Based on Nearest Neighbor Contingency Tables.” Journal of the Korean Statistical Society, 46(2), 219-245.
See Also
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)