Description Usage Arguments Value Author(s) References See Also Examples
For K binary (Bernoulli) random variables X_1, ..., X_K, this function transforms the correlation measure of association C_ij between every pair (X_i, X_j) to the odds ratio O_ij where
C_ij = cov(X_i, X_j) / sqrt(var(X_i) * var(X_j))
and
O_ij = P(X_i = 1, X_j = 1) * P(X_i = 0, X_j = 0) / P(X_i = 1, X_j = 0) * P(X_i = 0, X_j = 1).
1 | Corr2Odds(corr, marg.probs)
|
corr |
A K x K matrix where the i-th row and the j-th column represents the correlation C_ij between variables i and j. |
marg.probs |
A vector with K elements of marginal probabilities where the i-th entry refers to P(X_i = 1). |
The function return a list with the correlations and the pairwise probabilities.
odds |
A matrix of the same dimension as |
pair.proba |
A matrix of the same dimension as |
Thomas Suesse.
Maintainer: Johan Barthelemy johan@uow.edu.au.
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.
Corr2Odds
for converting correlation to odds
ratio.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # correlation matrix from Qaqish et al. (2012)
cr <- matrix(c( 1.000, -0.215, 0.144, 0.107,
-0.215, 1.000, 0.184, 0.144,
0.144, 0.184, 1.000, 0.156,
0.107, 0.144, 0.156, 1.000), nrow = 4, ncol = 4, byrow = TRUE)
rownames(cr) <- colnames(cr) <- c("Parent1", "Parent2", "Sibling1", "Sibling2")
# hypothetical marginal probabilities
p <- c(0.2, 0.4, 0.6, 0.8)
# converting correlation to odds ratio and getting pairwise probabilities
or <- Corr2Odds(corr = cr, marg.probs = p)
print(or)
|
Loading required package: cmm
Loading required package: Rsolnp
Loading required package: numDeriv
$odds
Parent1 Parent2 Sibling1 Sibling2
Parent1 Inf 0.2824182 2.206206 2.201278
Parent2 0.2824182 Inf 2.206989 2.206206
Sibling1 2.2062060 2.2069892 Inf 2.181030
Sibling2 2.2012775 2.2062060 2.181030 Inf
$pair.proba
Parent1 Parent2 Sibling1 Sibling2
Parent1 0.20000000 0.03786878 0.1482181 0.1771200
Parent2 0.03786878 0.40000000 0.2841600 0.3482181
Sibling1 0.14821812 0.28416000 0.6000000 0.5105696
Sibling2 0.17712000 0.34821812 0.5105696 0.8000000
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.