| Random Contaminated Normal Distribution | R Documentation |
Generates random samples of a univariate Contaminated Normal Distribution.
rcnorm(n, pi, mean, sd, gamma, plot.it = TRUE, empirical = FALSE, col.pop = "red3",
col.empirical = "navy", ...)
n |
number of observations. |
pi |
vector of mixture weights. |
mean |
value of mixture mean. |
sd |
value of standard deviation parameter. |
gamma |
value of gamma parameter. |
plot.it |
logical; if TRUE (default), plot the histogram with estimated distribution curve. |
empirical |
logical; if TRUE, add the empirical curve ("Kernel Density Estimation") in the plot. |
col.pop |
a colour to be used in the curve of population density. |
col.empirical |
a colour to be used in the curve of empirical density. |
... |
further arguments and graphical parameters passed to hist. |
CASTRO, M. O.; MONTALVO, G. S. A.
## Generate a sample.
data = rcnorm(n = 1000, pi = c(0.6, 0.4), mean = 10, sd = 1, gamma = 3)
## Sample vector.
data$sample
## The histogram of the sample with population density curve.
data$plot
## Not plotting the graphic.
rcnorm(n = 1000, pi = c(0.6, 0.4), mean = 10, sd = 1, gamma = 3, plot.it = FALSE)
## Adding the empirical curve to the graphic.
rcnorm(n = 1000, pi = c(0.6, 0.4), mean = 10, sd = 1, gamma = 3, plot.it = TRUE,
empirical = TRUE)
## Changing the color of the curves.
rcnorm(n = 1000, pi = c(0.6, 0.4), mean = 10, sd = 1, gamma = 3, plot.it = TRUE,
empirical = TRUE, col.pop = "blue", col.empirical = "green")
## Using "...".
rcnorm(n = 1000, pi = c(0.6, 0.4), mean = 10, sd = 1, gamma = 3, breaks = 300)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.