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]

st: Likelihood Maximisation for the exponential model in Survival Analysis


From   Dev Vencappa <Dev.Vencappa@nottingham.ac.uk>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: Likelihood Maximisation for the exponential model in Survival Analysis
Date   Thu, 24 Oct 2013 09:36:36 +0100

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: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Dev Vencappa
Sent: 24 October 2013 09:27
To: statalist@hsphsun2.harvard.edu
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/


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