bolker at ufl.edu
Tue Apr 15 20:53:35 CEST 2008
Matthew B. <mtthw.bt <at> gmail.com> writes:
> Dear R users,
> This is a basic question.
> I want to fit a Weibull distribution. fitdistr(data, "weibull") works and it
> is a maximum likelihood fitting. Is it a good method ? Or is it better to
> write a function for the log-likelihood and the gradient and to use a
> numerical routine ?
> Fitdistr works for uncensored data, but what can I use for censored (and
> uncensored) data ?
fitdistr() is just fine for simple data.
for censored data you will indeed have to make up
your own negative log-likelihood function, using
dweibull() for uncensored data and pweibull() for
censored data. You don't need to write a function
for the gradient (R will compute derivatives by
finite differences automatically) unless you are
very concerned with speed and stability.
You shouldn't need anything beyond pweibull,
dweibull, and optim (or mle in the stats4 package).
More information about the R-help