funsXsq.seg.coeff: Chi-square Test for Segregation Coefficients

funsXsq.seg.coeffR Documentation

Chi-square Test for Segregation Coefficients

Description

Two functions: Xsq.seg.coeff.ct and Xsq.seg.coeff.

Each one performs hypothesis tests of (simultaneous) equality of the segregation coefficients in an NNCT to the ones under RL or CSR. That is, each performs the combined Chi-square test for segregation coefficients which is appropriate (i.e., have the appropriate asymptotic sampling distribution) for completely mapped data. (See \insertCiteceyhan:SiM-seg-ind2014;textualnnspat for more detail).

Each test is based on the Chi-square approximation of the corresponding quadratic form for the segregation coefficients in an NNCT. The segregation coefficients in the multi-class case are the extension of Pielou's segregation coefficient for the two-class case. (See \insertCiteceyhan:SiM-seg-ind2014;textualnnspat for more detail).

Each function yields the test statistic, p-value and df which is k(k+1)/2-1, description of the alternative with the corresponding null values (i.e., expected values) of the segregation coefficients in the NNCT (which are 0 for this function) and also the sample estimates (i.e., observed values) of the segregation coefficients. The functions also provide names of the test statistics, the description of the test and the data set used.

The null hypothesis for all cells (i,j) is that the corresponding segregation coefficients are all equal to the expected value (which is 0) under RL or CSR.

Usage

Xsq.seg.coeff.ct(ct, covSC)

Xsq.seg.coeff(dat, lab, ...)

Arguments

ct

A nearest neighbor contingency table, used in Xsq.seg.coeff.ct only

covSC

The covariance matrix for the segregation coefficients in the NNCT, used in Xsq.seg.coeff.ct only. Usually output of the function cov.seg.coeff

dat

The data set in one or higher dimensions, each row corresponds to a data point, used in Xsq.seg.coeff only

lab

The vector of class labels (numerical or categorical), used in Xsq.seg.coeff only

...

are for further arguments, such as method and p, passed to the dist function. used in Xsq.seg.coeff only

Value

A list with the elements

statistic

The chi-squared test statistic for the combined segregation coefficients

p.value

The p-value for the hypothesis test

df

Degrees of freedom for the chi-squared test, which is k(k+1)/2-1 for this function.

estimate

The vector of estimates of the parameters, i.e., observed values of segregation coefficients in the NNCT.

est.name, est.name2

Names of the estimates, they are identical for this function.

null.value

The null value of the parameters, i.e., expected values of segregation coefficients in the NNCT under RL or CSR (which is 0).

method

Description of the hypothesis test

ct.name

Name of the contingency table, ct, returned by Xsq.seg.coeff.ct only

data.name

Name of the data set, dat, returned by Xsq.seg.coeff only

Author(s)

Elvan Ceyhan

References

\insertAllCited

See Also

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

Examples

n<-20
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)

covSC<-cov.seg.coeff(ct,covN)

Xsq.seg.coeff(Y,cls)
Xsq.seg.coeff.ct(ct,covSC)

Xsq.seg.coeff(Y,cls,method="max")

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

Xsq.seg.coeff.ct(ct,covSC)

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

covSC<-cov.seg.coeff(ct,covN)

Xsq.seg.coeff(Y,cls)
Xsq.seg.coeff.ct(ct,covSC)


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