Description Usage Arguments Details Value References See Also Examples

Density, distribution function, quantile function and random generation for the
right truncated gamma distribution with shape (`shape`

), scale (`scale`

)
parameters and right truncation point (`truncation`

).

1 2 3 4 |

`x, q` |
vector of quantiles. |

`shape, scale` |
shape and scale parameters, must be positive. |

`truncation` |
right truncation point, must be positive. |

`log` |
logical; if TRUE, the log-density is returned. |

`lower.tail` |
logical; if TRUE (default), probabilities are |

`p` |
vector of probabilities. |

`n` |
number of observations. If |

If `scale`

or `truncation`

are not specified, they assume the default
values.

The right truncated gamma distribution with shape *a*, scale *b* and
right truncation point *t > 0* has density

*
f(x) = b^a/gamma(a,bt) exp(-bx)x^(a-1)
*

con *x < t* and *γ(a,b)* denotes the incomplete gamma function
(see Abramowitz and Stegun, 1970, pp. 260).

`dtgamma`

, `ptgamma`

, and `qtgamma`

are respectively the density,
distribution function and quantile function of the right truncated gamma distribution.
`rtgamma`

generates random deviates from the right truncated gamma distribution.

The length of the result is determined by `n`

for `rtgamma`

, and is
the maximum of the lengths of the numerical parameters for the other functions.

Abramowitz, M., and Stegun, I.A. (1970).
*Handbook of Mathematical Functions*.
Dover, New York.

Phillippe, A. (1997).
Simulation of right and left truncated gamma distribution by mixtures.
*Statistics and Computing* **7**, 173-181.

Distributions for other standard distributions.

1 2 3 4 5 6 7 8 9 10 11 | ```
x <- seq(0, 2, by = 0.1)
y <- dtgamma(x, shape = 1, truncation = 1)
z <- dgamma(x, shape = 1) # standard gamma pdf
plot(x, z, type = "l", xlab = "x", ylab = "density", ylim = range(y, z), lty = 2)
lines(x, y)
x <- rtgamma(1000, shape = 1)
## Q-Q plot for the right truncated gamma data against true theoretical distribution:
qqplot(qtgamma(ppoints(1000), shape = 1), x, main = "Truncated Gamma Q-Q plot",
xlab = "Theoretical quantiles", ylab = "Sample quantiles", font.main = 1)
abline(c(0,1), col = "red", lwd = 2)
``` |

```
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.