Arguments
- x
(
numeric
):
number of successes.- m
(
number
):
number of trials.- 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 of length K. Each element corresponds to the row of beta parameters inpar
.- log
(
flag
):
whether to return the log density value (not default).
Examples
dbetabinomMix(x = 2, m = 29, par = rbind(c(0.2, 0.4)), weights = 1)
#> [1] 0.04286893
dbetabinomMix(
x = 2, m = 29, par = rbind(c(0.2, 0.4), c(1, 1)),
weights = c(0.6, 0.4)
)
#> [1] 0.03905469
# x could be a vector
dbetabinomMix(
x = 1:28, m = 29, par = rbind(c(0.2, 0.4), c(1, 1)),
weights = c(0.6, 0.4)
)
#> [1] 0.05528364 0.03905469 0.03262435 0.02913070 0.02692943 0.02541875
#> [7] 0.02432428 0.02350253 0.02287111 0.02237947 0.02199510 0.02169642
#> [13] 0.02146890 0.02130287 0.02119218 0.02113354 0.02112613 0.02117171
#> [19] 0.02127484 0.02144381 0.02169209 0.02204123 0.02252632 0.02320728
#> [25] 0.02419467 0.02571821 0.02835573 0.03418074