funsXsq.nnref | R Documentation |
Two functions: Xsq.nnref.ct
and Xsq.nnref
.
Both functions are objects of class "Chisqtest"
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 an overall NN reflexivity test (for the vector of 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 \insertCiteceyhan:NNreflexivity2017;textualnnspat for more detail).
Each reflexivity test is based on the chi-squared approximation of the corresponding quadratic form for the vector of diagonal entries in the RCT and are due to \insertCiteceyhan:NNreflexivity2017;textualnnspat.
Each function yields the test statistic, p
-value and df
which is 2, description of the
alternative with the corresponding null values (i.e., expected values) of the diagonal entries
and also the sample estimates (i.e., observed values) of the diagonal entries of RCT (as a vector).
The functions also provide names of the test statistics, the description of the test and the data set used.
The null hypothesis is that E(N_{11},N_{22})=(R P_{aa},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.
Xsq.nnref.ct(rfct, nvec, Qv, Tv)
Xsq.nnref(dat, lab, ...)
rfct |
An RCT, used in |
nvec |
The |
Qv |
The number of shared NNs, used in |
Tv |
|
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 |
A list
with the elements
statistic |
The chi-squared test statistic for overall NN reflexivity test |
p.value |
The |
df |
Degrees of freedom for the chi-squared test, which is 2 for this function. |
estimate |
Estimates of the parameters, i.e., the observed diagonal entries |
est.name , est.name2 |
Names of the estimates, they are identical for this function. |
null.value |
Hypothesized null values for the diagonal entries |
method |
Description of the hypothesis test |
ct.name |
Name of the contingency table, |
data.name |
Name of the data set, |
Elvan Ceyhan
Znnref.ct
, Znnref
, Zself.ref.ct
,
Zself.ref
, Zmixed.nonref.ct
and Zmixed.nonref
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
R<-Rval(W)
Tv<-Tval(W,R)
nvec<-as.numeric(table(cls))
rfct<-rct(ipd,cls)
Xsq.nnref(Y,cls)
Xsq.nnref.ct(rfct,nvec,Qv,Tv)
Xsq.nnref(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)
Xsq.nnref(Y,cls)
Xsq.nnref.ct(rfct,nvec,Qv,Tv)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.