funsZnnself.sum: Cumulative Species Correspondence Test with Normal...

funsZnnself.sumR 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 \insertCiteceyhan:NNCorrespond2018;textualnnspat 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 \insertCiteceyhan:NNCorrespond2018nnspat.

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] = ∑_{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 Znnself.sum.ct only

covSC

The covariance matrix for the self entries (i.e. first column) in the SCCT or the diagonal entries in the NNCT, used in Znnself.sum.ct only. Usually output of the functions covNii.ct or covNii.

nnct

A logical parameter (default=FALSE). If TRUE, x is taken to be the k \times k NNCT, and if FALSE, x is taken to be the IPD matrix, used in Znnself.sum.ct only

alternative

Type of the alternative hypothesis in the test, one of "two.sided", "less" or "greater".

conf.level

Level of the upper and lower confidence limits, default is 0.95, for the self entries in the SCCT or diagonal entries in the NNCT

dat

The data set in one or higher dimensions, each row corresponds to a data point, used in Znnself.sum only

lab

The vector of class labels (numerical or categorical), used in Znnself.sum only

...

are for further arguments, such as method and p, passed to the dist function. used in Znnself.sum only

Value

A list with the elements

statistic

The Z test statistic for the overall species correspondence test

p.value

The p-value for the hypothesis test for the corresponding alternative

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 N_{ii} in an NNCT at the given confidence level conf.level and depends on the type of alternative.

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 N_{ii} in an NNCT.

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 N_{ii} in an NNCT which is E[S] = ∑_{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.

alternative

Type of the alternative hypothesis in the test, one of "two.sided", "less", "greater"

method

Description of the hypothesis test

ct.name

Name of the contingency table, ct, returned by Znnself.sum.ct only

data.name

Name of the data set, dat, returned by Znnself.sum only

Author(s)

Elvan Ceyhan

References

\insertAllCited

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")


nnspat documentation built on Aug. 30, 2022, 9:06 a.m.