Learn R Programming

tidybayes (version 2.0.3)

lkjcorr_marginal: Marginal distribution of a single correlation from an LKJ distribution

Description

Marginal distribution for the correlation in a single cell from a correlation matrix distributed according to an LKJ distribution.

Usage

dlkjcorr_marginal(x, K, eta, log = FALSE)

plkjcorr_marginal(q, K, eta, lower.tail = TRUE, log.p = FALSE)

qlkjcorr_marginal(p, K, eta, lower.tail = TRUE, log.p = FALSE)

rlkjcorr_marginal(n, K, eta)

Arguments

x

vector of quantiles.

K

Dimension of the correlation matrix. Must be greater than or equal to 2.

eta

Parameter controlling the shape of the distribution

log

logical; if TRUE, probabilities p are given as log(p).

q

vector of quantiles.

lower.tail

logical; if TRUE (default), probabilities are \(P[X \le x]\) otherwise, \(P[X > x]\).

log.p

logical; if TRUE, probabilities p are given as log(p).

p

vector of probabilities.

n

number of observations. If length(n) > 1, the length is taken to be the number required.

Details

The LKJ distribution is a distribution over correlation matrices with a single parameter, \(\eta\). For a given \(\eta\) and a \(K \times K\) correlation matrix \(R\):

$$R \sim \textrm{LKJ}(\eta)$$

Each off-diagonal entry of \(R\), \(r_{ij}: i \ne j\), has the following marginal distribution (Lewandowski, Kurowicka, and Joe 2009):

$$\frac{r_{ij} + 1}{2} \sim \textrm{Beta}\left(\eta - 1 + \frac{K}{2}, \eta - 1 + \frac{K}{2}\right) $$

In other words, \(r_{ij}\) is marginally distributed according to the above Beta distribution scaled into \((-1,1)\).

References

Lewandowski, D., Kurowicka, D., & Joe, H. (2009). Generating random correlation matrices based on vines and extended onion method. Journal of Multivariate Analysis, 100(9), 1989--2001. 10.1016/j.jmva.2009.04.008.

See Also

parse_dist() and marginalize_lkjcorr() for parsing specs that use the LKJ correlation distribution and the stat_dist_slabinterval() family of stats for visualizing them.

Examples

Run this code
# NOT RUN {
library(dplyr)
library(ggplot2)

data.frame(prior = "lkjcorr_marginal(2, 3)") %>%
  parse_dist(prior) %>%
  ggplot(aes(y = prior, dist = .dist, args = .args)) +
  stat_dist_halfeyeh() +
  xlim(-1, 1) +
  xlab("Marginal correlation for LKJ(3) prior on 2x2 correlation matrix")

# }

Run the code above in your browser using DataLab