Learn R Programming

mclust (version 4.1)

cdfMclust: Cumulative density function from mclustDensity estimation

Description

Computes the estimated CDF from a one-dimensional density estimation at points given by the optional argument data. If not provided, a regular grid of evalutaion points is used.

Usage

cdfMclust(object, data, ngrid = 100, ...)

Arguments

object
a densityMclust model object.
data
a numeric vector of evaluation points.
ngrid
the number of points in a regular grid to be used as evaluation points if no data are provided.
...
further arguments passed to or from other methods.

Value

  • Return a list of x and y values providing the evaluation points and the calculated CDF.

References

C. Fraley, A. E. Raftery, T. B. Murphy and L. Scrucca (2012). mclust Version 4 for R: Normal Mixture Modeling for Model-Based Clustering, Classification, and Density Estimation. Technical Report No. 597, Department of Statistics, University of Washington.

See Also

densityMclust, plot.densityMclust.

Examples

Run this code
x <- c(rnorm(100), rnorm(100, 3, 2))
dens <- densityMclust(x)
summary(dens, parameters = TRUE)
cdf <- cdfMclust(dens)
str(cdf)
plot(cdf, type = "l", xlab = "x", ylab = "CDF")

par(mfrow = c(2,2))
dens.waiting <- densityMclust(faithful$waiting)
plot(dens.waiting)
plot(cdfMclust(dens.waiting), type = "l", 
     xlab = dens.waiting$varname, ylab = "CDF")
dens.eruptions <- densityMclust(faithful$eruptions)
plot(dens.eruptions)
plot(cdfMclust(dens.eruptions), type = "l", 
     xlab = dens.eruptions$varname, ylab = "CDF")
par(mfrow = c(1,1))

Run the code above in your browser using DataLab