Ndoye Abdoul aziz
2009-Apr-30 08:45 UTC
[R] finite mixture model (2-component Weibull): plotting Weibull components?
Dear Knowledgeable R Community Members, Please excuse my ignorance, I apologize in advance if this is an easy question, but I am a bit stumped and could use a little guidance. I have a finite mixture modeling problem -- for example, a 2-component Weibull mixture -- where the components have a large overlap, and I am trying to adapt the "mclust" package which concern to normal mixture to solve this problem. I need to decompose that mixture into its 2 components which will need to be plotted. What I don't know how to do is: (1) restrict the number of components to 2 . (2) obtain and plot a component Weibull density (Note: my real dataset will not have peaks this well separated, but I needed to find a small example.) Any information you might be able to shed on this would be very much appreciated With appreciation for your help. Thank you in advance Cordially; Abdoul Aziz Junior NDOYE GREQAM Marseille. [[alternative HTML version deleted]]
Christian Hennig
2009-Apr-30 11:26 UTC
[R] finite mixture model (2-component Weibull): plotting Weibull components?
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 densityGenerally, 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