Last chance! 50% off unlimited learning
Sale ends in
Probability mass function, distribution function and random generation for the reparametrized beta distribution.
dprop(x, size, mean, prior = 0, log = FALSE)pprop(q, size, mean, prior = 0, lower.tail = TRUE, log.p = FALSE)
qprop(p, size, mean, prior = 0, lower.tail = TRUE, log.p = FALSE)
rprop(n, size, mean, prior = 0)
vector of quantiles.
non-negative real number; precision or number of binomial trials.
mean proportion or probability of success on each trial;
0 < mean < 1
.
(see below) with prior = 0
(default)
the distribution corresponds to re-parametrized beta
distribution used in beta regression. This parameter needs
to be non-negative.
logical; if TRUE, probabilities p are given as log(p).
logical; if TRUE (default), probabilities are
vector of probabilities.
number of observations. If length(n) > 1
,
the length is taken to be the number required.
Beta can be understood as a distribution of
where
Notice that in pre-1.8.4 versions of this package, prior
was not settable
and by default fixed to one, instead of zero. To obtain the same results as in
the previous versions, use prior = 1
in each of the functions.
Ferrari, S., & Cribari-Neto, F. (2004). Beta regression for modelling rates and proportions. Journal of Applied Statistics, 31(7), 799-815.
Smithson, M., & Verkuilen, J. (2006). A better lemon squeezer? Maximum-likelihood regression with beta-distributed dependent variables. Psychological Methods, 11(1), 54-71.
x <- rprop(1e5, 100, 0.33)
hist(x, 100, freq = FALSE)
curve(dprop(x, 100, 0.33), 0, 1, col = "red", add = TRUE)
hist(pprop(x, 100, 0.33))
plot(ecdf(x))
curve(pprop(x, 100, 0.33), 0, 1, col = "red", lwd = 2, add = TRUE)
n <- 500
p <- 0.23
k <- rbinom(1e5, n, p)
hist(k/n, freq = FALSE, 100)
curve(dprop(x, n, p), 0, 1, col = "red", add = TRUE, n = 500)
Run the code above in your browser using DataLab