Bookmark and Share

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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: Likelihood Maximisation for the exponential model in Survival Analysis


From   Dev Vencappa <[email protected]>
To   "[email protected]" <[email protected]>
Subject   RE: st: Likelihood Maximisation for the exponential model in Survival Analysis
Date   Thu, 24 Oct 2013 13:37:44 +0100

Dear Maarten,

 Thanks very much - I knew I had overlooked something very simple. Thanks for clarifying.

Regards,
Dev

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Maarten Buis
Sent: 24 October 2013 10:28
To: [email protected]
Subject: Re: st: Likelihood Maximisation for the exponential model in Survival Analysis

In your -ml model- you specify two equation, while a exponential model only has one. All you need to do is replace:

ml model lf myexp_ph_lf (studytime died = drug2 drug3 age) /lnlam

with

ml model lf myexp_ph_lf (studytime died = drug2 drug3 age)

You can than leave out the -difficult tech(nr bhhh dfp bfgs)- options.

Note that your ml model only returns coefficients, while -streg- by default returns hazard ratios. To make sure your -streg- command returns comparable numbers you need to add the -nohr- option to -streg-. You'll than see that the two give exactly the same results.

-- Maarten

On Thu, Oct 24, 2013 at 10:36 AM, Dev Vencappa <[email protected]> wrote:
> My apologies,
>
>  The previous email seems to have messed up the lines in the codes. Edited codes are below. Any help on this would be very much appreciated.
>
> capture program drop myexp_ph_lf
> program myexp_ph_lf
>                 *version 8.1
>                 args lnf llam
>                 quietly {
>                                 replace `lnf' = $ML_y2*`llam'- exp(`llam')*$ML_y1
>                                 }
> end
>
> *testing the above with the cancer data set:
>
> sysuse cancer, clear
> g drug2=drug==2
> g drug3=drug==3
> ml model lf myexp_ph_lf (studytime died = drug2 drug3 age) /lnlam ml 
> check  ml search  ml maximize, difficult tech(nr bhhh dfp bfgs)
>
> *but STATA streg command seems to work fine.
>
> stset studytime, failure(died)
> streg drug2 drug3 age, d(exponential)
>
>
> Thanks and regards,
> Dev
>
> -----Original Message-----
> From: [email protected] 
> [mailto:[email protected]] On Behalf Of Dev 
> Vencappa
> Sent: 24 October 2013 09:27
> To: [email protected]
> Subject: st: Likelihood Maximisation for the exponential model in 
> Survival Analysis
>
> Dear Stata users,
>
> My attempt to code and maximise the log-likelihood from scratch for the exponential model has failed (message "could not calculate numerical derivatives -- flat or discontinuous region encountered"). My codes using the lf method are below and I would very much appreciate some pointers as to where I am going wrong with this?
>
> Thanks and regards,
> Dev
>
>
> capture program drop myexp_ph_lf
> program myexp_ph_lf
>                 *version 8.1
>                 args lnf llam
>                 quietly {
>                                 replace `lnf' = $ML_y2*`llam'- exp(`llam')*$ML_y1
>                                 }
> end
>
>
> *testing the above with the cancer data set:
>
> sysuse cancer, clear
> g drug2=drug==2
> g drug3=drug==3
> ml model lf myexp_ph_lf (studytime died = drug2 drug3 age) /lnlam ml 
> check  ml search  ml maximize, difficult tech(nr bhhh dfp bfgs)
>
> *but STATA streg command seems to work fine.
> stset studytime, failure(died)
> streg drug2 drug3 age, d(exponential)
>
>
> This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it.   Please do not use, copy or disclose the information contained in this message or in any attachment.  Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.
>
> This message has been checked for viruses but the contents of an attachment may still contain software viruses which could damage your computer system, you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation.
>
>
>
>
>
> *
> *   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/
> This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it.   Please do not use, copy or disclose the information contained in this message or in any attachment.  Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.
>
> This message has been checked for viruses but the contents of an 
> attachment may still contain software viruses which could damage your computer system, you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation.
>
>
>
>
>
> *
> *   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/



--
---------------------------------
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/
This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it.   Please do not use, copy or disclose the information contained in this message or in any attachment.  Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.

This message has been checked for viruses but the contents of an attachment
may still contain software viruses which could damage your computer system, you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation.





*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index