50% off | Unlimited Data & AI Learning

Last chance! 50% off unlimited learning

Sale ends in


mipfp (version 3.2.1)

Odds2PairProbs: Converting odds ratio to pairwise probability

Description

For K binary (Bernoulli) random variables X1, ..., XK, this function transforms the odds ratios measure of association Oij between every pair (Xi,Xj) to the pairwise probability P(Xi=1,Xj=1), where Oij is defined as Oij=P(Xi=1,Xj=1)P(Xi=0,Xj=0)P(Xi=1,Xj=0)P(Xi=0,Xj=1).

Usage

Odds2PairProbs(odds, marg.probs)

Arguments

odds

A K×K matrix where the i-th row and the j-th column represents the odds ratio Oij between variables i and j.

marg.probs

A vector with K elements of marginal probabilities where the i-th entry refers to P(Xi=1).

Value

A matrix of the same dimension as odds containing the pairwise probabilities

References

Lee, A.J. (1993). Generating Random Binary Deviates Having Fixed Marginal Distributions and Specified Degrees of Association The American Statistician 47 (3): 209-215.

Qaqish, B. F., Zink, R. C., and Preisser, J. S. (2012). Orthogonalized residuals for estimation of marginally specified association parameters in multivariate binary data. Scandinavian Journal of Statistics 39, 515-527.

See Also

Corr2PairProbs for converting the correlation to pairwise probability.

Examples

Run this code
# NOT RUN {
# from Qaqish et al. (2012)
or <- matrix(c(Inf, 0.281, 2.214, 2.214,
               0.281, Inf, 2.214, 2.214,
               2.214, 2.214, Inf, 2.185,
               2.214, 2.214, 2.185, Inf), nrow = 4, ncol = 4, byrow = TRUE)
rownames(or) <- colnames(or) <- c("Parent1", "Parent2", "Sibling1", "Sibling2")

# hypothetical marginal probabilities
p <- c(0.2, 0.4, 0.6, 0.8)

# getting the pairwise probabilities
pp <- Odds2PairProbs(odds = or, marg.probs = p)
print(pp)
# }

Run the code above in your browser using DataLab