View source: R/distribution_convertors.R
norm2gamma | R Documentation |
Convert normal to gamma
norm2gamma(x, shape, rate = 1, scale = 1/rate, mu = mean(x), sd = stats::sd(x))
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) |
a vector with a gamma distribution
x <- rnorm(10000)
y <- norm2gamma(x, shape = 2)
g <- ggplot2::ggplot() + ggplot2::geom_point(ggplot2::aes(x, y))
ggExtra::ggMarginal(g, type = "histogram")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.