Learn R Programming

algebraic.dist (version 0.9.1)

normal_approx: Moment-Matching Normal Approximation

Description

Constructs a normal (or multivariate normal) distribution that matches the mean and variance-covariance of the input distribution. This is useful as a quick Gaussian approximation for any distribution whose first two moments are available.

Usage

normal_approx(x)

Value

A normal distribution (for univariate inputs) or an mvn distribution (for multivariate inputs) with the same mean and variance-covariance as x.

Arguments

x

A dist object to approximate.

Examples

Run this code
# Approximate a Gamma(5, 2) with a normal
g <- gamma_dist(shape = 5, rate = 2)
n <- normal_approx(g)
mean(n)
vcov(n)

Run the code above in your browser using DataLab