Learn R Programming

algebraic.dist (version 0.9.1)

rmap.mvn: Computes the distribution of g(x) where x is an mvn object.

Description

By the invariance property, if x is an mvn object, then under the right conditions, asymptotically, g(x) is an MVN distributed, g(x) ~ normal(g(mean(x)), sigma) where sigma is the variance-covariance of g(x)

Usage

# S3 method for mvn
rmap(x, g, n = 10000L, ...)

Value

An mvn distribution fitted to the transformed samples.

Arguments

x

The mvn object to apply g to

g

The function to apply to x

n

number of samples to take to estimate distribution of g(x) if method is mc or empirical. Defaults to 10000.

...

additional arguments to pass into the g function.

Examples

Run this code
# \donttest{
X <- mvn(c(1, 2), diag(2))
set.seed(42)
Y <- rmap(X, function(x) x^2)
mean(Y)
# }

Run the code above in your browser using DataLab