rgamma_vec: Vectorized 'rgamma()' Function

Description Usage Arguments Value See Also

View source: R/gamma-distr.R

Description

rgamma_vec() allows vector inputs for shape and rate. Unlike rgamma(), it always returns a tibble, not a vector, and does not accept a scale parameter (if you have a scale parameter, use 1/scale to get the rate). It also uses the notion of "size", rather than "length", but this difference is not likely to affect end users.

Usage

1
rgamma_vec(n, shape, rate = 1)

Arguments

n

Number of observations. If vec_size(n) > 1L, the size is taken to be the number required.

shape, rate

Shape and rate parameters for the gamma distribution. Both must be positive, scale strictly. Inputs of size 1 will be recycled, otherwise the sizes of shape and scale must match.

Value

A tibble of random deviates with n rows and columns corresponding to the values in the vectors supplied to shape, rate (named with the pattern gamma{i}, where i is the ith value in the recycled shape and rate vectors, padded by zeros to ensure consistent length).

See Also

rgamma()


jesse-smith/covidModel documentation built on Feb. 21, 2022, 3:23 p.m.