funs.auxcovtct | R Documentation |
Five functions: cov.2cells
, cov.cell.col
, covNijCk
, cov2cols
and covCiCj
These are auxiliary functions for computing covariances between entries in the TCT for the types I-IV
cell-specific tests. The covariances between T_{ij} values for i,j=1,…,k in the TCT require covariances
between two cells in the NNCT, between a cell and column sum, and between two column sums in the NNCT.
cov.2cells
computes the covariance between two cell counts N_{ij} and N_{kl} in an NNCT,
cov.cell.col
and covNijCk
are equivalent and they compute the covariance between cell count N_{ij}
and sum of column k, C_k,
cov2cols
and covCiCj
are equivalent and they compute the covariance between sums of two columns,
C_i and C_j.
The index arguments refer to which entry or column sum is intended in the NNCT.
The argument covN
must be the covariance between N_{ij} values which are obtained from NNCT by row-wise vectorization.
These covariances are valid under RL or conditional on Q and R under CSR.
cov.2cells(i, j, k, l, ct, covN) cov.cell.col(i, j, k, ct, covN) covNijCk(i, j, k, ct, covN) cov.2cols(i, j, ct, covN) covCiCj(i, j, ct, covN)
i, j, k, l |
Indices of the cell counts or column sums whose covariance is to be computed. All four are
needed for |
ct |
A nearest neighbor contingency table |
covN |
The k^2 \times k^2 covariance matrix of row-wise vectorized cell counts of NNCT, |
cov.2cells
returns the covariance between two cell counts N_{ij} and N_{kl} in an NNCT,
cov.cell.col
and covNijCk
return the covariance between cell count N_{ij}
and sum of column k, C_k,
cov2cols
and covCiCj
return the covariance between sums of two columns,
C_i and C_j.
Elvan Ceyhan
cov.tct
and cov.nnct
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.2cells(1,1,1,2,ct,covN) cov.cell.col(2,2,1,ct,covN) covNijCk(2,2,1,ct,covN) cov.2cols(2,1,ct,covN) covCiCj(2,1,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.2cells(2,3,1,2,ct,covN) cov.cell.col(1,1,2,ct,covN) covNijCk(1,1,2,ct,covN) cov.2cols(3,4,ct,covN) covCiCj(3,4,ct,covN)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.