var.seg.coeff {nnspat} | R Documentation |
Variances of Segregation Coefficients in a Multi-class Case
Description
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 (Ceyhan (2014)).
The argument covN
is the covariance matrix of N_{ij}
(concatenated rowwise).
Usage
var.seg.coeff(ct, covN)
Arguments
ct |
A nearest neighbor contingency table |
covN |
The |
Value
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)
.
Author(s)
Elvan Ceyhan
References
Ceyhan E (2014). “Segregation indices for disease clustering.” Statistics in Medicine, 33(10), 1662-1684.
See Also
seg.coeff
, cov.seg.coeff
, var.nnsym
and var.nnct
and
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)
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)