Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Categorical variables with stcurve


From   "CDSC - Verlander, Neville" <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   st: Categorical variables with stcurve
Date   Thu, 16 Dec 2004 09:43:48 -0000

Title: Categorical variables with stcurve

Dear stata users

I am new to the stata list and recently posted a query on the above topic but included the taboo word "Help" in the subject line, so I am re-sending. My apologies if you have received the message below twice.

I have a question regarding STATA8.2 in Windows XP with which I hope you could assist. My apologies if this is a trivial question.

I have multiple failure data (i.e each individual can fail more than once) and 2 categorical variables (size 8 levels and country 13 levels). I want to plot hazard and cumulative hazard plots (former to decide suitable distribution for streg and latter for the customer) using stcurve for each size, by country thus giving 13 graphs, each with 8 curves. To do the plots adjusting for the covariates I use the stcurve command using the at1(), at2(), etc options. As you know, one has to specify the variables in the at1, at2 parts that were in the regression; any variables left out are evaluated at their mean (0.5 for each dummy variable, which is meaningless). Thus every dummy variable has to be included within the brackets and for which level, eg _Isizegrp_2=0. However, there is a restriction of 80 charaters within each "at" after which STATA chops and ignores. In my case I exceed this limit even on renaming, for instance, _Isizegrp_2 to s2. My question is whether there is a way round this problem. I have looked at the STATA predict command but this will only produce hazard predictions and not cumulative hazards. I've tried assigning a macro to a part of the statement and then including that macro in the "at" statements, but it didn't work! . Here's some sample code to illustrate what I mean:

xi i.sizegrp i.cogrp;
ren _Isizegrp_2 s2;
ren _Isizegrp_3 s3;
ren _Isizegrp_4 s4;
ren _Isizegrp_5 s5;
ren _Isizegrp_6 s6;
ren _Isizegrp_7 s7;
ren _Isizegrp_8 s8;
ren _Icogrp_2 c2;
ren _Icogrp_3 c3;
ren _Icogrp_4 c4;
ren _Icogrp_5 c5;
ren _Icogrp_6 c6;
ren _Icogrp_7 c7;
ren _Icogrp_8 c8;
ren _Icogrp_9 c9;
ren _Icogrp_10 c10;
ren _Icogrp_11 c11;
ren _Icogrp_12 c12;
ren _Icogrp_13 c13;
streg s2 s3 s4 s5 s6 s7 s8 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13, dist(logl) robust;
stcurve, at1(s2=0,s3=0,s4=0,s5=0,s6=0,s7=0,s8=0,c2=0,c3=0,c4=0,c5=0,c6=0,c7=0,c8=0,c9=0,c10=0,c11=0,c12=0,c13=0)
at2(s2=1,s3=0,s4=0,s5=0,s6=0,s7=0,s8=0,c2=0,c3=0,c4=0,c5=0,c6=0,c7=0,c8=0,c9=0,c10=0,c11=0,c12=0,c13=0)
at3(s2=0,s3=1,s4=0,s5=0,s6=0,s7=0,s8=0,c2=0,c3=0,c4=0,c5=0,c6=0,c7=0,c8=0,c9=0,c10=0,c11=0,c12=0,c13=0)
at4(s2=0,s3=0,s4=1,s5=0,s6=0,s7=0,s8=0c2=0,c3=0,c4=0,c5=0,c6=0,c7=0,c8=0,c9=0,c10=0,c11=0,c12=0,c13=0)
at5(s2=0,s3=0,s4=0,s5=1,s6=0,s7=0,s8=0,c2=0,c3=0,c4=0,c5=0,c6=0,c7=0,c8=0,c9=0,c10=0,c11=0,c12=0,c13=0)
at6(s2=0,s3=0,s4=0,s5=0,s6=1,s7=0,s8=0,c2=0,c3=0,c4=0,c5=0,c6=0,c7=0,c8=0,c9=0,c10=0,c11=0,c12=0,c13=0)
at7(s2=0,s3=0,s4=0,s5=0,s6=0,s7=1,s8=0,c2=0,c3=0,c4=0,c5=0,c6=0,c7=0,c8=0,c9=0,c10=0,c11=0,c12=0,c13=0)
at8(s2=0,s3=0,s4=0,s5=0,s6=0,s7=0,s8=1,c2=0,c3=0,c4=0,c5=0,c6=0,c7=0,c8=0,c9=0,c10=0,c11=0,c12=0,c13=0)
ti("Country 1") legend(lab(1 "Size 1") lab(2 "Size 2") lab(3 "Size 3") lab(4 "Size 4")
lab(5 "Size 5") lab(6 "Size 6") lab(7 "Size 7") lab(8 "Size 8"))
cumhaz saving(c:\work\data\ewgli\cox1.gph,replace);


Thank you very much for your attention and any assistance you can provide.

Regards,

Neville
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


Neville Verlander
Statistics Unit
Statistics, Modelling and Economics Department
Health Protection Agency Centre for Infections
61 Colindale Avenue
London
NW9 5EQ

Tel: (direct) (+44) 0208 3277426
Fax: (+44) 0208 7868



**************************************************************************< br>The information contained in the EMail and any attachments is confidential and intended solely and for the attention and use of the named addressee(s). It may not be disclosed to any other person without the express authority of the HPA, or the intended recipient, or both. If you are not the intended recipient, you must not disclose, copy, distribute or retain this message or any part of it. This footnote also confirms that this EMail has been swept for computer viruses, but please re-sweep any attachments before opening or saving. HTTP://www.HPA.org.uk **************************************************************************




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