rejectionsample: Rejection Sampling

Description Usage Arguments Value

Description

This is a function that peforms rejection sampling from a given pdf

Usage

1
rejectionsample(n, pdf, a, b, C)

Arguments

n

The number of samples

pdf

A function that is the pdf of the random variable that you wish to sample from

a

a numeric that is the lower bound of the random variable you wish to sample from

b

a numeric that is the upper bound of the random variable you with to sample from

C

a numeric that is such that f(x) <= C for all values of x

Value

Samples of length n from the given pdf


Nathan-Cheung/ProbabilityProject documentation built on May 31, 2019, 5:40 a.m.