Probability Mass Poisson Mixture | R Documentation |
Gives the probability mass value of a univariate Poisson Mixture.
dpois_mix(x, pi, lambda, log = FALSE)
x |
value or vector of values, to apply in the mixture probability mass function. |
pi |
vector of mixture weights. |
lambda |
vector os parameters (means). |
log |
logical; if TRUE, probabilities p are given as log(p). |
Each component of the mixture has density
f_j(x) = (exp(- λ_j) * λ_j^(x))) / (x!)
where λ_j is the mean and the variance of the jth component. j = 1, 2, ..., g.
CASTRO, M. O.; MONTALVO, G. S. A.
f <- function(x){dpois_mix(x, c(0.5, 0.5), c(3, 8))} ## Plot using graphics package require(graphics) plot.function(f, 0, 10, type = "h") require(ggplot2) ## Plot using ggplot2 package x <- seq(0, 20, 1) aux <- data.frame(x, y = f(x)) ggplot(aux, aes(x=x)) + geom_point( aes(y=y) ) + geom_linerange(aes(ymax=y), ymin=0) + theme_minimal() ## Sum sum(f(0:10000))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.