symmoments (version 1.2)

simulate.moment: Method to compute a multivariate moment using Monte Carlo integration

Description

Computes a multivariate normal moment by Monte Carlo integration

Usage

# S3 method for moment
simulate(object,nsim,seed,Mean,Sigma,...)

Arguments

object

object of class 'moment' representing E[X1**k1,...,Xn**kn]

nsim

the number of samples to generate in computing the integral

seed

integer for random number generator (set.seed)

Mean

the mean of (X1,...,Xn)

Sigma

covariance of (X1**k1,...,Xn**kn), dimension nXn, expressed as a vector by row

...

Included only for consistency with generic function

Value

Approximate value of the moment

References

Rizzo ML (2008). Statistical Computing with R. Chapman & Hall/CRC

See Also

callmultmoments and the methods toLatex and evaluate from symmoments

Examples

Run this code
# NOT RUN {
# Using 10000 samples, estimate the central moment for the moment c(2,4) at the covariance matrix
#  2 1
#  1 4

# and mean (0,0)
library(mvtnorm)
simulate(callmultmoments(c(2,4)),10000,NULL,c(0,0),c(2,1,1,4))
# }

Run the code above in your browser using DataCamp Workspace