rexp_mix: Random Generator of a Exponential Mixture

View source: R/rexp_mix.R

Random Exponential MixtureR Documentation

Random Generator of a Exponential Mixture

Description

Generates random samples of a univariate Exponential Mixture.

Usage

 rexp_mix(n, pi, rate, plot.it = TRUE, empirical = FALSE, col.pop = "red3",
          col.empirical = "navy", ...)

Arguments

n

number of observations.

pi

vector of mixture weights.

rate

vector of rate parameters.

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.

Author(s)

CASTRO, M. O.; MONTALVO, G. S. A.

Examples

## Generate a sample.
data = rexp_mix(n = 1000, pi = c(0.1, 0.9), rate = c(1, 1/1000))

## Sample vector.
data$sample
## The classification of each observation.
data$classification
## The histogram of the sample with population density curve.
data$plot

## Not plotting the graphic.
rexp_mix(n = 1000, pi = c(0.1, 0.9), rate = c(1, 1/1000), plot.it = FALSE)

## Adding the empirical curve to the graphic.
rexp_mix(n = 1000, pi = c(0.1, 0.9), rate = c(1, 1/1000), empirical = TRUE)

## Changing the color of the curves.
rexp_mix(n = 1000, pi = c(0.1, 0.9), rate = c(1, 1/1000), empirical = TRUE,
         col.pop = "blue", col.empirical = "green")

## Using "...".
rexp_mix(n = 1000, pi = c(0.1, 0.9), rate = c(1, 1/1000), breaks = 300)

matheuscastro43/finiteMix documentation built on March 30, 2022, 12:49 p.m.