num_int: Monte Carlo Integration

Description Usage Arguments Details Value Author(s) References Examples

View source: R/numint.r

Description

This function performes numerical integration using monte carlo integration

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
num_int(fn, ..., a, b, N = 100, ncores = 1, cl = NULL)

numint(fn, ..., a, b, N = 100, ncores = 1, cl = NULL)

## S3 method for class 'numint'
plot(x, y = NULL, main = "Monte Carlo Integration",
  col = blues9[4], ...)

## S3 method for class 'numint'
print(x, ...)

Arguments

fn

A function

...

Further arguments to be passed to -fn-

a

Numeric vector. Lower bound

b

Numeric vector. Upper bound

N

Integer scalar. Sample size

ncores

Integer scalar. Number of cores (parallel)

cl

An object of class cluster

x

An object of class numint

y

Ignored

main

Title

col

Color

Details

code, emph, igraph, igraph pi

Value

An object of class

Author(s)

George

References

Weisstein, Eric W. "Monte Carlo Integration." From MathWorld–A Wolfram Web Resource. http://mathworld.wolfram.com/MonteCarloIntegration.html

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Simple example -------
ans <- num_int(dnorm, mean = .5, a = -6, b = 7, N = 1e3)

# Multiple proc -----
## Not run: 

ans <- num_int(dnorm, mean = .5, a = -6, b = 7, N = 1e8,
ncores = 20)


## End(Not run)

gvegayon/numint documentation built on June 21, 2017, 1:20 a.m.