funs.auxcovtct {nnspat} | R Documentation |
Auxiliary Functions for Computing Covariances Between Cell Counts in the TCT
Description
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 values for
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 and
in an NNCT,
cov.cell.col
and covNijCk
are equivalent
and they compute the covariance between cell count
and sum of column
,
,
cov2cols
and covCiCj
are equivalent
and they compute the covariance between sums of two columns,
and
.
The index arguments refer to which entry or
column sum is intended in the NNCT.
The argument
covN
must be the covariance
between values which are obtained
from NNCT by row-wise vectorization.
These covariances are valid under RL or
conditional on
and
under CSR.
Usage
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)
Arguments
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 |
Value
cov.2cells
returns the covariance
between two cell counts and
in an NNCT,
cov.cell.col
and covNijCk
return the covariance between cell count
and sum of column
,
,
cov2cols
and covCiCj
return the covariance between sums of two columns,
and
.
Author(s)
Elvan Ceyhan
See Also
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)
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)