funsZseg.coeff: Z Tests for Segregation Coefficients

funsZseg.coeffR Documentation

Z Tests for Segregation Coefficients

Description

Two functions: Zseg.coeff.ct and Zseg.coeff.

Both functions are objects of class "cellhtest" but with different arguments (see the parameter list below). Each one performs hypothesis tests of deviations of segregation coefficients from their expected values under RL or CSR for each segregation coefficient in the NNCT.

The test for each cell i,j is based on the normal approximation of the corresponding segregation coefficient. That is, each performs the segregation coefficient tests which are appropriate (i.e., have the appropriate asymptotic sampling distribution) for completely mapped data. 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 a contingency table of the test statistics, p-values for the corresponding alternative, lower and upper confidence levels, sample estimates (i.e., observed values) and null value (i.e., expected value, which is 0) for the segregation coefficients and also names of the test statistics, estimates, null value, the description of the test, and the data set used.

The null hypothesis for each cell i,j is that the corresponding segregation coefficient equal to the expected value (which is 0) under RL or CSR.

See also (\insertCiteceyhan:SiM-seg-ind2014;textualnnspat).

Usage

Zseg.coeff.ct(
  ct,
  VarSC,
  alternative = c("two.sided", "less", "greater"),
  conf.level = 0.95
)

Zseg.coeff(
  dat,
  lab,
  alternative = c("two.sided", "less", "greater"),
  conf.level = 0.95,
  ...
)

Arguments

ct

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

VarSC

The variance matrix for the segregation coefficients in the NNCT, ct; used in Zseg.coeff.ct only

alternative

Type of the alternative hypothesis in the test, one of "two.sided", "less" or "greater".

conf.level

Level of the upper and lower confidence limits, default is 0.95, for the segregation coefficients

dat

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

lab

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

...

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

Value

A list with the elements

statistic

The matrix of test statistics for the segregation coefficients

stat.names

Name of the test statistics

p.value

The matrix of p-values for the hypothesis test for the corresponding alternative

LCL, UCL

Matrix of lower and upper confidence levels for the segregation coefficients at the given confidence level conf.level and depends on the type of alternative.

conf.int

Confidence interval for segregation coefficients, it is NULL here since we provide the upper and lower confidence limits as k \times k matrices.

cnf.lvl

Level of the upper and lower confidence limits of the segregation coefficients, provided in conf.level.

estimate

Estimate of the parameter, i.e., matrix of the observed segregation coefficients

est.name, est.name2

Names of the estimates, both are same in this function

null.value

Hypothesized null values for the parameters, i.e., expected values of the segregation coefficients, which are all 0 under RL or CSR.

null.name

Name of the null value

alternative

Type of the alternative hypothesis in the test, one of "two.sided", "less" or "greater"

method

Description of the hypothesis test

ct.name

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

data.name

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

Author(s)

Elvan Ceyhan

References

\insertAllCited

See Also

seg.coeff and Zseg.ind

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)

varT<-var.seg.coeff(ct,covN)

Zseg.coeff(Y,cls)
Zseg.coeff.ct(ct,varT)

Zseg.coeff(Y,cls,method="max")

Zseg.coeff(Y,cls,alt="g")
Zseg.coeff.ct(ct,varT,alt="g")

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

Zseg.coeff.ct(ct,varT)

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

varT<-var.seg.coeff(ct,covN)

Zseg.coeff(Y,cls)
Zseg.coeff.ct(ct,varT)

Zseg.coeff(Y,cls,alt="g")
Zseg.coeff.ct(ct,varT,alt="g")


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