And where is varlist X defined?
On Thu, Oct 2, 2008 at 7:56 PM, Michael McCulloch <[email protected]> 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" <[email protected]>
>> To: "Statalist" <[email protected]>
>> 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
>>> [email protected]
>>> 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/