[R] finite mixture model (2-component Weibull): plotting Weibull components?
Christian Hennig
chrish at stats.ucl.ac.uk
Thu Apr 30 13:26:19 CEST 2009
mclust doesn't do Weibull mixtures, only Gaussian ones (though you may
approximate a Weibull by several Gaussians). You may look up the flexmix
package, which either does it already or a method function can be provided
to do it.
There is also an example "fitting a mixture distribution" in Venables and
Ripley's MASS book with normals (including plotting the density), which
you could adapt for Weibull distributions by plugging in the
corresponding functions for the Weibull.
> (1) restrict the number of components to 2 .
Specify G=2 in mclust (if want to fit 2 Gaussians).
> (2) obtain and plot a component Weibull density
Generally, adding a Weibull mixture density to a plot works by
x <- seq(0,100,by=0.1)
# or whatever reasonable choice of x-values
lines(x,p*dweibull(x,s11,s12)+(1-p)*dweibull(x,s21,s22))
where p, s11, s12, s21, s22 are the mixture parameters.
Regards,
Christian
*** --- ***
Christian Hennig
University College London, Department of Statistical Science
Gower St., London WC1E 6BT, phone +44 207 679 1698
chrish at stats.ucl.ac.uk, www.homepages.ucl.ac.uk/~ucakche
More information about the R-help
mailing list