[R] Weibull

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Apr 15 21:32:19 CEST 2008


For (possibly) censored data, survreg() in package survival can be used 
(just regress on a constant).  The parametrization is slightly different 
from [dpqr]weibull, but it is easy to do the translation.

On Tue, 15 Apr 2008, Ben Bolker wrote:

> 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).
>
>  Ben Bolker
>
> ______________________________________________
> 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.
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list