funsZsegind | R Documentation |
Two functions: Zseg.ind.ct
and Zseg.ind
.
Both functions are objects of class "cellhtest"
but with different arguments (see the parameter list below).
Each one performs hypothesis tests of deviations of
segregation indices from their expected values
under RL or CSR for each segregation index in the NNCT.
The test for each cell i,j
is based on the normal approximation
of the corresponding segregation index.
Each function yields a contingency table of the test statistics,
p
-values for the corresponding
alternative, lower and upper confidence levels,
sample estimates (i.e., observed values) and
null value(s) (i.e., expected values) for the segregation indices
and also names of the test statistics, estimates,
null value, the description of the test, and the data set used.
The null hypothesis for each cell i,j
is
that the corresponding segregation index
equal to the expected value (which is 0) under RL or CSR.
See also (\insertCiteceyhan:SiM-seg-ind2014;textualnnspat).
Zseg.ind.ct(
ct,
varN,
inf.corr = FALSE,
alternative = c("two.sided", "less", "greater"),
conf.level = 0.95
)
Zseg.ind(
dat,
lab,
inf.corr = FALSE,
alternative = c("two.sided", "less", "greater"),
conf.level = 0.95,
...
)
ct |
A nearest neighbor contingency table,
used in |
varN |
The variance matrix for cell counts in the NNCT,
|
inf.corr |
A logical argument (default= |
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 |
A list
with the elements
statistic |
The |
stat.names |
Name of the test statistics |
p.value |
The |
LCL , UCL |
Matrix of lower and upper confidence levels for
the segregation indices at the given confidence
level |
cnf.lvl |
Level of the upper
and lower confidence limits of the segregation indices,
provided in |
estimate |
Estimate of the parameter, i.e., matrix of the observed segregation indices |
est.name , est.name2 |
Names of the estimates, both are same in this function |
null.value |
Hypothesized values for the parameters, i.e., the null values of the segregation indices, which are all 0 under RL or CSR. |
null.name |
Name of the null value |
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, |
Elvan Ceyhan
seg.ind
and Zseg.coeff
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
seg.ind(ct)
seg.ind(ct,inf.corr=TRUE)
W<-Wmat(ipd)
Qv<-Qvec(W)$q
Rv<-Rval(W)
varN<-var.nnct(ct,Qv,Rv)
varN
Zseg.ind(Y,cls)
Zseg.ind(Y,cls,inf.corr=TRUE)
Zseg.ind.ct(ct,varN)
Zseg.ind(Y,cls,alt="g")
Zseg.ind.ct(ct,varN,alt="g")
Zseg.ind(Y,cls,method="max")
#cls as a factor
na<-floor(n/2); nb<-n-na
fcls<-rep(c("a","b"),c(na,nb))
Zseg.ind(Y,cls)
#############
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)
W<-Wmat(ipd)
Qv<-Qvec(W)$q
Rv<-Rval(W)
varN<-var.nnct(ct,Qv,Rv)
varN
Zseg.ind(Y,cls)
Zseg.ind(Y,cls,inf.corr = TRUE)
Zseg.ind.ct(ct,varN)
Zseg.ind.ct(ct,varN,inf.corr = TRUE)
#1D data points
n<-20 #or try sample(1:20,1)
X<-as.matrix(runif(n))# need to be entered as a matrix with one column
#(i.e., a column vector), hence X<-runif(n) would not work
ipd<-ipd.mat(X)
cls<-sample(1:2,n,replace = TRUE) #or try cls<-rep(1:2,c(10,10))
ct<-nnct(ipd,cls)
W<-Wmat(ipd)
Qv<-Qvec(W)$q
Rv<-Rval(W)
varN<-var.nnct(ct,Qv,Rv)
Zseg.ind(X,cls)
Zseg.ind.ct(ct,varN)
Zseg.ind.ct(ct,varN,inf.corr=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.