funsPseg.ss: Pielou's Overall Test of Segregation for NNCT (for Sparse...

funsPseg.ssR Documentation

Pielou's Overall Test of Segregation for NNCT (for Sparse Sampling)

Description

Two functions: Pseg.ss.ct and Pseg.ss.

Both functions are objects of class "Chisqtest" but with different arguments (see the parameter list below). Each one performs hypothesis tests of deviations of cell counts from the expected values under independence for all cells (i.e., entries) combined in the NNCT. That is, each test is Pielou's overall test of segregation based on NNCTs for k \ge 2 classes. This overall test is based on the chi-squared approximation, is equivalent to Pearson's chi-squared test on NNCT and is due to \insertCitepielou:1961;textualnnspat. Each test is appropriate (i.e., have the appropriate asymptotic sampling distribution) when that data is obtained by sparse sampling.

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

The null hypothesis is that E(N_{ij})=n_i c_j /n for all entries in the NNCT where n_i is the sum of row i (i.e., size of class i), c_j is the sum of column j in the k \times k NNCT for k \ge 2. In the output, the test statistic and the p-value are valid only for (properly) sparsely sampled data.

See also (\insertCitepielou:1961,ceyhan:eest-2010;textualnnspat) and the references therein.

Usage

Pseg.ss.ct(ct, yates = TRUE, sim = FALSE, Nsim = 2000)

Pseg.ss(dat, lab, yates = TRUE, sim = FALSE, Nsim = 2000, ...)

Arguments

ct

A nearest neighbor contingency table, used in Pseg.ss.ct only

yates

A logical parameter (default=TRUE). If TRUE, Yates continuity correction is applied, and if FALSE the continuity correction is not applied. Equivalent to the correct argument in the base function chisq.test

sim

A logical parameter (default=FALSE). If TRUE, p-values are computed by Monte Carlo simulation and if FALSE the p-value is based on the chi-squared approximation. Equivalent to the simulate.p.value argument in the base function chisq.test

Nsim

A positive integer specifying the number of replicates used in the Monte Carlo test. Equivalent to the B argument in the base function chisq.test

dat

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

lab

The vector of class labels (numerical or categorical), used in Pseg.ss only

...

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

Value

A list with the elements

statistic

The overall chi-squared statistic

stat.names

Name of the test statistic

p.value

The p-value for the hypothesis test

df

Degrees of freedom for the chi-squared test, which is (k-1)^2 for this function. Yields NA if sim=TRUE and NSim is provided.

estimate

Estimates of the parameters, NNCT, i.e., matrix of the observed N_{ij} values which is the NNCT.

est.name, est.name2

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

null.value

Matrix of hypothesized null values for the parameters which are expected values of the the N_{ij} values in the NNCT.

null.name

Name of the null values

method

Description of the hypothesis test

ct.name

Name of the contingency table, ct, returned by Pseg.ss.ct only

data.name

Name of the data set, dat, returned by Pseg.ss only

Author(s)

Elvan Ceyhan

References

\insertAllCited

See Also

overall.nnct.ct, overall.nnct, overall.seg.ct, overall.seg and chisq.test

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

Pseg.ss(Y,cls)

Pseg.ss.ct(ct)
Pseg.ss.ct(ct,yates=FALSE)

Pseg.ss.ct(ct,yates=FALSE,sim=TRUE)
Pseg.ss.ct(ct,yates=FALSE,sim=TRUE,Nsim=10000)

Pseg.ss(Y,cls,method="max")
Pseg.ss(Y,cls,yates=FALSE,sim=TRUE,Nsim=10000,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)

Pseg.ss(Y,fcls)
Pseg.ss.ct(ct)

#############
n<-40
Y<-matrix(runif(3*n),ncol=3)
ipd<-ipd.mat(Y)
cls<-sample(1:4,n,replace = TRUE)  #or try cls<-rep(1:2,c(10,10))
ct<-nnct(ipd,cls)

Pseg.ss(Y,cls)
Pseg.ss.ct(ct,yates=FALSE)

Pseg.ss(Y,cls, sim = TRUE, Nsim = 2000)
Pseg.ss.ct(ct,yates=FALSE) 


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