density.mixfitEM {mixR} | R Documentation |
The Density of Finite Mixture Models
Description
This function calculates the probability density of a finite mixture model.
Usage
## S3 method for class 'mixfitEM'
density(x, at, smoothness = 512, cut = 3.8, ...)
Arguments
x |
an object of class |
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 |
comp |
a matrix with columns representing the densities of each component in the mixture model at the corresponding locations in |
See Also
Examples
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)