powered by
Convert normal to gamma
norm2gamma(x, shape, rate = 1, scale = 1/rate, mu = mean(x), sd = stats::sd(x))
a vector with a gamma distribution
the normally distributed vector
gamma distribution parameter (must be positive)
an alternative way to specify the scale
the mean of x (calculated from x if not given)
the SD of x (calculated from x if not given)
x <- rnorm(10000) y <- norm2gamma(x, shape = 2) g <- ggplot2::ggplot() + ggplot2::geom_point(ggplot2::aes(x, y)) ggExtra::ggMarginal(g, type = "histogram")
Run the code above in your browser using DataLab