View source: R/NNCTFunctions.r
| seg.ind | R Documentation |
Returns Dixon's segregation indices in matrix form based on entries of the NNCT, ct.
Segregation index for cell i,j is defined as log(N_{ii}(n-n_i)/((n_i-N_{ii})(n_i-1)) if i=j
and
as log(N_{ij}(n-n_j-1)/((n_i-N_{ij})(n_j)) if i \ne j.
See (\insertCitedixon:NNCTEco2002,ceyhan:SiM-seg-ind2014;textualnnspat).
The argument inf.corr is a logical argument (default=FALSE) to avoid \pm ∞ for the segregation
indices. If TRUE indices are modified so that they are finite and if FALSE the above definition is used.
(See \insertCiteceyhan:SiM-seg-ind2014;textualnnspat for more detail).
seg.ind(ct, inf.corr = FALSE)
ct |
A contingency table, in particular an NNCT |
inf.corr |
A logical argument (default= |
Returns a matrix of segregation indices which is of the same dimension as ct.
Elvan Ceyhan
Pseg.coeff, seg.coeff, Zseg.ind
and Zseg.ind.ct
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)
#cls as a factor
na<-floor(n/2); nb<-n-na
fcls<-rep(c("a","b"),c(na,nb))
ct<-nnct(ipd,fcls)
seg.ind(ct)
#############
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)
seg.ind(ct)
seg.ind(ct,inf.corr = TRUE)
ct<-matrix(c(0,10,5,5),ncol=2)
seg.ind(ct)
seg.ind(ct,inf.corr = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.