[R] Weibull parameter estimation
Terry Therneau
therneau at mayo.edu
Thu Oct 23 15:34:58 CEST 2008
>
> I would like to fit weibull parameters using "Method of moments" in order to
> provide the inital values of the parameter to de function 'fitdistr' . I
> don`t have much experience with maths and I don't know how to do it.
>
> Can anyone please put me in the rigth direction?
>
A simple approach is to use survreg.
> library(survival)
> x <- rweibull(5000, shape=5, scale=pi)
> fit <- survreg(Surv(x) ~ 1, dist='weibull')
> summary(fit)
Value Std. Error z p
(Intercept) 1.14 0.0094 121.4 0
Log(scale) -1.61 0.0349 -46.1 0
Scale= 0.2
Weibull distribution
Loglik(model)= -499.2 Loglik(intercept only)= -499.2
Number of Newton-Raphson Iterations: 7
n= 500
> 1/fit$scale
[1] 5.001574
> exp(fit$coef)
(Intercept)
3.131531
The survreg function imbeds the Weibull in a larger location-scale framework,
leading to a different parameterization:
1/(rweibull "shape") = survreg "scale"
log(rweibull "scale") = survreg intercept
The results are the MLE, so you won't need to follow with fitdistr.
Terry Therneau
More information about the R-help
mailing list