Learn R Programming

nnspat (version 0.1.2)

cov.tct: Covariance Matrix of the Entries of the Type I-IV TCTs

Description

Returns the covariance matrix of the entries \(T_{ij}\) for \(i,j=1,\ldots,k\) in the TCT for the types I, III, and IV cell-specific tests. The covariance matrix is of dimension \(k^2 \times k^2\) and its entries are \(cov(T_{ij},T_{kl})\) when \(T_{ij}\) values are by default corresponding to the row-wise vectorization of TCT. The argument covN must be the covariance matrix of \(N_{ij}\) values which are obtained from the NNCT by row-wise vectorization. The functions cov.tctIII and cov.tct3 are equivalent. These covariances are valid under RL or conditional on \(Q\) and \(R\) under CSR.

See also (ceyhan:jkss-posthoc-2017;textualnnspat).

Usage

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

Value

The \(k^2 \times k^2\) covariance matrix of the entries \(T_{ij}\) for \(i,j=1,\ldots,k\) in the Type I-IV TCTs

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.

Author

Elvan Ceyhan

References

See Also

cov.nnct and cov.nnsym

Examples

Run this code
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)

cov.tct(ct,covN,type=1)
cov.tct(ct,covN,type="I")
cov.tct(ct,covN,type="II")
cov.tct(ct,covN,type="III")
cov.tct(ct,covN,type="IV")
cov.tctI(ct,covN)

cov.tct(ct,covN)
cov.tctIII(ct,covN)
cov.tct3(ct,covN)

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

cov.tct(ct,covN,type=3)
cov.tct(ct,covN,type="III")

cov.tctIII(ct,covN)
cov.tct3(ct,covN)

Run the code above in your browser using DataLab