funs.overall.tct {nnspat} | R Documentation |
Types I-IV Overall Tests of Segregation for NNCT
Description
Two functions: overall.tct.ct
and overall.tct
.
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 TCT.
That is, each test is one of Types I-IV overall test of segregation based on TCTs for k \ge 2
classes.
This overall test is based on the chi-squared approximation of the corresponding quadratic form
and are due to Ceyhan (2010, 2017).
Both 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).
In particular, type-II removes the last column, and all other types remove the last row and column.
Each function yields the test statistic, p
-value and df
which is k(k-1)
for type II 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 description of the test and the data set used.
The null hypothesis is that all Tij entries for the specified type are equal to their expected values under RL or CSR.
See also (Ceyhan (2010, 2017)) and the references therein.
Usage
overall.tct.ct(ct, covN, type = "III")
overall.tct(dat, lab, type = "III", ...)
Arguments
ct |
A nearest neighbor contingency table, used in |
covN |
The |
type |
The type of the overall segregation test, default= |
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 overall chi-squared statistic for the specified type |
stat.names |
Name of the test statistic |
p.value |
The |
df |
Degrees of freedom for the chi-squared test, which is |
estimate |
Estimates of the parameters, TCT, i.e., matrix of the observed |
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 |
null.name |
Name of the null values |
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 (2010).
“New Tests of Spatial Segregation Based on Nearest Neighbor Contingency Tables.”
Scandinavian Journal of Statistics, 37(1), 147-165.
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
overall.seg.ct
, overall.seg
, overall.nnct.ct
and overall.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) #default is byrow
overall.tct(Y,cls)
overall.tct(Y,cls,type="I")
overall.tct(Y,cls,type="II")
overall.tct(Y,cls,type="III")
overall.tct(Y,cls,type="IV")
overall.tct(Y,cls,method="max")
overall.tct.ct(ct,covN)
overall.tct.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.tct(Y,fcls)
overall.tct.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.tct(Y,cls)
overall.tct.ct(ct,covN)