Skip to contents

[Experimental]

Calculates the CDF of the Beta-Mixture distribution.

Usage

pbetaMix(q, par, weights, lower.tail = TRUE)

Arguments

q

(number):
the abscissa.

par

(matrix):
the beta parameters matrix, with K rows and 2 columns, corresponding to the beta parameters of the K components.

weights

(numeric):
the mixture weights of the beta mixture prior which add up to 1.

lower.tail

(flag):
if TRUE (default), probabilities are P[X <= x], and otherwise P[X > x].

Value

The (one minus) cdf value

Note

q can be a vector.

Examples

pbetaMix(q = 0.3, par = rbind(c(0.2, 0.4)), weights = 1)
#> [1] 0.5947341

# Can get the one minus CDF values.
pbetaMix(q = 0.3, par = rbind(c(0.2, 0.4)), weights = 1, lower.tail = FALSE)
#> [1] 0.4052659

# With 2 mixture components
pbetaMix(
  q = 0.3, par = rbind(c(0.2, 0.4), c(1, 1)),
  weights = c(0.6, 0.4)
)
#> [1] 0.4768404

# Can also specify x as a vector.
pbetaMix(
  q = seq(0, 1, .01), par = rbind(c(0.2, 0.4), c(1, 1)),
  weights = c(0.6, 0.4)
)
#>   [1] 0.0000000 0.1788327 0.2090334 0.2302374 0.2474000 0.2622119 0.2754695
#>   [8] 0.2876164 0.2989265 0.3095818 0.3197098 0.3294035 0.3387328 0.3477521
#>  [15] 0.3565040 0.3650231 0.3733377 0.3814710 0.3894429 0.3972698 0.4049661
#>  [22] 0.4125442 0.4200147 0.4273871 0.4346696 0.4418696 0.4489937 0.4560478
#>  [29] 0.4630371 0.4699666 0.4768404 0.4836628 0.4904372 0.4971671 0.5038556
#>  [36] 0.5105056 0.5171196 0.5237003 0.5302499 0.5367707 0.5432648 0.5497340
#>  [43] 0.5561802 0.5626052 0.5690107 0.5753984 0.5817696 0.5881261 0.5944691
#>  [50] 0.6008001 0.6071205 0.6134317 0.6197349 0.6260315 0.6323228 0.6386100
#>  [57] 0.6448944 0.6511773 0.6574601 0.6637440 0.6700303 0.6763205 0.6826158
#>  [64] 0.6889178 0.6952279 0.7015477 0.7078787 0.7142227 0.7205813 0.7269564
#>  [71] 0.7333501 0.7397644 0.7462016 0.7526640 0.7591544 0.7656755 0.7722304
#>  [78] 0.7788226 0.7854559 0.7921344 0.7988628 0.8056463 0.8124910 0.8194036
#>  [85] 0.8263919 0.8334652 0.8406340 0.8479110 0.8553117 0.8628546 0.8705630
#>  [92] 0.8784664 0.8866030 0.8950244 0.9038019 0.9130404 0.9229032 0.9336724
#>  [99] 0.9459138 0.9611540 1.0000000