funs.cell.spec.ss {nnspat}R Documentation

Pielou's Cell-specific Segregation Test with Normal Approximation (for Sparse Sampling)

Description

Two functions: cell.spec.ss.ct and cell.spec.ss.

Both functions are objects of class "cellhtest" but with different arguments (see the parameter list below). Each one performs hypothesis tests of equality of the expected values of the cell counts (i.e., entries) in the NNCT for k \ge 2 classes. Each test is appropriate (i.e., have the appropriate asymptotic sampling distribution) when that data is obtained by sparse sampling.

Each cell-specific segregation test is based on the normal approximation of the entries in the NNCT and are due to Pielou (1961).

Each function yields a contingency table of the test statistics, p-values for the corresponding alternative, expected values, lower and upper confidence levels, sample estimates (i.e., observed values) and null value(s) (i.e., expected values) for the N_{ij} values for i,j=1,2,\ldots,k and also names of the test statistics, estimates, null values, the description of the test, and the data set used.

The null hypothesis is that all E(N_{ij})=n_i c_j /n 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, p-value and the lower and upper confidence limits are valid only for (properly) sparsely sampled data.

See also (Pielou (1961); Ceyhan (2010)) and the references therein.

Usage

cell.spec.ss.ct(
  ct,
  alternative = c("two.sided", "less", "greater"),
  conf.level = 0.95
)

cell.spec.ss(
  dat,
  lab,
  alternative = c("two.sided", "less", "greater"),
  conf.level = 0.95,
  ...
)

Arguments

ct

A nearest neighbor contingency table, used in cell.spec.ss.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 entries, N_{ij} in the NNCT

dat

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

lab

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

...

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

Value

A list with the elements

statistic

The matrix of Z test statistics for cell-specific tests

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 entries N_{ij} in the NNCT at the given confidence level conf.level and depends on the type of alternative.

conf.int

The confidence interval for the estimates, it is NULL here, since we provide the UCL and LCL in matrix form.

cnf.lvl

Level of the upper and lower confidence limits (i.e., conf.level) of the NNCT entries.

estimate

Estimates of the parameters, i.e., matrix of the NNCT entries of the k \times k NNCT, Nij for i,j=1,2,...,k.

est.name, est.name2

Names of the estimates, former is a shorter description of the estimates than the latter.

null.value

Hypothesized null value for the expected values of the NNCT entries, E(Nij) for i,j=1,2,...,k.

null.name

Name of the null values

alternative

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

method

Description of the hypothesis test

ct.name

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

data.name

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

Author(s)

Elvan Ceyhan

References

Ceyhan E (2010). “On the use of nearest neighbor contingency tables for testing spatial segregation.” Environmental and Ecological Statistics, 17(3), 247-282.

Pielou EC (1961). “Segregation and symmetry in two-species populations as studied by nearest-neighbor relationships.” Journal of Ecology, 49(2), 255-269.

See Also

cell.spec.ct and cell.spec

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)

cell.spec.ss(Y,cls)
cell.spec.ss.ct(ct)
cell.spec.ss.ct(ct,alt="g")

cell.spec.ss(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)

cell.spec.ss(Y,fcls)
cell.spec.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)

cell.spec.ss(Y,cls,alt="l")
cell.spec.ss.ct(ct)
cell.spec.ss.ct(ct,alt="l")


[Package nnspat version 0.1.2 Index]