Learn R Programming

nnspat (version 0.1.2)

cov.nnsym: Covariance Matrix of the Differences of the Off-Diagonal Cell Counts in an NNCT

Description

Returns the covariance matrix of the differences of the cell counts, \(N_{ij}-N_{ji}\) for \(i,j=1,\ldots,k\) and \(i \ne j\), in the NNCT, ct. The covariance matrix is of dimension \(k(k-1)/2 \times k(k-1)/2\) and its entries are \(cov(N_{ij}-N_{ji}, N_{kl}-N_{lk})\) where the order of \(i,j\) for \(N_{ij}-N_{ji}\) is as in the output of ind.nnsym(k). These covariances are valid under RL or conditional on \(Q\) and \(R\) under CSR.

The argument covN is the covariance matrix of \(N_{ij}\) (concatenated rowwise).

See also (dixon:1994,ceyhan:SWJ-spat-sym2014;textualnnspat).

Usage

cov.nnsym(covN)

Value

The \(k(k-1)/2 \times k(k-1)/2\) covariance matrix of the differences of the off-diagonal cell counts \(N_{ij}-N_{ji}\)

for \(i,j=1,\ldots,k\) and \(i \ne j\) in the NNCT, ct

Arguments

covN

The \(k^2 \times k^2\) covariance matrix of row-wise vectorized entries of NNCT

Author

Elvan Ceyhan

References

See Also

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

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

W<-Wmat(ipd)
Qv<-Qvec(W)$q
Rv<-Rval(W)
varN<-var.nnct(ct,Qv,Rv)
covN<-cov.nnct(ct,varN,Qv,Rv) #default is byrow

cov.nnsym(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.nnsym(covN)

Run the code above in your browser using DataLab