funsZself.ref: Self-Reflexivity Test with Normal Approximation

funsZself.refR Documentation

Self-Reflexivity Test with Normal Approximation

Description

Two functions: Zself.ref.ct and Zself.ref.

Both functions are objects of class "htest" but with different arguments (see the parameter list below). Each one performs hypothesis tests of self reflexivity in the NN structure using the number of self-reflexive NN pairs (i.e., the first diagonal entry, (1,1)) in the RCT for k \ge 2 classes. That is, each test performs a test of self reflexivity corresponding to entry (1,1) in the RCT) which is appropriate (i.e., have the appropriate asymptotic sampling distribution) for completely mapped data. (See \insertCiteceyhan:NNreflexivity2017;textualnnspat for more detail).

The self reflexivity test is based on the normal approximation of the diagonal entry (1,1) in the RCT and are due to \insertCiteceyhan:NNreflexivity2017;textualnnspat.

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 self reflexivity value (i.e., diagonal entry (1,1) value, respectively) in the RCT, and method and name of the data set used.

The null hypothesis is that E(N_{11})=R P_{aa} in the RCT, where R is the number of reflexive NNs and P_{aa} is the probability of any two points selected are being from the same class.

The Zself.ref functions (i.e., Zself.ref.ct and Zself.ref) are different from the Znnref functions (i.e., Znnref.ct and Znnref) and from Znnself functions (i.e., Znnself.ct and Znnself), and also from Znnself.sum functions (i.e., Znnself.sum.ct and Znnself.sum). Zself.ref functions are for testing the self reflexivity for the entire data set using entry (1,1) in RCT 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, Znnref functions are for testing the self reflexivity and mixed non-reflexivity using the diagonal entries in the RCT, and Znnself.sum functions are testing the cumulative species correspondence using the sum of the self column (i.e., the first column) in the SCCT.

Usage

Zself.ref.ct(
  rfct,
  nvec,
  alternative = c("two.sided", "less", "greater"),
  conf.level = 0.95
)

Zself.ref(
  dat,
  lab,
  alternative = c("two.sided", "less", "greater"),
  conf.level = 0.95,
  ...
)

Arguments

rfct

An RCT, used in Zself.ref.ct only

nvec

The vector of class sizes, used in Zself.ref.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 difference of the off-diagonal entries, N_{12}-N_{21}

dat

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

lab

The vector of class labels (numerical or categorical), used in Zself.ref only

...

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

Value

A list with the elements

statistic

The Z test statistic for self reflexivity corresponding to entry (1,1) in the RCT

p.value

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

conf.int

Confidence interval for the self reflexivity value (i.e., diagonal entry (1,1) value) in the RCT at the given confidence level conf.level and depends on the type of alternative.

estimate

Estimate of the parameter, i.e., the observed diagonal entry (1,1) in the RCT, rfct.

null.value

Hypothesized null value for the self reflexivity value (i.e., expected value of the diagonal entry (1,1) which is E(N_{11})=R P_{aa}) in the RCT.

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, rfct, returned by Zself.ref.ct only

data.name

Name of the data set, dat, returned by Zself.ref only

Author(s)

Elvan Ceyhan

References

\insertAllCited

See Also

Znnref.ct, Znnref, Zmixed.nonref.ct and Zmixed.nonref

Examples

n<-20  #or try sample(1:20,1)
Y<-matrix(runif(3*n),ncol=3)
cls<-sample(1:2,n,replace = TRUE)  #or try cls<-rep(1:2,c(10,10))
ipd<-ipd.mat(Y)

nvec<-as.numeric(table(cls))
rfct<-rct(ipd,cls)

Zself.ref(Y,cls)
Zself.ref(Y,cls,method="max")

Zself.ref.ct(rfct,nvec)
Zself.ref.ct(rfct,nvec,alt="g")

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

nvec<-as.numeric(table(cls))
rfct<-rct(ipd,cls)

Zself.ref(Y,cls,alt="g")

Zself.ref.ct(rfct,nvec)
Zself.ref.ct(rfct,nvec,alt="l")


nnspat documentation built on May 29, 2024, 10:03 a.m.