var.tct: Variances of Entries in a TCT

View source: R/NNCTFunctions.R

var.tctR Documentation

Variances of Entries in a TCT

Description

Returns the variances of T_{ij} values for i,j=1,…,k in the TCT in matrix form which is of the same dimension as TCT for types I-IV tests. The argument covN must be the covariance between N_{ij} values which are obtained from the NNCT by row-wise vectorization. type determines the type of the test for which variances are to be computed, with default="III". These variances are valid under RL or conditional on Q and R under CSR.

See also (\insertCiteceyhan:SJScorrected2010,ceyhan:jkss-posthoc-2017;textualnnspat).

Usage

var.tct(ct, covN, type = "III")

Arguments

ct

A nearest neighbor contingency table

covN

The k^2 \times k^2 covariance matrix of row-wise vectorized cell counts of NNCT, ct.

type

The type of the cell-specific test, default="III". Takes on values "I"-"IV" (or equivalently 1-4, respectively.

Value

A matrix of same dimension as, ct, whose entries are the variances of the entries in the TCT for the corresponding type of cell-specific test. The row and column names are inherited from ct.

Author(s)

Elvan Ceyhan

References

\insertAllCited

See Also

var.nnct, var.tctI, var.tctIII, var.tctIV and cov.tct

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)

var.tct(ct,covN,"I")
var.tct(ct,covN,2)
var.tct(ct,covN,"III")
var.tct(ct,covN,"IV")

#############
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)
varN<-var.nnct(ct,Qv,Rv)

covN<-cov.nnct(ct,varN,Qv,Rv)

var.tct(ct,covN,"I")
var.tct(ct,covN,2)


nnspat documentation built on Aug. 30, 2022, 9:06 a.m.