 Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# Re: st: RE: Fitting distributions to right-sensored survival data

 From Steve Samuels To statalist@hsphsun2.harvard.edu Subject Re: st: RE: Fitting distributions to right-sensored survival data Date Wed, 5 Feb 2014 11:03:36 -0500

I should have clarified, as there are two distributions here. What I referred to as location and scale in the AFT formulation was not for the Weibull distribution but for a log Weibull istribution.

Let T ~ Weibull distributed outcome

The Weibull has two parameterizations, the PH
and the AFT

In the PH (proportional hazards) parameterization, define
b = _b[_cons]

\lambda = exp(b) is the scale parameter for the Weibull distribution

p (or log(p)) is the shape parameter for the Weibull distribution

However, you specified the AFT form by adding the "time" option to your
-streg- command. The AFT parameterization describes a model for the log
of survival time. See the description in the manual section "Weibull and
exponential models"  In the AFT parameterization, there is no shape parameter.

Let Y = log(T)  Y doesn't have a Weibull distribution, but has what is known as a Gumbel or log-Weibull or Type I extreme value distribution

b* = _b[cons] is a location parameter for the log Weibull distribution

\sigma = 1/p is the scale parameter for the log Weibull distribution

b* (AFT) and  b = log(\lambda) (PH) are related by

b* = - b x \sigma.

See these relations in the following example:
*************CODE BEGINS*************
sysuse auto, clear
gen mpgx = mpg-13
stset mpgx
scalar drop _all

streg, d(weibull) // PH
scalar b = _b[_cons]
scalar lambda = exp(b)  //scale
scalar sigma = 1/e(aux_p)      //1/p
scalar bstar = -b*sigma
scalar dir

streg, d(weibull)  time   //AFT
di _b[_cons]
di  bstar
**************CODE ENDS**************

Steve Samuels
sjsamuels@gmail.com

On Jan 24, 2014, at 9:46 AM, Kabaso M.E. <Mushota.Kabaso@soton.ac.uk> wrote:

Dear Statalist,

As below, I can get the scale parameter p from the output. I am stuck with the scale parameter for the distribution (Weibull in this case) which  I fit my data to

See the output below and kindly help

Thanks
Mushota

. streg, dist(weibull) time

failure _d:  Censorship == 1
analysis time _t:  (Last_StatusDate-origin)
origin:  time ARV_start
id:  patientIdInt

Fitting constant-only model:

Iteration 0:   log likelihood = -30480.164
Iteration 1:   log likelihood =  -30394.76
Iteration 2:   log likelihood = -30394.576
Iteration 3:   log likelihood = -30394.576

Fitting full model:
Iteration 0:   log likelihood = -30394.576

Weibull regression -- accelerated failure-time form

No. of subjects =       183547                     Number of obs   =    183547
No. of failures =         5582
Time at risk    =    157273351
LR chi2(0)      =      0.00
Log likelihood  =   -30394.576                     Prob > chi2     =         .

------------------------------------------------------------------------------
_t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
_cons |   10.76499   .0470595   228.75   0.000     10.67276    10.85723
-------------+----------------------------------------------------------------
/ln_p |  -.1471334   .0116291   -12.65   0.000     -.169926   -.1243409
-------------+----------------------------------------------------------------
p |   .8631788    .010038                      .8437273    .8830787
1/p |   1.158509   .0134724                      1.132402    1.185217
------------------------------------------------------------------------------

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Kabaso M.E.
Sent: 26 November 2013 15:43
To: statalist@hsphsun2.harvard.edu
Subject: RE: st: RE: Fitting distributions to right-sensored survival data

Dear Maarten,
I am able to obtain the shape parameter this way, what about the scale parameter?
Mushota

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Maarten Buis
Sent: 22 November 2013 13:08
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: RE: Fitting distributions to right-sensored survival data

On Fri, Nov 22, 2013 at 1:44 PM, Kabaso M.E. wrote:
> Essentially, I can use the streg for example to fit a Weibull model to my survival data but how can I get the model's parameters for me to recreate the pdf here fitted elsewhere?

The (transformed) parameters are returned in the matrix e(b). You can also use the -[]_b[]- syntax to get at specific parameters, see: -help _variables-. Here is an example:

*------------------ begin example ------------------ sysuse cancer streg i.drug age, dist(weibull) nohr matlist e(b)
di "p = "     exp([ln_p]_b[_cons])
di "1/p = " 1/exp([ln_p]_b[_cons])
*------------------- end example -------------------
* (For more on examples I sent to the Statalist see:
* http://www.maartenbuis.nl/example_faq )

Hope this helps,
Maarten

---------------------------------
Maarten L. Buis
WZB
Reichpietschufer 50
10785 Berlin
Germany

http://www.maartenbuis.nl
---------------------------------
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/