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

rtbeta(n, alpha, beta, a = 0, b = 1)

dtbeta(x, alpha, beta, a = 0, b = 1)

ptbeta(q, alpha, beta, a = 0, b = 1)

qtbeta(p, alpha, beta, a = 0, b = 1)

Arguments

n

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

alpha

vector of alpha parameters.

beta

vector of beta parameters.

a

vector of lower truncation limits

b

vector of upper truncation limits

x, q

vector of quantiles.

p

vector of probabilities.

Value

dtbeta gives the density, ptbeta gives the distribution function, qtbeta gives the quantile function, and rtbeta generates random deviates.

Examples

set.seed(1976) rtbeta(10, 3, 4, 0.2, 0.8)
#> [1] 0.6036615 0.3355847 0.2247411 0.6105732 0.2626993 0.5666752 0.5409814 #> [8] 0.2878658 0.4293177 0.5555083
dtbeta(0.5, 3, 4, 0.2, 0.7)
#> [1] 2.257268
qtbeta(0.1, 3, 4, 0.2, 0.9)
#> [1] 0.2620008
ptbeta(0.3, 3, 4, 0.2, 0.9)
#> [1] 0.1742624
rtbeta(5, 1, 2, a=0.5, b=0.9)
#> [1] 0.6530846 0.5356827 0.5407576 0.6728602 0.5787261
dtbeta(seq(0, 1, by=0.1), 1, 2, a=0.5, b=0.9)
#> [1] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 4.1666667 3.3333333 #> [8] 2.5000000 1.6666667 0.8333333 0.0000000
ptbeta(seq(0, 1, by=0.1), 1, 2, a=0.5, b=0.9)
#> [1] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.3750000 #> [8] 0.6666667 0.8750000 1.0000000 1.0000000
qtbeta(seq(0, 1, by=0.1), 1, 2, a=0.5, b=0.9)
#> [1] 0.5000000 0.5246054 0.5505559 0.5780995 0.6075717 0.6394449 0.6744236 #> [8] 0.7136436 0.7591681 0.8156091 0.9000000