norm2gamma: Convert normal to gamma

Description Usage Arguments Value Examples

View source: R/distribution_convertors.R

Description

Convert normal to gamma

Usage

1
norm2gamma(x, shape, rate = 1, scale = 1/rate, mu = mean(x), sd = stats::sd(x))

Arguments

x

the normally distributed vector

shape

gamma distribution parameter (must be positive)

rate

an alternative way to specify the scale

scale

gamma distribution parameter (must be positive)

mu

the mean of x (calculated from x if not given)

sd

the SD of x (calculated from x if not given)

Value

a vector with a gamma distribution

Examples

1
2
3
4
x <- rnorm(10000)
y <- norm2gamma(x, shape = 2)
g <- ggplot2::ggplot() + ggplot2::geom_point(ggplot2::aes(x, y))
ggExtra::ggMarginal(g, type = "histogram")

faux documentation built on Sept. 14, 2021, 1:08 a.m.