Density, cumulative distribution function and random generation for a Gamma distribution.
Value
numeric vector
Functions density_XXX and cdf_t return numeric vectors of same length as x.
Function random_XXX returns a numeric vector of length n.
Examples
# Probability density function for a Gamma distribution
z <-density_gamma(shape = 7.5, scale =0.5 , x=.001 * seq(0, 300, 1))
# Computing the probability that the random variable X following a Gamma distribution
# with shape 1 and scale 2 is lower than x
z<-cdf_gamma(shape = 1, scale = 2, x = 1:10)
z
#> [1] 0.3934693 0.6321206 0.7768698 0.8646647 0.9179150 0.9502129 0.9698026
#> [8] 0.9816844 0.9888910 0.9932621
# Generating a random vector with each component drawn from a Gamma distribution
# with shape 1 and scale 2
z<- random_gamma(shape = 1, scale = 2, n = 10)
z
#> [1] 3.9958291 0.2205384 1.7443444 3.7838676 0.6338022 1.5945063 2.8127889
#> [8] 0.3693649 0.8182073 4.7224755