5

I'm trying to reproduce fitting a beta distribution in Go, given an input of floating-point rates:

rates = [0.20, 0.15, 0.002, 0.017, 0.181, 0.004, ...]

You can do this in R quite easily using fitdistrplus, which chooses reasonable starting values automatically, unlike the MASS package which "struggles":

x <- c(0.0955104277250779, 0.0782381918284555, 0.109683584625186, 
       0.10115721657354, 0.102377369846524, 0.0691699604743083,
       0.0940254652301665, 0.078494747777906, 0.0824474231569216,
       0.0886513916653852)

fit <- fitdist(x, "beta")

I am trying to figure out how to fit a beta distribution in Go though which is proving difficult, finding the right functions (stats isn't my strong suit).

I have heard I can use "method-of-moments" as starting values, but also having them automatically be decided would be nice if it works like that out of the box.

Tallboy
  • 12,847
  • 13
  • 82
  • 173

0 Answers0