rvsample: 4800shilin

Description Usage Arguments Details Value

Description

what does the function do: implements sampling from a continuous random variable.

Usage

1
rvsample(n, pdf, lb, ub, c)

Arguments

n

the number of samples

pdf

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

lb

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

ub

a numeric that is the upper bound of the random variable you wish to sample from m, so P(a <= X <= b) = 1.

c

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

Details

what does the function do: implements sampling from a continuous random variable.

Value

a random sample of size n from the rv with pdf provided to the function, using rejection sampling


final4800/4800shilin documentation built on May 24, 2019, 4:08 p.m.