View source: R/NNCTFunctions.R
var.seg.coeff | R Documentation |
Returns the variances of segregation coefficients in a multi-class case based on the NNCT, ct
in a vector
of length k(k+1)/2
, the order of the variances are as in the order of rows output of
ind.seg.coeff(k)
. These variances are valid under RL or conditional on Q
and R
under CSR.
See also (\insertCiteceyhan:SiM-seg-ind2014;textualnnspat).
The argument covN
is the covariance matrix of N_{ij}
(concatenated rowwise).
var.seg.coeff(ct, covN)
ct |
A nearest neighbor contingency table |
covN |
The |
A vector
of length k(k+1)/2
, whose entries are the variances of segregation coefficients for the
entry i,j
in the NNCT, where the order of the variances are as in the order of rows output of
ind.seg.coeff(k)
.
Elvan Ceyhan
seg.coeff
, cov.seg.coeff
, var.nnsym
and var.nnct
and
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)
var.seg.coeff(ct,covN)
varPseg.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)
var.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)
var.seg.coeff(ct,covN)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.