funsZnnref {nnspat} | R Documentation |
Z Tests for NN Reflexivity
Description
Two functions: Znnref.ct
and Znnref
.
Both functions are objects of class "refhtest"
but with different arguments (see the parameter list below).
Each one performs hypothesis tests of equality of the expected values of the
diagonal cell counts (i.e., entries) under RL or CSR in the RCT for k \ge 2
classes.
That is, each test performs NN reflexivity test (i.e., a test of self reflexivity and a test of
mixed non-reflexivity, corresponding to entries (1,1)
and (2,2)
, respectively, 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 reflexivity test is based on the normal approximation of the diagonal entries in the RCT and are due to Ceyhan and Bahadir (2017).
Each function yields the test statistics, p
-values for the corresponding
alternative, expected values (i.e., null value(s)), confidence intervals and sample estimates (i.e., observed values)for the
self reflexivity and mixed non-reflexivity values (i.e., entries (1,1)
and (2,2)
values, respectively)
in the RCT. Each function also gives names of the test statistics, null values, the description of the test, and the data
set used.
The null hypothesis is that E(N_{11})=R P_{aa}
and E(N_{22})=R P_{ab}
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
and P_{ab}
is the probability of any two points selected are being from two different classes.
The Znnref
functions (i.e., Znnref.ct
and Znnref
) are different from
the Znnself
functions (i.e., Znnself.ct
and Znnself
) and
from Zself.ref
functions (i.e., Zself.ref.ct
and Zself.ref
), and also
from Znnself.sum
functions (i.e., Znnself.sum.ct
and Znnself.sum
).
Znnref
functions are for testing the self reflexivity and mixed non-reflexivity
using the diagonal entries in the 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, and
Zself.ref
functions are for testing the self reflexivity for the entire data set
using entry (1,1)
in 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
Znnref.ct(
rfct,
nvec,
Qv,
Tv,
alternative = c("two.sided", "less", "greater"),
conf.level = 0.95
)
Znnref(
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 |
stat.names |
Name of the test statistics |
p.value |
The |
conf.int |
Confidence intervals for the self reflexivity and mixed non-reflexivity values
(i.e., diagonal entries |
cnf.lvl |
Level of the onfidence intervals of the diagonal entries, provided in |
estimate |
Estimates of the parameters, i.e., the observed diagonal entries |
null.value |
Hypothesized null values for the self reflexivity and mixed non-reflexivity values
(i.e., expected values of the diagonal entries |
null.name |
Name of the null values |
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
Znnself.ct
, Znnself
, Zmixed.nonref.ct
,
Zmixed.nonref
, Xsq.nnref.ct
and Xsq.nnref
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)
W<-Wmat(ipd)
Qv<-Qvec(W)$q
Rv<-Rval(W)
Tv<-Tval(W,Rv)
nvec<-as.numeric(table(cls))
rfct<-rct(ipd,cls)
Znnref(Y,cls)
Znnref(Y,cls,method="max")
Znnref.ct(rfct,nvec,Qv,Tv)
Znnref.ct(rfct,nvec,Qv,Tv,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)
W<-Wmat(ipd)
Qv<-Qvec(W)$q
R<-Rval(W)
Tv<-Tval(W,R)
nvec<-as.numeric(table(cls))
rfct<-rct(ipd,cls)
Znnref(Y,cls,alt="g")
Znnref.ct(rfct,nvec,Qv,Tv)
Znnref.ct(rfct,nvec,Qv,Tv,alt="l")