funsZcell.nnct | R Documentation |
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 \insertCitedixon:1994,dixon:NNCTEco2002;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,
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 (\insertCitedixon:1994,dixon:NNCTEco2002,ceyhan:eest-2010;textualnnspat).
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,
...
)
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 |
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, |
Elvan Ceyhan
Zcell.nnct.2s
, Zcell.nnct.rs
,
Zcell.nnct.ls
, Zcell.nnct.pval
,
and Zcell.tct
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.