| ugamma | R Documentation |
Density, distribution function, quantile function, and random generation for the
unit gamma distribution parameterized in terms of mean (mu) and dispersion sigma
parameters.
dugamma(x, mu, sigma, log.p = FALSE)
pugamma(q, mu, sigma, lower.tail = TRUE)
qugamma(p, mu, sigma, lower.tail = TRUE)
rugamma(n, mu, sigma)
x, q |
vector of quantiles. |
mu |
vector of means, taking values on (0, 1). |
sigma |
vector of dispersion parameters, taking values on (0, 1). |
log.p |
logical; if TRUE, probabilities |
lower.tail |
logical; if |
p |
vector of probabilities. |
n |
number of random values to return. |
A continuous random variable Y is said to follow a unit gamma distribution with mean
\mu and dispersion parameter \sigma if its probability density function is given by
f(y; \mu,\sigma) = \dfrac{y^{d(\mu,\sigma) - 1} d(\mu,\sigma)^{1/\sigma^2-1}}{\Gamma\left(\dfrac{1}{\sigma^2}-1\right)}\left\{\log \left(\frac{1}{y}\right) \right\}^{1/\sigma^2-2}, \quad y \in (0, 1),
where
d(\mu,\sigma)=\frac{\mu^{\sigma^2/(1-\sigma^2)}}{1-\mu^{\sigma^2/(1-\sigma^2)}},
for \mu, \sigma \in (0, 1).
dugamma returns the probability function, pugamma
gives the distribution function, qugamma gives the quantile function,
and rugamma generates random observations.
Rodrigo M. R. de Medeiros <rodrigo.matheus@live.com>
## Probability density function for some combinations of
## the parameter values
curve(dugamma(x, 0.25, 0.5), col = 1, ylim = c(0, 4), ylab = "Density")
curve(dugamma(x, 0.3, 0.5), col = 2, add = TRUE)
curve(dugamma(x, 0.5, 0.5), col = 3, add = TRUE)
curve(dugamma(x, 0.6, 0.5), col = 4, add = TRUE)
curve(dugamma(x, 0.73, 0.5), col = 6, add = TRUE)
legend("topleft", c(expression(mu == 0.25~","~ sigma==0.5),
expression(mu == 0.30~","~ sigma==0.5),
expression(mu == 0.50~","~ sigma==0.5)),
lty = 1, col = 1:3, bty = "n")
legend("top", c(expression(mu == 0.60~","~ sigma==0.5),
expression(mu == 0.73~","~ sigma==0.5)),
lty = 1, col = c(4, 6), bty = "n")
## Random generation
y <- rugamma(1000, 0.25, 0.5)
hist(y, prob = TRUE, col = "white")
curve(dugamma(x, 0.25, 0.5), col = "blue", add = TRUE, lwd = 2)
plot(ecdf(y), col = "grey")
curve(pugamma(x, 0.25, 0.5), col = "blue", add = TRUE)
plot(ppoints(1000), quantile(y, probs = ppoints(1000)),
xlab = "p", ylab = expression(p-"Quantile"), pch = 16, col = "grey")
curve(qugamma(x, 0.25, 0.5), col = "blue", add = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.