funsXsq.nnsym.ss | R Documentation |
Two functions: Xsq.nnsym.ss.ct
and Xsq.nnsym.ss
.
Both functions are objects of class "Chisqtest"
but with different arguments (see the parameter list below).
Each one performs the hypothesis test of equality of the expected value of the off-diagonal
cell counts (i.e., entries) under RL or CSR in the NNCT for k \ge 2
classes.
That is, each performs Pielou's first type of NN symmetry test which is also equivalent to McNemar's
test on the NNCT. The test is appropriate (i.e., have the appropriate asymptotic sampling distribution)
provided that data is obtained by sparse sampling.
(See \insertCiteceyhan:SWJ-spat-sym2014;textualnnspat for more detail).
Each symmetry test is based on the chi-squared approximation of the corresponding quadratic form and are due to \insertCitepielou:1961;textualnnspat.
The argument cont.corr is a logical argument (default=TRUE
) for continuity correction to this test.
If TRUE
the continuity correction to McNemar's test is implemented,
and if FALSE
such a correction is not implemented.
Each function yields the test statistic, p
-value and df
which is k(k-1)/2
, description of the
alternative with the corresponding null values (i.e., expected values) of differences of the off-diagonal entries,(which is
0 for this function) and also the sample estimates (i.e., observed values) of absolute differences of th
off-diagonal entries of NNCT (in the upper-triangular form).
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_{ij})=E(N_{ji})
for all entries for i \ne j
(i.e., symmetry in the
mixed NN structure).
In the output, the test statistic, p
-value and df
are valid only for (properly) sparsely sampled data.
See also (\insertCitepielou:1961,ceyhan:SWJ-spat-sym2014;textualnnspat) and the references therein.
Xsq.nnsym.ss.ct(ct, cont.corr = TRUE)
Xsq.nnsym.ss(dat, lab, cont.corr = TRUE, ...)
ct |
A nearest neighbor contingency table, used in |
cont.corr |
A logical argument (default= |
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 Pielou's first type of NN symmetry test |
stat.names |
Name of the test statistic |
p.value |
The |
df |
Degrees of freedom for the chi-squared test, which is |
estimate |
Estimates, i.e., absolute differences of the off-diagonal entries of NNCT (in the upper-triangular form). |
est.name , est.name2 |
Names of the estimates, former is a shorter description of the estimates than the latter. |
null.value |
Hypothesized null values for the differences between the expected values of the off-diagonal entries, which is 0 for this function. |
method |
Description of the hypothesis test |
ct.name |
Name of the contingency table, |
data.name |
Name of the data set, |
Elvan Ceyhan
Znnsym2cl.ss.ct
, Znnsym2cl.ss
, Znnsym.ss.ct
,
Znnsym.ss
, Xsq.nnsym.dx.ct
, Xsq.nnsym.dx
and Qsym.test
n<-20 #or try sample(1:20,1)
Y<-matrix(runif(3*n),ncol=3)
ipd<-ipd.mat(Y)
cls<-sample(1:2,n,replace = TRUE) #or try cls<-rep(1:2,c(10,10))
ct<-nnct(ipd,cls)
ct
Xsq.nnsym.ss(Y,cls)
Xsq.nnsym.ss.ct(ct)
Xsq.nnsym.ss(Y,cls,method="max")
Xsq.nnsym.ss(Y,cls,cont.corr=FALSE)
Xsq.nnsym.ss.ct(ct,cont.corr=FALSE)
#cls as a factor
na<-floor(n/2); nb<-n-na
fcls<-rep(c("a","b"),c(na,nb))
Xsq.nnsym.ss(Y,fcls)
#############
n<-40
Y<-matrix(runif(3*n),ncol=3)
ipd<-ipd.mat(Y)
cls<-sample(1:4,n,replace = TRUE) #or try cls<-rep(1:2,c(10,10))
ct<-nnct(ipd,cls)
Xsq.nnsym.ss(Y,cls)
Xsq.nnsym.ss.ct(ct)
Xsq.nnsym.ss.ct(ct,cont.corr = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.