| Density Weibull Mixture | R Documentation |
Gives the density value of a univariate Weibull Mixture.
dweibull_mix(x, pi, shape, scale, log = FALSE)
x |
value or vector of values, to apply in the mixture probability density function. |
pi |
vector of mixture weights. |
shape |
shape parameters. |
scale |
scale parameters. |
log |
logical; if TRUE, probabilities p are given as log(p). |
Each component of the mixture has density
f_j(x) = (shape_j/scale_j) * (x/scale_j)^(shape_j - 1) * exp(-(x/scale_j)^shape_j)
where shape_j and scale_j are the parameters of the jth component. j = 1, 2, ..., g.
CASTRO, M. O.; MONTALVO, G. S. A.
f <- function(x){dweibull_mix(x, pi = c(0.8, 0.2), shape = c(1, 3), scale = c(5, 2))}
## Plot using graphics package
require(graphics)
curve(f, 0, 25)
require(ggplot2)
## Plot using ggplot2 package
ggplot(data.frame(x=c(0, 25)), aes(x)) +
stat_function(fun=f, size = 1L, colour = "#0c4c8a") +
theme_minimal()
## Integrate
integrate(f, 0, "Inf")$value
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.