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

RE: st: estimating parameters of Weibull distribution


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: estimating parameters of Weibull distribution
Date   Fri, 21 Feb 2003 21:02:00 -0000

Roberto G. Gutierrez, StataCorp.
> 
> Clint Thompson <cthompson@dfpm.utah.edu> 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-.
> 

As a footnote to Bobby's posting: 

if you have not yet upgraded to Stata 8, 
then -wbull- on SSC does some of this -- but 
not the variance-covariance matrix you will want. 
Blowing the dust off this ancient code, I see 
that it requires Stata 5, so should work on 5, 6 and 7. 

The graphics routines -qweibull- and -pweibull- 
are of the same age and also are on SSC. 

Nick 
n.j.cox@durham.ac.uk 
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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