[R] Problems with fitdistr

Peter Ehlers ehlers at ucalgary.ca
Thu Jan 28 15:03:37 CET 2010


Do you have any zeros in your data?
fitdistr() will need start values (see the code),
but even with start values, optim() will have problems.

x <- rweibull(100, 2, 10)
fitdistr(x, "weibull")  ## no problem
fitdistr(c(0,x), "weibull")  ## your error message
fitdistr(c(0,x), "weibull",start=list(shape=2,scale=10))
   ## still an error message from optim()

  -Peter Ehlers

vikrant wrote:
> Hi,
> I want to estimate parameters of weibull distribution. For this, I am using
> fitdistr() function  in MASS package.But when I give fitdistr(c,"weibull") I
> get a Error as follows:- 
>      Error in optim(x = c(4L, 41L, 20L, 6L, 12L, 6L, 7L, 13L, 2L, 8L, 22L, 
> : 
>      non-finite value supplied by optim
> Any help or suggestions are most welcomed

-- 
Peter Ehlers
University of Calgary



More information about the R-help mailing list