1

I've been trying to fit a Gaussian Mixture Model (GMM) for a univariate distribution where each observation has an assigned weight (from 0 to 1).

Assigning weights can be easily done for the basic 'density' function (from 'stats'), but I could not do this for GMM packages as 'mixtools' or 'mclust'.

The latter even has a function for that - 'me.weighted' - exemplified in the link "http://cran.open-source-solution.org/web/packages/mclust/vignettes/mclust-weights.pdf", but I can't get it to work. Both in their example and in my data I get an error:

> fitnew <- do.call("me.weighted", c(list(data = X, weights = w), fit))

Error in me.weighted(data = list(Sepal.Length = c(5.1, 4.9, 4.7, 4.6,  : formal argument "data" matched by multiple actual arguments
mlegge
  • 6,763
  • 3
  • 40
  • 67
Brtx
  • 33
  • 4
  • 1
    Regarding the 'mclust' package, the maintainer was kind enough to point out that the call mentioned above should be: fitnew <- do.call("me.weighted", c(list(weights=w),fit)) I reckon since it is simply updating a previously existent model. – Brtx Feb 13 '15 at 19:31
  • the previous comment should be the accepted answer – Bakaburg Aug 21 '19 at 19:27

0 Answers0