funsZnnself.sum {nnspat} | R Documentation |
Cumulative Species Correspondence Test with Normal Approximation
Description
Two functions: Znnself.sum.ct
and Znnself.sum
.
Both functions are objects of class "htest"
but with different arguments (see the parameter list below).
Each one performs hypothesis tests of equality of the expected value of the sum of the self entries (i.e.
first column) in a species correspondence contingency table (SCCT) or the expected values of the sum of the
diagonal entries N_{ii}
in an NNCT to the one under RL or CSR.
That is, each performs a cumulative species correspondence test which is appropriate
(i.e., have the appropriate asymptotic sampling distribution)
for completely mapped data.
(See Ceyhan (2018) for more detail).
Each test is based on the normal approximation of the sum of the self entries (i.e., first column) in a
species correspondence contingency table (SCCT) or the sum of the diagonal entries N_{ii}
in an NNCT and
are due to (Ceyhan 2018).
Each function yields the test statistic, p
-value for the
corresponding alternative, the confidence interval, sample estimate (i.e., observed value) and null (i.e., expected) value for the
sum of the self entries (i.e., first column) in a
species correspondence contingency table (SCCT) or the sum of the diagonal entries N_{ii}
in an NNCT,
and method and name of the data set used.
The null hypothesis is that all
E[S] = \sum_{i=1}^k n_i(n_i - 1)/(n - 1)
where S
is the sum of the self column
in the SCCT, n_i
is the size of class i
and n
is the data size.
The Znnself.sum
functions (i.e., Znnself.sum.ct
and Znnself.sum
) are different from the Znnself
functions (i.e., Znnself.ct
and Znnself
), and from the Znnref
functions
(i.e., Znnref.ct
and Znnref
) and also from Zself.ref
functions (i.e., Zself.ref.ct
and Zself.ref
).
Znnself.sum
functions are testing the cumulative species correspondence using the sum of the self column (i.e.,
the first column) in the SCCT, while Znnself
functions are testing the self reflexivity at a class-specific level (i.e., for each class) using the
first column in the SCCT, while Zself.ref
functions are for testing the self reflexivity for the entire data set
using entry (1,1)
in RCT, and Znnref
functions are for testing the self reflexivity and mixed non-reflexivity
using the diagonal entries in the RCT.
Usage
Znnself.sum.ct(
ct,
covSC,
nnct = FALSE,
alternative = c("two.sided", "less", "greater"),
conf.level = 0.95
)
Znnself.sum(
dat,
lab,
alternative = c("two.sided", "less", "greater"),
conf.level = 0.95,
...
)
Arguments
ct |
The NNCT or SCCT, used in |
covSC |
The covariance matrix for the self entries (i.e., first column) in the SCCT
or the diagonal entries in the NNCT, used in |
nnct |
A logical parameter (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 |
p.value |
The |
conf.int |
Confidence interval for the sum of the self entries (i.e., first column) in a
species correspondence contingency table (SCCT) or the sum of the diagonal entries |
estimate |
Estimate of the parameter, i.e., the observed sum of the self entries (i.e., first column)
in a species correspondence contingency table (SCCT) or the sum of the diagonal entries |
null.value |
Hypothesized null value for the sum of the self entries (i.e., first column) in a
species correspondence contingency table (SCCT) or the sum of the diagonal entries |
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 (2018). “A contingency table approach based on nearest neighbor relations for testing self and mixed correspondence.” SORT-Statistics and Operations Research Transactions, 42(2), 125-158.
See Also
Znnself.ct
, Znnself
, Znnref.ct
, Znnref
,
Zself.ref.ct
and Zself.ref
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<-scct(ipd,cls)
ct
W<-Wmat(ipd)
Qv<-Qvec(W)$q
Rv<-Rval(W)
vsq<-varNii.ct(ct,Qv,Rv)
cv<-covNii.ct(ct,vsq,Qv,Rv)
Znnself.sum(Y,cls)
Znnself.sum.ct(ct,cv)
Znnself.sum.ct(ct,cv,alt="g")
Znnself.sum(Y,cls,method="max")
ct<-nnct(ipd,cls)
Znnself.sum.ct(ct,cv,nnct = TRUE)
#############
n<-40
Y<-matrix(runif(3*n),ncol=3)
cls<-sample(1:4,n,replace = TRUE) #or try cls<-rep(1:2,c(10,10))
ipd<-ipd.mat(Y)
ct<-scct(ipd,cls)
W<-Wmat(ipd)
Qv<-Qvec(W)$q
Rv<-Rval(W)
vsq<-varNii.ct(ct,Qv,Rv)
cv<-covNii.ct(ct,vsq,Qv,Rv)
Znnself.sum(Y,cls)
Znnself.sum.ct(ct,cv)
Znnself.sum.ct(ct,cv,alt="g")
ct<-nnct(ipd,cls)
Znnself.sum.ct(ct,cv,nnct = TRUE)
Znnself.sum(Y,cls,alt="g")