var.nnct: Variances of Cell Counts in an NNCT

View source: R/NNCTFunctions.R

var.nnctR 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 (\insertCitedixon:1994,dixon:NNCTEco2002,ceyhan:eest-2010,ceyhan:jkss-posthoc-2017;textualnnspat).

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

\insertAllCited

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)


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