Description Usage Arguments Details Author(s) Examples
Gives the density value of a univariate Exponential mixture.
1 |
x |
value or vector of values, to apply in the mixture probability density function. |
pi |
vector of mixture weights. |
rate |
vector of rate parameters. |
Each component of the mixture has density
f_j(x) = λ_j exp(-λ_j * x)
where λ_j is the rate paramter of the jth component. j = 1, 2, ..., g.
CASTRO, M. O.; MONTALVO, G. S. A.
1 2 3 4 5 6 7 8 9 10 11 12 13 | f <- function(x){dexp_mix(x, pi = c(0.1, 0.9), rate = c(1, 1/30))}
## Plot using graphics package
require(graphics)
curve(f, 0, 40)
require(ggplot2)
## Plot using ggplot2 package
ggplot(data.frame(x=c(0, 40)), 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.