Skip to contents

Computes \(\mathrm{Var}(X)\) for \(X \sim \mathrm{MHN}(\alpha, \beta, \gamma)\).

Usage

mhn_var(alpha, beta, gamma)

Arguments

alpha

Shape parameter (\(\alpha > 0\)), a single number.

beta

Rate-type parameter (\(\beta > 0\)), the coefficient of the Gaussian tail \(\exp(-\beta x^2)\); larger values pull mass toward zero. A single number.

gamma

Tilt parameter (\(\gamma \in R\)), the coefficient of the exponential tilt \(\exp(\gamma x)\). A single number.

Value

A numeric scalar.

Details

Uses the formula (Sun et al. 2023, Lemma 2c) $$\mathrm{Var}(X) = \frac{\alpha}{2\beta} + E(X)\left(\frac{\gamma}{2\beta} - E(X)\right)$$ where it is accurate. Where it would lose accuracy, under a strong tilt \(z = \gamma/\sqrt{\beta}\) of either sign and at a large \(\alpha\) unless \(\gamma = 0\), the variance is instead obtained by numerical integration of the unnormalised density.

For \(\alpha \ge 1\), the variance satisfies \(\mathrm{Var}(X) \le 1/(2\beta)\) (Sun et al., 2023, Lemma 4c).

The function is not vectorised in its parameters: alpha, beta and gamma must each be a single number. To evaluate several parameter triples, use mapply, as in the examples.

The numerical methods are described in Appendix A of vignette("theory", package = "mhn").

References

Sun, J., Kong, M., & Pal, S. (2023). The Modified-Half-Normal distribution: Properties and an efficient sampling scheme. Communications in Statistics - Theory and Methods, 52(5), 1591–1613. (Lemmas 2c and 4c)

See also

Examples

mhn_var(alpha = 2, beta = 1, gamma = 0)
#> [1] 0.2146018
mapply(mhn_var, alpha = c(0.5, 2, 5), beta = 1, gamma = c(-1, 0, 3))
#> [1] 0.07828276 0.21460184 0.35382586