covNrow2col: Conversion of the Covariance Matrix of the Row-wise...

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/NNCTFunctions.r

Description

Converts the k^2 \times k^2 covariance matrix of row-wise vectorized cell counts N_{ij} for i,j=1,…,k in the NNCT, ct to the covariance matrix of column-wise vectorized cell counts. In the output, the covariance matrix entries are cov(N_{ij},N_{kl}) when N_{ij} values are corresponding to the column-wise vectorization of ct. These covariances 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

1

Arguments

covN

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

Value

The k^2 \times k^2 covariance matrix of column-wise vectorized cell counts N_{ij} for i,j=1,…,k in the NNCT, ct.

Author(s)

Elvan Ceyhan

References

\insertAllCited

See Also

cov.nnct

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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)

covNrow<-cov.nnct(ct,varN,Qv,Rv)
covNcol1<-cov.nnct(ct,varN,Qv,Rv,byrow=FALSE)
covNcol2<-covNrow2col(covNrow)

covNrow
covNcol1
covNcol2

all.equal(covNcol1,covNcol2)

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

covNrow<-cov.nnct(ct,varN,Qv,Rv)
covNcol1<-cov.nnct(ct,varN,Qv,Rv,byrow=FALSE)
covNcol2<-covNrow2col(covNrow)

covNrow
covNcol1
covNcol2

all.equal(covNcol1,covNcol2)

#1D data points
n<-20  #or try sample(1:20,1)
X<-as.matrix(runif(n))# need to be entered as a matrix with one column
#(i.e., a column vector), hence X<-runif(n) would not work
ipd<-ipd.mat(X)
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)
Qv<-Qvec(W)$q
Rv<-Rval(W)
varN<-var.nnct(ct,Qv,Rv)
cov.nnct(ct,varN,Qv,Rv)

nnspat documentation built on May 10, 2021, 9:06 a.m.