Skip to content

Beta fit returns NaNs

4 messages · baxy77, Peter Dalgaard, Peter Ehlers

#
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 ?? 

--
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.
#
On Aug 1, 2011, at 10:33 , baxy77 wrote:

            
They are probably harmless. It just means that in the search of the parameter space, the fitting algorithm ventured into forbidden territory (most likely, it tried a negative value for one of the shape parameters). You could try setting start= to something closer to  the final estimates and see if the warnings go away.

BTW: I assume this is using the fitdistrplus contributed package (and not just misspelling fitdistr from MASS)? You really should specify such things -- to make it easier for people to help, but also out of courtesy to the author.

-pd
#
On 2011-08-01 01:33, baxy77 wrote:
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