varPseg.coeff: Variance of Pielou's Segregation Coefficient for 2 Classes

View source: R/NNCTFunctions.R

varPseg.coeffR 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 (\insertCiteceyhan:SiM-seg-ind2014;textualnnspat) 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

\insertAllCited

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)


nnspat documentation built on Aug. 30, 2022, 9:06 a.m.