Skip to contents

Computes \(Var(w_1 \mid a, b)\) using the law of total variance.

Usage

var_w1(a, b, M = .QUAD_NODES_DEFAULT)

Arguments

a

Numeric; shape parameter of the Gamma prior on \(\alpha\) (a > 0).

b

Numeric; rate parameter of the Gamma prior on \(\alpha\) (b > 0).

M

Integer; number of quadrature nodes. Default is 80.

Value

Numeric; \(Var(w_1)\).

Details

Uses the law of total variance: $$Var(w_1) = E[Var(w_1 | \alpha)] + Var(E[w_1 | \alpha])$$

where \(w_1 \mid \alpha \sim Beta(1, \alpha)\), so:

  • \(E(w_1 \mid \alpha) = 1/(1+\alpha)\)

  • \(Var(w_1 \mid \alpha) = \alpha / ((1+\alpha)^2(2+\alpha))\)

References

Lee, J. (2026). Design-Conditional Prior Elicitation for Dirichlet Process Mixtures. arXiv preprint arXiv:2602.06301.

Examples

var_w1(a = 2, b = 1)       # ~0.090
#> [1] 0.08968429
var_w1(a = 1.6, b = 1.22)  # ~0.105
#> [1] 0.1052062