Learn R Programming

mc2d (version 0.2.0)

BetaSubjective: The BetaSubjective Distribution

Description

Density, distribution function, quantile function and random generation for the "Beta Subjective" distribution

Usage

dbetasubj(x, 
  min,
  mode,
  mean,
  max, 
  log = FALSE)

pbetasubj(q, min, mode, mean, max, lower.tail = TRUE, log.p = FALSE )

qbetasubj(p, min, mode, mean, max, lower.tail = TRUE, log.p = FALSE )

rbetasubj(n, min, mode, mean, max )

pbetasubj(q, min, mode, mean, max, lower.tail = TRUE, log.p = FALSE)

qbetasubj(p, min, mode, mean, max, lower.tail = TRUE, log.p = FALSE)

rbetasubj(n, min, mode, mean, max)

Arguments

x, q

Vector of quantiles.

min

continuous boundary parameter min < max

mode

continuous parameter \(min < mode < max\) and \(mode \ne mean\).

mean

continuous parameter min < mean < max

max

continuous boundary parameter

log, log.p

Logical; if TRUE, probabilities p are given as log(p).

lower.tail

Logical; if TRUE (default), probabilities are \(P[X \le x]\) otherwise, \(P[X > x]\).

p

Vector of probabilities.

n

Number of observations.

Author

Yu Chen

Details

The Subjective beta distribution specifies a [stats::dbeta()] distribution defined by the minimum, most likely (mode), mean and maximum values and can be used for fitting data for a variable that is bounded to the interval \([min, max]\). The shape parameters are calculated from the mode value and mean parameters. It can also be used to represent uncertainty in subjective expert estimates.

Define $$mid=(min+max)/2$$ $$a_{1}=2*\frac{(mean-min)*(mid-mode)}{((mean-mode)*(max-min))}$$ $$a_{2}=a_{1}*\frac{(max-mean)}{(mean-min)}$$

The subject beta distribution is a [stats::dbeta()] distribution defined on the \([min, max]\) domain with parameter \(shape1 = a_{1}\) and \(shape2 = a_{2}\).

# Hence, it has density # $$f(x)=(x-min)^{(a_{1}-1)}*(max-x)^{(a_{2}-1)} / (B(a_{1},a_{2})*(max-min)^{(a_{1}+a_{2}-1)})$$

# The cumulative distribution function is # $$F(x)=B_{z}(a_{1},a_{2})/B(a_{1},a_{2})=I_{z}(a_{1},a_{2})$$ # where \(z=(x-min)/(max-min)\). Here B is the beta function and \(B_z\) is the incomplete beta function.

The parameter restrictions are: $$min <= mode <= max$$ $$min <= mean <= max$$ If \(mode > mean\) then \(mode > mid\), else \(mode < mid\).

Examples

Run this code
curve(dbetasubj(x, min=0, mode=1, mean=2, max=5), from=-1,to=6) 
pbetasubj(q = seq(0,5,0.01), 0, 1, 2, 5)
qbetasubj(p = seq(0,1,0.01), 0, 1, 2, 5)
rbetasubj(n = 1e7, 0, 1, 2, 5)

Run the code above in your browser using DataLab