funs.seg.coeff: Pielou's Segregation Coefficients for NNCTs

funs.seg.coeffR Documentation

Pielou's Segregation Coefficients for NNCTs

Description

Two functions: Pseg.coeff and seg.coeff.

Each function computes segregation coefficients based on NNCTs. The function Pseg.coeff computes Pielou's segregation coefficient (\insertCitepielou:1961;textualnnspat) for the two-class case (i.e., based on 2 \times 2 NNCTs) and seg.coeff is the extension of Pseg.coeff to the multi-class case (i.e., for k \times k NNCTs with k \ge 2) and provides a k \times k matrix of segregation coefficients (\insertCiteceyhan:SiM-seg-ind2014;textualnnspat). Both functions use the same argument, ct, for NNCT.

Pielou's segregation coefficient (for two classes) is S_P = 1-(N_{12} + N_{21})/(E[N_{12}] + E[N_{21}]) and the extended segregation coefficents (for k \ge 2 classes) are S_c = 1 -(N_{ii})/(E[N_{ii}]) for the diagonal cells in the NNCT and S_c = 1 -(N_{ij} + N_{ji})/(E[N_{ij}] + E[N_{ji}]) for the off-diagonal cells in the NNCT.

Usage

Pseg.coeff(ct)

seg.coeff(ct)

Arguments

ct

A nearest neighbor contingency table, used in both functions

Value

Pseg.coeff returns Pielou's segregation coefficient for 2 \times 2 NNCT seg.coeff returns a k \times k matrix of segregation coefficients (which are extended versions of Pielou's segregation coefficient)

Author(s)

Elvan Ceyhan

References

\insertAllCited

See Also

seg.ind, Zseg.coeff.ct and Zseg.coeff

Examples

#Examples for Pseg.coeff
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)
ct
Pseg.coeff(ct)

#cls as a factor
na<-floor(n/2); nb<-n-na
fcls<-rep(c("a","b"),c(na,nb))
ct<-nnct(ipd,fcls)

Pseg.coeff(ct)

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

#Examples for seg.coeff
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)
ct
seg.coeff(ct)

#cls as a factor
na<-floor(n/2); nb<-n-na
fcls<-rep(c("a","b"),c(na,nb))
ct<-nnct(ipd,fcls)

seg.coeff(ct)

#############
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)

seg.coeff(ct)


nnspat documentation built on May 29, 2024, 10:03 a.m.