Learn R Programming

mixR (version 0.2.1)

density.mixfitEM: The Density of Finite Mixture Models

Description

This function calculates the probability density of a finite mixture model.

Usage

# S3 method for mixfitEM
density(x, at, smoothness = 512, cut = 3.8, ...)

Value

This function returns a list of class densityEM, which contains the following items.

x

a scalar or a numeric vector of locations where densities are calculated.

y

a vector of the densities of the mixture model at the corresponding locations in x

comp

a matrix with columns representing the densities of each component in the mixture model at the corresponding locations in x

Arguments

x

an object of class mixfitEM

at

a scalar or a numeric vector of locations where densities are calculated

smoothness

a positive integer controlling the smoothness of the density curve (default 512). The higher this value is, the more locations of the mixture model the density is calculated.

cut

the number of standard deviations away the density is to be computed (default 3.8)

...

other arguments

Details

The function density.mixfitEM is the method of the generic function density for the class mixfitEM.

See Also

mixfit

Examples

Run this code
set.seed(102)
x <- rmixnormal(200, c(0.5, 0.5), c(2, 5), c(1, 0.7))
fit1 <- mixfit(x, ncomp = 2)
d1 = density(fit1)
d2 = density(fit1, at = 0)

Run the code above in your browser using DataLab