[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
"Martin Weiss" <martin.weiss1@gmx.de> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
Re: st: Re: limiting observations within a program |

Date |
Fri, 3 Oct 2008 02:38:01 +0200 |

Ok, so indeplist is a user-written program. This works for me, i.e. leaves the desired result in the -return list-

*************

cap ssc inst indeplist

webuse kva, clear

stset failtime

cap pr drop myprog

pr myprog, rclass

indeplist, local

foreach var of varlist `X' {

return scalar `var' = exp(_b[`var'])

}

end

stcox load bearings

myprog

ret li

**************

HTH

Martin

_______________________

----- Original Message ----- From: "Michael McCulloch" <mm@pinest.org>

To: <statalist@hsphsun2.harvard.edu>

Sent: Friday, October 03, 2008 2:24 AM

Subject: Re: st: Re: limiting observations within a program

Martin wrote:`X' looks like some kind of -macro- but I cannot find its definition, either...Ahah! Thank you. Now I know what proper question to ask. Let me try this again. Note that the section mentioning X:

" indeplist, local

foreach var of varlist `X' {

return scalar `var' = exp(_b[`var'])

}"

immediately follows the -stcox-. What I want to do is to have it give me the exponentiated coefficient so the hazard ratio is returned. How would I rewrite that section to do this?

HTH Martin _______________________ ----- Original Message ----- From: "Michael McCulloch" <mm@pinest.org> To: <statalist@hsphsun2.harvard.edu> Sent: Friday, October 03, 2008 2:12 AM Subject: Re: st: Re: limiting observations within a programSergei wrote:Thanks Sergei. Sorry, not sure what you mean. I've defined the tempnames with:And where is varlist X defined?

tempname p_tcm_ALL p_notcm_ALL p_ALL p_noALL wt_stab_ALL

And, the variables are all within my dataset:

tcm dxage sex celltype txsurg txrad txchemo

On Thu, Oct 2, 2008 at 7:56 PM, Michael McCulloch <mm@pinest.org> wrote:Thanks Martin. This is my program. It first estimates probability of

receiving treatment (called "tcm"), and then weights the data for -stcox-.

There was one observation in which the weight was missing, I'm attempting to

include a line in my program to drop that one observation.

capture program drop msmcox_stageALL_includeIPTWd

program define msmcox_stageALL_includeIPTWd, rclass

> tempname p_tcm_ALL p_notcm_ALL p_ALL p_noALL > wt_stab_ALL* fit the full model used in Traditional Cox> logit tcm dxage sex celltype txsurg txrad txchemo

*estimate probability of treatment

predict `p_tcm_ALL'

gen `p_notcm_ALL' = 1-`p_tcm_ALL' if tcm==0 //want p(tcm) for

both users and nonusers

replace `p_tcm_ALL' =`p_notcm_ALL' if tcm==0

*create stabilized weight==P(A)/P(A|W)

logit tcm predict `p_ALL'

gen `p_noALL' = 1-`p_ALL' if tcm==0

replace `p_ALL' = `p_noALL' if tcm==0

gen `wt_stab_ALL' = `p_ALL'/`p_tcm_ALL'

* stset the data

stset lastcontact [`iweight=wt_stab_ALL'], failure(failed)

origin(datedx) scale(30.4375) /*wt: stabilized IPTW*/

* cox

stcox tcm if `wt_stab_ALL'!=.

indeplist, local

foreach var of varlist `X' {

return scalar `var' = exp(_b[`var'])

}

end set seed 12358

eststo MSM_t_I: bootstrap tcm=r(tcm), eform reps(10):

msmcox_stageALL_includeIPTWd

That is too little info. How does `var1' come into existence? A

-bootstrap- would cycle through the -program- several times, so that is an

important issue. Also -set trace on- and let us know the output...

HTH

Martin

_______________________

----- Original Message ----- From: "Michael McCulloch" <mm@pinest.org>

To: "Statalist" <statalist@hsphsun2.harvard.edu>

Sent: Friday, October 03, 2008 1:10 AM

Subject: st: limiting observations within a program

Hello,

I've written a short program which estimates a probability of censoring,

and have a question. The program works as written, but if I add the

following line:

drop if `var1'==.

the program returns error message:

"varlist required an error occurred when bootstrap executed program1

r(100);"

Any assistance would be appreciated!

--

Best wishes,

Michael McCulloch

Pine Street Foundation

124 Pine St., San Anselmo, CA 94960-2674

Tel: (415) 407-1357

Fax: (415) 485-1065

mcculloch@pinestreetfoundation.org

www.pinestreetfoundation.org

*

* For searches and help try:

* http://www.stata.com/help.cgi?search

* http://www.stata.com/support/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/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/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/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**Follow-Ups**:**Re: st: Re: limiting observations within a program***From:*Michael McCulloch <mm@pinest.org>

**References**:**st: Re: limiting observations within a program***From:*"Martin Weiss" <martin.weiss1@gmx.de>

**Re: st: Re: limiting observations within a program***From:*"Sergiy Radyakin" <serjradyakin@gmail.com>

**Re: st: Re: limiting observations within a program***From:*Michael McCulloch <mm@pinest.org>

**Re: st: Re: limiting observations within a program***From:*"Martin Weiss" <martin.weiss1@gmx.de>

**Re: st: Re: limiting observations within a program***From:*Michael McCulloch <mm@pinest.org>

- Prev by Date:
**Re: st: Re: limiting observations within a program** - Next by Date:
**Re: st: Re: limiting observations within a program** - Previous by thread:
**Re: st: Re: limiting observations within a program** - Next by thread:
**Re: st: Re: limiting observations within a program** - Index(es):

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