View source: R/NNCTFunctions.R
cov.seg.coeff | R Documentation |
Returns the covariance matrix of the segregation coefficients in a multi-class case based on
the NNCT, ct
. The covariance matrix is of dimension k(k+1)/2 \times k(k+1)/2
and its entry i,j
correspond to the
entries in the rows i
and j
of the output of ind.seg.coeff(k)
.
The segregation coefficients in the multi-class case are the extension of Pielou's segregation coefficient
for the two-class case.
These covariances are valid under RL or conditional on Q
and R
under CSR.
The argument covN
is the covariance matrix of N_{ij}
(concatenated rowwise).
See also (\insertCiteceyhan:SiM-seg-ind2014;textualnnspat).
cov.seg.coeff(ct, covN)
ct |
A nearest neighbor contingency table |
covN |
The |
The k(k+1)/2
x k(k+1)/2
covariance matrix of the segregation coefficients for the multi-class case
based on the NNCT, ct
Elvan Ceyhan
seg.coeff
, var.seg.coeff
, cov.nnct
and cov.nnsym
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)
W<-Wmat(ipd)
Qv<-Qvec(W)$q
Rv<-Rval(W)
varN<-var.nnct(ct,Qv,Rv)
covN<-cov.nnct(ct,varN,Qv,Rv)
cov.seg.coeff(ct,covN)
#cls as a factor
na<-floor(n/2); nb<-n-na
fcls<-rep(c("a","b"),c(na,nb))
ct<-nnct(ipd,fcls)
cov.seg.coeff(ct,covN)
#############
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)
ct<-nnct(ipd,cls)
W<-Wmat(ipd)
Qv<-Qvec(W)$q
Rv<-Rval(W)
varN<-var.nnct(ct,Qv,Rv)
covN<-cov.nnct(ct,varN,Qv,Rv)
cov.seg.coeff(ct,covN)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.