gamma3p: Gamma Distribution with Three Parameters

gamma3pR Documentation

Gamma Distribution with Three Parameters

Description

Probability density function (PDF), cummulative density function (CDF), quantile function and random generation for the Three-Parameter Gamma (gamma3p) distribution.

Usage

dgamma3p(x, shape = 1, rate = 1, scale = 1/rate, mu = 0, log = FALSE)

pgamma3p(
  q,
  shape = 1,
  rate = 1,
  scale = 1/rate,
  mu = 0,
  lower.tail = TRUE,
  log.p = FALSE
)

qgamma3p(
  p,
  shape = 1,
  rate = 1,
  scale = 1/rate,
  mu = 0,
  lower.tail = TRUE,
  log.p = FALSE
)

rgamma3p(n, shape = 1, rate = 1, scale = 1/rate, mu = 0)

Arguments

x, q

numeric vector

shape

shape parameter, or slope, defaulting to 1

scale

scale parameter, or characteristic life, defaulting to 1

mu

location parameter (numerical, default 0).

lower.tail

logical; if TRUE (default), probabilities are P[X<=x], otherwise, P[X > x]

log.p

logical; if TRUE, probabilities/densities p are returned as log(p).

n

number of observations

Details

It is important to mention that Gamma distribution is defined for x > 0 and, therefore, values x < 0 will yield probability zero. While to obtain negative random values with function rgamma3p is an indication that the location parameter \mu has not a valid value.

Value

Three-parameter PDF values for dgamma3p, three-parameter probability for pgamma3p, quantiles or three-parameter random generated values for rgamma3p.

Examples

set.seed(123) # set a seed for random generation
##  Sampling from the specified Gamma distribution
r <- rgamma3p(n = 1e5, shape = 1.4, scale = 3.7, mu = 0.9)

## The histogram and density
hist(r, 100, freq = FALSE, xlim = c(0, 20))
r1 <- seq(0, 20, by = 0.1)
lines(r1, dgamma3p(r1, shape = 1.4, scale = 3.7, mu = 0.9),
    col = "red"
)


genomaths/usefr documentation built on April 18, 2023, 3:35 a.m.