psi2var {binarySimCLF}R Documentation

From Odds Ratio To Covariance

Description

Takes a vector of pairwise odds ratio (in lexicographic order) and gives an equivalent covariance matrix.

Usage

psi2var(psi, mu)

Arguments

psi Vector of pairwise odds ratio.
mu Mean vector.

Details

If we have a cluster of size 4, then the psi vector must have elements of the form [psi_{12}, psi_{13}, psi_{14}, psi_{23}, .., psi_{34}]^T.

Value

Returns an equivalent covariance matrix.

Examples

    # Example
    r = toeplitz(c(1, 0.45, 0.37));
    mu = c(0.25, 0.32, 0.32); mu

    # Checks to see whether the specified mean and correlation matrix are compatible.
    # The correlation parameters are restricted by functions of the pairwise odds
    # ratio.
    cp = chkBinC(r,mu);cp

    # If r and mu are compatible, compute the covariance matrix.
    if(cp$compat) { v = cor2var(r,mu);v }

    # Computes the pairwise odds ratio.
    or <- var2psi(v,mu); or

    # Converts from the pairwise odds ratio to the covariance matrix.
    psi2var(or$psi, mu)

[Package binarySimCLF version 1.0 Index]