Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: estimating parameters of Weibull distribution

From (Roberto G. Gutierrez, StataCorp.)
Subject   Re: st: estimating parameters of Weibull distribution
Date   Fri, 21 Feb 2003 14:48:23 -0600

Clint Thompson <> asks:

> I need to estimate both parameters from the Weibull distribution (beta &
> theta) using the maximum likelihood estimation method.  I have referenced
> the reference manual and it assumes that I am using a specific data set with
> a Weibull distribution but I need the estimates using the general Weibull
> pdf.  I also want to estimate the variance-covariance matrix of the MLEs.
> Any suggestions (aside from computing it by hand)?

Very easy in Stata 8.

Clint can fit a Weibull model without covariates on his univariate data and
then use -nlcom- to remap the estimates to those from a more "typical" Weibull
pdf.  For example, if the pdf in question is

         f(t) = theta/beta * t^(theta-1) * exp(-t^theta/beta)

and if one fits the Weibull model using the default proportional hazards (PH)
parameterization, then the remapping would take place as follows:

. webuse cancer

. stset studytime  /* studytime is the univariate response, no censoring */

. streg, dist(weibull) nolog nohr

(output omitted)

. nlcom (theta:exp([ln_p]_b[_cons])) (beta:exp(-_b[_cons]))

       theta:  exp([ln_p]_b[_cons])
        beta:  exp(-_b[_cons])

          _t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
       theta |   1.518202   .1766894     8.59   0.000     1.171897    1.864506
        beta |   74.91051   42.54283     1.76   0.078    -8.471904    158.2929

The estimated variance covariance matrix (VCE) of the remapping is returned
in r(V). 

. mat list r(V)

symmetric r(V)[2,2]
           theta       beta
theta  .03121916
 beta  7.2700449  1809.8925

As for a pre-Stata 8 solution, Clint would have to use -testnl- to obtain 
the derivative matrix and perform the delta method matrix calculations himself.
A bit more prone to error, hence the motivation for -nlcom-.

*   For searches and help try:

© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index