EoneD: Single variable Rejection Sampling

Description Usage Arguments Value Examples

Description

This function 'EoneD(f,N,lb,up)' shows the Expect value of the given pdf (with one r.v.) by using single variabel rejection sampling.

Usage

1
EoneD(f, N, lb, ub)

Arguments

f

the pdf that we are sampling from

N

the nimber of attempted samples.

lb

lower bound of support of f

ub

upper bound of support of f

Value

mean of given pdf (with one r.v.)

Examples

1
2
3
4
5
f<- function(x) dnorm(x,-10,2)
EoneD(f,10000, Inf, Inf)

f<- function(x) {ifelse(-1< x & x < 0, 2*(x+1), 0)}
EoneD(f,10000, -1, 0)

sissidong/4800-project documentation built on May 12, 2019, 8:45 a.m.