norm2gamma {faux}R Documentation

Convert normal to gamma

Description

Convert normal to gamma

Usage

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


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


[Package faux version 1.2.1 Index]