SI.ISM: Important Sampling Method

Description Usage Arguments Value Examples

Description

Important Sampling Method

Usage

1
SI.ISM(h, g, G_inv, N, min_G = 0, max_G = 1)

Arguments

h

Density function to be integrated

g

Sampling density function

G_inv

The inverse function of sampling distribution function

N

The number of trials

min_G

The min value of G

max_G

The max value of G

Value

I

Approximated integration

Var

Estimated variance

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## To integrate exp(x) from -1 to 1
## Use the sampling density (3/2+x)/3
set.seed(0)
h <- function(x){
    exp(x)
}
N <- 100000
g <- function(x){return((3/2+x)/3)}
G_inv <- function(y){return(sqrt(6*y+1/4)-3/2)}
ISMresult <- SI.ISM(h,g,G_inv,N)
I3 <- ISMresult[[1]]
VarI3 <- ISMresult[[2]]

SI documentation built on May 2, 2019, 1:43 p.m.