Statalist


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

AW: st: graph combine


From   <[email protected]>
To   <[email protected]>
Subject   AW: st: graph combine
Date   Fri, 14 Nov 2008 16:33:11 +0100

Thanks Maarten for your help (sorry form my late reply). 

Your advice works well. 

Thanks
Simon

-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Maarten buis
Gesendet: Montag, 3. November 2008 10:19
An: [email protected]
Betreff: Re: st: graph combine

--- "[email protected]" <[email protected]> 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/


*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index