var.nnct {nnspat}R Documentation

Variances of Cell Counts in an NNCT

Description

Returns the variances of cell counts N_{ij} for i,j=1,\ldots,k in the NNCT, ct in matrix form which is of the same dimension as ct. These variances are valid under RL or conditional on Q and R under CSR.

See also (Dixon (1994, 2002); Ceyhan (2010, 2017)).

Usage

var.nnct(ct, Q, R)

Arguments

ct

A nearest neighbor contingency table

Q

The number of shared NNs

R

The number of reflexive NNs (i.e., twice the number of reflexive NN pairs)

Value

A matrix of same dimension as, ct, whose entries are the variances of the cell counts in the NNCT with class sizes given as the row sums of ct. The row and column names are inherited from ct.

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.

Ceyhan E (2017). “Cell-Specific and Post-hoc Spatial Clustering Tests Based on Nearest Neighbor Contingency Tables.” Journal of the Korean Statistical Society, 46(2), 219-245.

Dixon PM (1994). “Testing spatial segregation using a nearest-neighbor contingency table.” Ecology, 75(7), 1940-1948.

Dixon PM (2002). “Nearest-neighbor contingency table analysis of spatial segregation for several species.” Ecoscience, 9(2), 142-151.

See Also

var.tct, var.nnsym, and cov.nnct

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

W<-Wmat(ipd)
Qv<-Qvec(W)$q
Rv<-Rval(W)
var.nnct(ct,Qv,Rv)

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

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

W<-Wmat(ipd)
Qv<-Qvec(W)$q
Rv<-Rval(W)
var.nnct(ct,Qv,Rv)


[Package nnspat version 0.1.2 Index]