oneDSAMPLE: Single variable rejection sampling

Description Usage Arguments Details Value Examples

Description

This function implements single variable rejection samping for rvs with bounded support and which have have bounded pdf. we expect N/maxf sample

Usage

1
oneDSAMPLE(f, N, lb, ub, maxf)

Arguments

f

the pdf that we are sampling from

N

the number of attempted samples

lb

the lower bound of support f

nb

the upper bound of support f

mxaf

bound on f

Details

Here are more details about the algorithm that we are using

Value

A vector containing samples from pdf

Examples

1
2
3
4
betaPDF <- function(x){
 ifelse(0<x&x <1, 2*x, 0)}
oneDSAMPLE(f = betaPDF, N=100, lb=0, ub = 1, maxf = 2)
hist(oneDSAMPLE(f = betaPDF, N=100, lb=0, ub = 1, maxf = 2))

loreinayg/4800project documentation built on May 29, 2019, 3:42 a.m.