funsZmixed.nonref {nnspat} | R 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 Ceyhan and Bahadir (2017) 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 Ceyhan and Bahadir (2017).
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 |
nvec |
The |
Qv |
The number of shared NNs, used in |
Tv |
|
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 mixed non-reflexivity value (i.e., diagonal entry |
estimate |
Estimate of the parameter, i.e., the observed diagonal entry |
null.value |
Hypothesized null value for the mixed non-reflexivity value (i.e., expected value of the
diagonal entry |
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, Bahadir S (2017). “Nearest Neighbor Methods for Testing Reflexivity.” Environmental and Ecological Statistics, 24(1), 69-108.
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")