Density Contaminated Normal Distribution | R Documentation |
Gives the density value of a univariate Contaminated Normal Distribution.
dcnorm(x, pi, mean, sd, gamma, log = FALSE)
x |
value or vector of values, to apply in the mixture probability density function. |
pi |
vector of mixture weights. |
mean |
value of mixture mean. |
sd |
value of parameter. |
gamma |
value of parameter. |
log |
logical; if TRUE, probabilities p are given as log(p). |
The mixture has density
f(x) = π_1 * N(mean, sd/sqrt(gamma)) + π_2 * N(mean, sd)
where N(mean, sd) is the density function of a Normal Distribution.
CASTRO, M. O.; MONTALVO, G. S. A.
f <- function(x){dcnorm(x, pi = c(0.7, 0.3), mean = 10, sd = 1, gamma = 3)} ## Plot using graphics package require(graphics) curve(f, 7, 13) require(ggplot2) ## Plot using ggplot2 package ggplot(data.frame(x=c(7, 13)), 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.