funsZmixed.nonref: Mixed-Non-Reflexivity Test with Normal Approximation

funsZmixed.nonrefR Documentation

Mixed-Non-Reflexivity Test with Normal Approximation

Description

Two functions: Zmixed.nonref.ct and Zmixed.nonref.

Both functions are objects of class "htest" but with different arguments (see the parameter list below). Each one performs hypothesis tests of mixed non-reflexivity in the NN structure using the number of mixed-non-reflexive NN pairs (i.e., the second diagonal entry, (2,2)) in the RCT for k \ge 2 classes. That is, each test performs a test of mixed non-reflexivity corresponding to entry (2,2) 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 mixed non-reflexivity test is based on the normal approximation of the diagonal entry (2,2) 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 mixed non-reflexivity value (i.e., diagonal entry (2,2) value, respectively) in the RCT, and method and name of the data set used.

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

Usage

Zmixed.nonref.ct(
  rfct,
  nvec,
  Qv,
  Tv,
  alternative = c("two.sided", "less", "greater"),
  conf.level = 0.95
)

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

Arguments

rfct

An RCT, used in Zmixed.nonref.ct only

nvec

The vector of class sizes, used in Zmixed.nonref.ct only

Qv

The number of shared NNs, used in Zmixed.nonref.ct only

Tv

T value, which is the number of triplets (z_i, z_j, z_k) with "NN(z_i) = NN(z_j) = z_k and NN(z_k) = z_j where NN(\cdot) is the nearest neighbor function, used in Zmixed.nonref.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 Zmixed.nonref only

lab

The vector of class labels (numerical or categorical), used in Zmixed.nonref only

...

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

Value

A list with the elements

statistic

The Z test statistic for mixed non-reflexivity corresponding to entry (2,2) in the RCT

p.value

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

conf.int

Confidence interval for the mixed non-reflexivity value (i.e., diagonal entry (2,2) 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 (2,2) in the RCT, rfct.

null.value

Hypothesized null value for the mixed non-reflexivity value (i.e., expected value of the diagonal entry (2,2) which is E(N_{22})=R P_{ab}) 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 Zmixed.nonref.ct only

data.name

Name of the data set, dat, returned by Zmixed.nonref only

Author(s)

Elvan Ceyhan

References

\insertAllCited

See Also

Zself.ref.ct, Zself.ref, Znnref.ct and Znnref

Examples

n<-20
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)
W<-Wmat(ipd)
Qv<-Qvec(W)$q
R<-Rval(W)
Tv<-Tval(W,R)

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

Zmixed.nonref(Y,cls)
Zmixed.nonref.ct(rfct,nvec,Qv,Tv)
Zmixed.nonref(Y,cls,alt="g")

Zmixed.nonref(Y,cls,method="max")

#############
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)
W<-Wmat(ipd)
Qv<-Qvec(W)$q
R<-Rval(W)
Tv<-Tval(W,R)

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

Zmixed.nonref(Y,cls,alt="g")

Zmixed.nonref.ct(rfct,nvec,Qv,Tv)
Zmixed.nonref.ct(rfct,nvec,Qv,Tv,alt="l")


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