density.mixfitEM: The Density of Finite Mixture Models

Description Usage Arguments Details Value See Also Examples

View source: R/density.mixfitEM.R

Description

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

Usage

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

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.

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

See Also

mixfit

Examples

1
2
3
4
5
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)

mixR documentation built on June 1, 2021, 5:07 p.m.