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

Description Usage Arguments Value Note Author(s) References See Also Examples

Description

Computes a multivariate normal moment by Monte Carlo integration

Usage

1
2
## S3 method for class '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

Note

Non-central moments can be approximated by specifying Mean. For central moments, set Mean to a vector of 0s.

The mvtnorm package must be loaded for the function rmvnorm.

Author(s)

Kem Phillips <kemphillips@comcast.net>

References

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

See Also

callmultmoments and the methods toLatex and evaluate from symmoments

Examples

1
2
3
4
5
6
7
# 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))

Example output

Loading required package: mvtnorm
Loading required package: cubature
Loading required package: combinat

Attaching package:combinatThe following object is masked frompackage:utils:

    combn

Loading required package: multipol
Loading required package: abind

Attaching package:multipolThe following object is masked frompackage:stats:

    deriv

The following object is masked frompackage:base:

    single

[1] 156.8237

symmoments documentation built on March 26, 2020, 6:28 p.m.