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: RE: RE: Plotting survival curves after multiple imputation


From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: RE: RE: Plotting survival curves after multiple imputation
Date   Wed, 20 Feb 2013 11:59:14 +0000

It's a very small side-issue, and I can't illuminate your main question, but

 foreach i in 5 10 15 20 25 30 35 40 45 {
         replace age = . in `i'
}

could be re-written as

forval i = 5(5)45 {
         replace age = . in `i'
}

or as

replace age = . if mod(_n, 5) == 0

or as

replace age = . if !mod(_n, 5)

The shortest code here is also, unfortunately, the most devious and obscure.

Nick


On Wed, Feb 20, 2013 at 11:06 AM, Robert Long <[email protected]> wrote:
> Excuse me, there was a line missing in the code. Here is the correct listing:
>
> webuse drugtr, clear
>
> foreach i in 5 10 15 20 25 30 35 40 45 {
>
>         replace age = . in `i'
>
> }
>
>
> mi set wide
> mi register impute age
>
> ice age studytime died drug, m(5) saving(drugtr_imp, replace)
>
> use drugtr_imp.dta, clear
>
> * no problem obtaining pooled estimates, and here I use the storebv option
> * in an attempt to give -stcurve- what it needs mim , storebv: stcox  age drug
> mim, storebv: stcox  age drug
>
>
> * but it doesn't work:
> stcurve, survival at1(drug=0) at2(drug=1)
>
>
>
>
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On Behalf Of Robert Long
> Sent: 20 February 2013 09:47
> To: '[email protected]'
> Subject: st: RE: Plotting survival curves after multiple imputation
>
> I have attempted to solve this using the following code, which is reproducible, but relies on the -ice- and -mim- commands
>
> webuse drugtr, clear
>
> * create some missing value
> foreach i in 5 10 15 20 25 30 35 40 45 {
>         replace age = . in `i'
> }
>
> mi set wide
> mi register impute age
>
> ice age studytime died drug, m(5) saving(drugtr_imp, replace)
>
> use drugtr_imp.dta, clear
>
> * no problem obtaining pooled estimates, and here I use the storebv option
> * in an attempt to give -stcurve- what it needs mim , storebv: stcox  age drug
>
> * but it doesn't work:
> stcurve, survival at1(drug=0) at2(drug=1)
>
> The error is
> last estimates not found
> r(301);
>
> This error seems to be produced in -stcurve- which is looking for e(cmd2) to be set to "stcox", but e(cmd2) is not set at all - e(cmd) is set to "stcox". However, running stcox normally (ie without -mim- ) , e(cmd2) /is/ set to "stcox"..
>
> Can anyone help ?
>
> Thanks
> Robert Long
>
>
>
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On Behalf Of Robert Long
> Sent: 15 February 2013 11:55
> To: '[email protected]'
> Subject: st: Plotting survival curves after multiple imputation
>
> Hello Statalist
>
> This sounds like something very simple, or at least it should be something that is commonly required, but so far I haven't found an answer.
>
> I want to use multiple imputation for missing covariate data. No problems with that.
>
> Having obtained m different datasets, I want to run cox regressions, obtaining pooled results. No problems with that.
>
> But I also want to plot a "pooled" survival curve for different levels of a covariate.
>
> How do I obtain such plots ?
>
> Thanks
> Robert Long
>
>
> *
> *   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/


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