varPseg.coeff {nnspat}R Documentation

Variance of Pielou's Segregation Coefficient for 2 Classes

Description

Returns the variance of Pielou's coefficient of segregation for the two-class case (i.e., based on 2 \times 2 NNCTs)in a 2 \times 2 NNCT. This variance is valid under RL or conditional on Q and R under CSR.

See also (Ceyhan (2014)) for more detail.

Usage

varPseg.coeff(ct, covN)

Arguments

ct

A nearest neighbor contingency table

covN

The k^2 \times k^2 covariance matrix of row-wise vectorized entries of NNCT

Value

The variance of Pielou's coefficient of segregation for the two-class case.

Author(s)

Elvan Ceyhan

References

Ceyhan E (2014). “Segregation indices for disease clustering.” Statistics in Medicine, 33(10), 1662-1684.

See Also

Pseg.coeff, seg.coeff and var.seg.coeff

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)

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)

varPseg.coeff(ct,covN)

#############
ct<-matrix(sample(1:25,9),ncol=3)
#varPseg.coeff(ct,covN)


[Package nnspat version 0.1.2 Index]