rgamma0: Simulate gamma random variates

Description Usage Arguments Note Examples

View source: R/mc_rv_simulation.R

Description

Simulate gamma random variates

Usage

1
rgamma0(n, shape, scale, method = "inv_tf")

Arguments

n

Positive integer; the number of samples.

shape

Positive number; the shape of the gamma distribution.

scale

Positive number; the scale of the gamma distribution.

method

'base' or 'inv_tf'; 'base' refers to 'stats::rgamma' while 'inv_tf' refers to inverse transform.

Note

Inverse transform is slower, but it is provided to remedy that base R uses two algorithms to simulate gamma random variables in different parameter regions, which creates a discontinuity in the pathwise derivative.

Examples

1
2
n <- 10
rgamma0(n, shape = 1, scale = 1)

ADtools documentation built on Nov. 9, 2020, 5:09 p.m.