funsZcell.nnct {nnspat} | R Documentation |
Dixon's Cell-specific Z Tests of Segregation for NNCT
Description
Two functions: Zcell.nnct.ct
and Zcell.nnct
.
Both functions are objects of class "cellhtest"
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 each cell (i.e., entry) in the NNCT.
The test for each cell i,j
is based on
the normal approximation of the corresponding cell count, N_{ij}
and are due to Dixon (1994, 2002).
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,
sample estimates (i.e., observed values)
for the cell counts 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 cell i,j
is that
the corresponding cell count is equal to the expected value
under RL or CSR, that is E[N_{ii}] = n_i(n_i - 1)/(n - 1)
and E[N_{ij}] = n_i n_j/(n - 1)
where n_i
is the size of
class i
and n
is the size of the data set.
See also (Dixon (1994, 2002); Ceyhan (2010)).
Usage
Zcell.nnct.ct(
ct,
varN,
alternative = c("two.sided", "less", "greater"),
conf.level = 0.95
)
Zcell.nnct(
dat,
lab,
alternative = c("two.sided", "less", "greater"),
conf.level = 0.95,
...
)
Arguments
ct |
A nearest neighbor contingency table,
used in |
varN |
The variance matrix for cell counts in the NNCT, |
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 cell counts at the given confidence
level |
conf.int |
The confidence interval for the estimates,
it is |
cnf.lvl |
Level of the upper and
lower confidence limits of the cell counts,
provided in |
estimate |
Estimates of the parameters, i.e., matrix of the observed cell counts which is the NNCT |
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 cell counts. |
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 (2010).
“On the use of nearest neighbor contingency tables for testing spatial segregation.”
Environmental and Ecological Statistics, 17(3), 247-282.
Dixon PM (1994).
“Testing spatial segregation using a nearest-neighbor contingency table.”
Ecology, 75(7), 1940-1948.
Dixon PM (2002).
“Nearest-neighbor contingency table analysis of spatial segregation for several species.”
Ecoscience, 9(2), 142-151.
See Also
Zcell.nnct.2s
, Zcell.nnct.rs
,
Zcell.nnct.ls
, Zcell.nnct.pval
,
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)
ct
W<-Wmat(ipd)
Qv<-Qvec(W)$q
Rv<-Rval(W)
varN<-var.nnct(ct,Qv,Rv)
varN
Zcell.nnct(Y,cls)
Zcell.nnct(Y,cls,alt="g")
Zcell.nnct.ct(ct,varN)
Zcell.nnct.ct(ct,varN,alt="g")
Zcell.nnct(Y,cls,method="max")
#cls as a factor
na<-floor(n/2); nb<-n-na
fcls<-rep(c("a","b"),c(na,nb))
Zcell.nnct(Y,cls)
#############
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)
Zcell.nnct(Y,cls)
Zcell.nnct.ct(ct,varN)