Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: graph combine


From   Maarten buis <maartenbuis@yahoo.co.uk>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: graph combine
Date   Mon, 3 Nov 2008 09:18:51 +0000 (GMT)

--- "Sim.Oertel@t-online.de" <Sim.Oertel@t-online.de> wrote:
> I generated three graphs by: 
>  
> predict hazard, hazard
> line hazard _t, sort xlabel(0 (365) 5820) xsize(2) ysize(1) 
>  
> Is there a way of combining these graphs within one single graph? I
> know about the ?graph combine? command, however this command only
> allows for combining the graphs within one large graphic but not
> within a single chart, doesn?t it?.

I can think of two solutions: first you can overlay the graphs. If you
type -twoway bla1 || bla2- then Stata will graph the graph bla2 on top
of bla1 (you ofcourse have to replace bla# with a valid 
-twoway graph-). The second solution is to use -stcurve-, see 
-help stcurve-. The two solutions are illustrated in the example below.

Hope this helps,
Maarten

*-------------- begin example ------------------
sysuse cancer, clear
stset studytime, failure(died)
xi: streg i.drug, dist(lnorm)
predict hazard, hazard
twoway line hazard _t if drug == 1, sort || ///
       line hazard _t if drug == 2, sort || ///
       line hazard _t if drug == 3, sort    ///
       legend(order(1 "drug 1" ///
                    2 "drug 2" ///
                    3 "drug 3"))

stcurve, hazard at1(_Idrug_2=0 _Idrug_3=0) ///
                at2(_Idrug_2=1 _Idrug_3=0) ///
                at3(_Idrug_2=0 _Idrug_3=1) 
*----------------- end example -------------------


-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room N515

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------


      
*
*   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/



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