[R] Beta fit returns NaNs

Peter Ehlers ehlers at ucalgary.ca
Mon Aug 1 11:16:43 CEST 2011


On 2011-08-01 01:33, baxy77 wrote:
> Hi,
>
> sorry for repeating the question but this is kind of important to me and i
> don't know whom should i ask.
>
> So as noted before when I do a parameter fit to the beta distr i get:
>
>
> fitdist(vectNorm,"beta");
> Fitting of the distribution ' beta ' by maximum likelihood
> Parameters:
>           estimate Std. Error
> shape1   2.148779  0.1458042
> shape2 810.067515 61.8608126
> Warning messages:
> 1: In dbeta(x, shape1, shape2, log) : NaNs produced
> 2: In dbeta(x, shape1, shape2, log) : NaNs produced
> 3: In dbeta(x, shape1, shape2, log) : NaNs produced
> 4: In dbeta(x, shape1, shape2, log) : NaNs produced
> 5: In dbeta(x, shape1, shape2, log) : NaNs produced
> 6: In dbeta(x, shape1, shape2, log) : NaNs produced
>
>
> Now im my vector has cca 900 points. are those 6 error messages some thing
> to be really concerned  or ???? what does it mean ??

Those warnings are from optim(). You probably don't have
to worry about them.

I usually use fitdistr() in the MASS package. But it
will require reasonable start values.

To avoid the warnings, you could try using the parameter
estimates from your fitdist(vectNorm, "beta") call as
start values and re-run fitdist() with those values,
and you might also set the optim method to BFGS
(which, BTW, is the default in fitdistr()).

  library(fitdistrplus)
  fitdist(vectNorm, "beta",
     start = list(shape1 = 2.15, shape2 = 810),
     optim.method = "BFGS")

Peter Ehlers

>
> --
> View this message in context: http://r.789695.n4.nabble.com/Beta-fit-returns-NaNs-tp3709139p3709139.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list