r_gamma: Generate Gamma Distributed Values

Description Usage Arguments Value Examples

View source: R/built_in_distributions.R

Description

Generates a set of Gamma distributed values. Can be defined by one and only one of scale, rate or mean. This must be named in the call.

Usage

1
2
3
4
5
6
7
8
9
r_gamma(
  shape,
  ...,
  scale = 1,
  rate = NULL,
  mean = NULL,
  n = default_n(shape, scale, rate, mean),
  .seed = NULL
)

Arguments

shape

vector of shape parameters, strictly positive

...

Unused

scale

vector of scale parameters, cannot be specified with rate and mean, strictly positive

rate

vector of rate parameters, cannot be specified with scale and mean, strictly positive

mean

vector of mean parameters, cannot be specified with scale and rate, strictly positive

n

number of observations to generate. The default_n() function will provide a default value within context

.seed

One of the following:

  • NULL (default) will not change the current seed. This is the usual case for generating random numbers.

  • A numeric value. This will be used to set the seed before generating the random numbers. This seed will be stored with the results.

  • TRUE. A random seed value will be generated and set as the seed before the results are generated. Again, this will be stored with the results.

To extract the random seed from a previously generated set of values, use pull_seed()

Value

A numeric vector of length n

Examples

1
2
3
4
5
6
7
8
9
set_n(5)

r_gamma(10)

r_gamma(1:10, scale = 2)
r_gamma(1:10, rate = 1 / 2)
r_gamma(1:10, mean = 5)

r_gamma(10, n = 10)

rando documentation built on Feb. 16, 2021, 5:07 p.m.