funsZnnsym2cl.ss {nnspat} | R Documentation |
Pielou's First Type of NN Symmetry Test with Normal Approximation for Two Classes (for Sparse Sampling)
Description
Two functions: Znnsym2cl.ss.ct
and Znnsym2cl.ss
.
Both functions are objects of class "htest"
but with different arguments (see the parameter list below).
Each one performs hypothesis tests of equality of the expected value of the off-diagonal
cell counts (i.e., entries) under RL or CSR in the NNCT for k=2
classes.
That is, each performs Pielou's first type of NN symmetry test which is appropriate
(i.e., have the appropriate asymptotic sampling distribution)
provided that data is obtained by sparse sampling.
(See Ceyhan (2014) for more detail).
Each symmetry test is based on the normal approximation of the difference of the off-diagonal entries in the NNCT and are due to Pielou (1961).
Each function yields the test statistic, p
-value for the
corresponding alternative, the confidence interval, estimate and null value for the parameter of interest
(which is the difference of the off-diagonal entries in the NNCT), and method and name of the data set used.
The null hypothesis is that E(N_{12})=E(N_{21})
in the 2 \times 2
NNCT (i.e., symmetry in the
mixed NN structure).
In the output, the test statistic, p
-value and the confidence interval are valid only
for (properly) sparsely sampled data.
See also (Pielou (1961); Ceyhan (2014)) and the references therein.
Usage
Znnsym2cl.ss.ct(
ct,
alternative = c("two.sided", "less", "greater"),
conf.level = 0.95
)
Znnsym2cl.ss(
dat,
lab,
alternative = c("two.sided", "less", "greater"),
conf.level = 0.95,
...
)
Arguments
ct |
A nearest neighbor contingency table, used in |
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 difference of the off-diagonal entries, |
estimate |
Estimate, i.e., the difference of the off-diagonal entries of the |
null.value |
Hypothesized null value for the expected difference between the off-diagonal entries,
|
alternative |
Type of the alternative hypothesis in the test, one of |
method |
Description of the hypothesis test |
data.name |
Name of the data set, |
Author(s)
Elvan Ceyhan
References
Ceyhan E (2014).
“Testing Spatial Symmetry Using Contingency Tables Based on Nearest Neighbor Relations.”
The Scientific World Journal, Volume 2014, Article ID 698296.
Pielou EC (1961).
“Segregation and symmetry in two-species populations as studied by nearest-neighbor relationships.”
Journal of Ecology, 49(2), 255-269.
See Also
Xsq.nnsym.ss.ct
, Xsq.nnsym.ss
, Znnsym.ss.ct
and
Znnsym.ss
Examples
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
Znnsym2cl.ss(Y,cls)
Znnsym2cl.ss.ct(ct)
Znnsym2cl.ss(Y,cls,method="max")
Znnsym.ss.ct(ct)
Znnsym2cl.ss(Y,cls,alt="g")
Znnsym2cl.ss.ct(ct,alt="g")
#cls as a factor
na<-floor(n/2); nb<-n-na
fcls<-rep(c("a","b"),c(na,nb))
Znnsym2cl.ss(Y,fcls)
#############
ct<-matrix(sample(1:20,4),ncol=2)
Znnsym2cl.ss.ct(ct) #gives an error message if ct<-matrix(sample(1:20,9),ncol=3)