dgamma(x, shape, rate=1, scale, log=FALSE) pgamma(q, shape, rate=1, scale, lower.tail=TRUE, log.p=FALSE) qgamma(p, shape, rate=1, scale) rgamma(n, shape, rate=1, scale, bigdata=FALSE)
bdVector
of (positive) quantiles.
Missing values (
NA
s) are allowed.
bdVector
of (positive) quantiles.
Missing values (
NA
s) are allowed.
bdVector
of probabilities.
Missing values (
NA
s) are allowed.
length(n)
is larger than 1, then
length(n)
random values are returned.
p
or
q
or the number of
deviates generated.
shape
/
rate
, the variance is
shape
/
rate^2
, and the skewness is
2/sqrt(shape)
.
rate
,
often called beta.
If
scale
is supplied
and
rate
is not, then
rate = 1/scale
.
This is ignored if
rate
is supplied.
TRUE
, an object of type
bdVector
is returned.
Otherwise, a
vector
object is returned. This argument can be used only if the bigdata library section has been loaded.
TRUE
,
dgamma
will return
the log of the density, not the density itself.
TRUE
,
pgamma(x)
will return
P(X<=x)
, otherwise
P(X>x)
.
TRUE
,
pgamma
will return
the log of the probability, not the probability itself.
dgamma
),
probability (
pgamma
),
quantile (
qgamma
), or
random sample (
rgamma
)
for the gamma distribution with shape
shape
.
rgamma
causes creation of the dataset
.Random.seed
if it does
not already exist, otherwise its value is updated.
Elements of
q
or
p
that are missing will cause the corresponding
elements of the result to be missing.
The gamma distribution takes values on the positive real line.
Special cases of the gamma
are the exponential distribution and the chi-squared distributions
(see
Exponential
and
Chisquare
). Applications of the gamma include
queuing theory, inventory control and precipitation processes.
For
shape
less than
10^8
pgamma(q,shape)
is computed using formulae 6.5.31 and 6.5.32 of Abramowitz and Stegun (1970). For these values
of
shape
dgamma
is computed based
on the
lgamma
function. For larger
values of shape
pgamma
and
dgamma
use
a normal approximation, adjusted for skewness only. See formulae
26.2.48 and 26.1.32 of Abramowitz and Stegun. There may be slight discontinuities
in higher derivatives at
shape==10^8
.
For details on the uniform random number generator implemented in S-PLUS,
see the
set.seed
help file.
Johnson, N. L. and Kotz, S. (1970).
Continuous Univariate Distributions, vol. 1.
Houghton-Mifflin, Boston.
Gamma Distribution. In
Encyclopedia of Statistical Sciences.
S. Kotz and N. L. Johnson, eds.
See
family
for the family generating function
Gamma
used with the
glm
and
gam
functions. See
gamma
for the gamma function.
rgamma(20,10) # sample of 20 with shape parameter 10 pgamma(1.2, 1.5) # the probability that a value from the gamma # distribution with shape 1.5 is less than 1.2 x <- qgamma(seq(.001, .999, len = 100), 1.5) # compute a vector of quantiles # be sure that you have an open graphics window plot(x, dgamma(x, 1.5), type = "l") # density plot for shape 1.5