Learn R Programming

BSagri (version 0.1-10)

CCRatio.default: Compute ratio contrasts of chains of joint empirical distributions.

Description

Compute ratio contrasts of chains of joint empirical distributions. For internal use.

Usage

CCRatio.default(x, cmat)

Arguments

x

an N times K matrix with numeric entries

cmat

a list with entries numC and denC, each containing a contrast matrix with K columns (must be the same K as in x!) and M rows (is your choice, the number of contrasts of interest)

Details

Denote the elements of x by \(x_{nk}\). Denote the numetator of cmat by \(C\) with elements \(c_{mk}\) and the denominator of cmat as \(D\) with elements \(d_{mk}\). Function CCRatio.default simply calculates $$\frac{\sum_{k=1}^{K}c_{mk}x_{nk}}{\sum_{k=1}^{K}d_{mk}x_{nk}}$$ for each m=1,...,M and n=1,...,N. The result is a N times M matrix.

Examples

Run this code
# NOT RUN {

X<-round(cbind(
 rnorm(10,1,1),
 rnorm(10,1,1),
 rnorm(10,1,1),
 rnorm(10,1,1)))

# and numerator and denominator
# x times 4 contrast matrix

NMAT<-rbind(
c(1,0,0,0),
c(1,0,0,0),
c(1,0,0,0)
)


DMAT<-rbind(
c(0,1,0,0),
c(0,0,1,0),
c(0,0,0,1)
)


CCRatio.default(x=X, cmat=list(numC=NMAT, denC=DMAT) )


# }

Run the code above in your browser using DataLab