pdf, cdf, inverse cdf, and random deviates of the truncated gamma distribution.

rtgamma(n, shape, scale = 1, a = 0, b = Inf)

dtgamma(x, shape, scale = 1, a = 0, b = Inf)

ptgamma(q, shape, scale = 1, a = 0, b = Inf)

qtgamma(p, shape, scale = 1, a = 0, b = Inf)

Arguments

n

number of observations. If length(n) > 1, the length is taken to be the number required.

shape

vector of shape parameters.

scale

vector of scale parameters.

a

vector of lower truncation limits

b

vector of upper truncation limits

x, q

vector of quantiles.

p

vector of probabilities.

Value

dtgamma gives the density, ptgamma gives the distribution function, qtgamma gives the quantile function, and rtgamma generates random deviates.

Examples

rtgamma(5, 1, scale=2, a=0.5, b=3.0)
#> [1] 2.3297361 1.3663757 2.5706551 0.5007304 1.7825396
dtgamma(seq(0, 4, by=0.5), 1, scale=2, a=0.5, b=3.0)
#> [1] 0.0000000 0.7007756 0.5457646 0.4250419 0.3310229 0.2578009 0.2007756 #> [8] 0.0000000 0.0000000
ptgamma(seq(0, 4, by=0.5), 1, scale=2, a=0.5, b=3.0)
#> [1] 0.0000000 0.0000000 0.3100220 0.5514674 0.7395052 0.8859493 1.0000000 #> [8] 1.0000000 1.0000000
qtgamma(seq(0, 1, by=0.1), 1, scale=2, a=0.5, b=3.0)
#> [1] 0.5000000 0.6480457 0.8079325 0.9817205 1.1720593 1.3824362 1.6175722 #> [8] 1.8840822 2.1916467 2.5552586 3.0000000