Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

RE: st: Transform table to graph


From   Kun A Susiloretni <[email protected]>
To   "[email protected]" <[email protected]>
Subject   RE: st: Transform table to graph
Date   Tue, 1 Apr 2014 09:02:44 +0700

Dear Patrick,

If I use this way, I could put 4 models in one graph (one yaxis & xaxis/xline) as depicts in figure 7 at http://www.ats.ucla.edu/stat/stata/paperexamples/Kastellec_Leoni/. ;
What should do after -coefplot- to put 4 models in a graph with one yaxis xaxis. 

Best
Kun

 
Use file.dta
tempfile tf1 tf2 tf3 tf4
parmby "stcox i.x1", eform  lab saving(tf1,replace) idn(1) ids(mode1)
parmby "stcox i.x1 i.x2 i.x3 i.x4 i.x5", eform  lab saving(tf2,replace) idn(2) ids(mode2)
parmby "stcox i.x1 i.x6 i.x7", eform  lab saving(tf3,replace) idn(3) ids(mode3)
parmby "stcox i.x1 i.x2 i.x3 i.x4 i.x5 i.x6 i.x7", eform  lab saving(tf4,replace) idn(4) ids(mode4)
dsconcat tf1 tf2 tf3 tf4
sencode idstr, gene(modtype)
sencode label, gene(predictor)
replace predictor = predictor + .2 if modtype ==2
replace predictor = predictor + .4 if modtype ==3
replace predictor = predictor + .6 if modtype ==4
drop if parm=="_cons"
twoway (rcap min95 max95 predictor if modtype==1, hor) (scatter predictor estimate if modtype==1, msymbol(Oh) col(gs0)) (rcap min95 max95 predictor if modtype==2, hor) (scatter predictor estimate if modtype==2, msymbol(Dh) col(gs0))  (rcap min95 max95 predictor if modtype==3, hor) (scatter predictor estimate if modtype==3, msymbol(Th) col(gs0))  (rcap min95 max95 predictor if modtype==4, hor) (scatter predictor estimate if modtype==4, msymbol(Sh) col(gs0)), yscale(range(0 3)) ylabel(1/7, valuelabel angle(0)) legend(order(2 "Model 1" 4 "Model 2" 6 "Model 3" 8 "Model 4") si(small) row(1) ring(0)) scheme(lean1)  xlabel(0(1) 5) xline(1, lpattern(shortdash))
 
 

----------------------------------------
> From: [email protected]
> To: [email protected]
> Date: Tue, 1 Apr 2014 00:19:00 +0200
> Subject: Re: st: Transform table to graph
>
> Dear Kun,
>
> I can't really tell whether this will help you with the exact problem you're having, but I found that -coefplot- (ftp://ftp.repec.org/opt/ReDIF/RePEc/bss/files/wp1/jann-2013-coefplot.pdf) can be of great help for similar applications.
>
> Best
> Patrick
>
> On 30-03-14, Kun A Susiloretni wrote:
>> Dear Statalist,
>>
>> I am using -stcox and esstab- in Stata 11 to build models in a table. The commands are as follow:
>>
>> eststo clear
>> eststo: quietly stcox i.y
>> eststo: quietly stcox i.y i.x1 i.x2 i.x3 i.x4
>> eststo: quietly stcox i.y i.x5 i.x6
>> eststo: quietly stcox i.y i.x1 i.x2 i.x3 i.x4 i.x5 i.x6
>> esttab using Effect.rtf, replace one noeqli label title(Table 1: Effect of promotion xxxxx) nonumbers mtitles("Model A" "Model B" "Model C" "Model D" )addnote ("aic= LR Test from Akaiki, df_m= degress of freedom of the model, Data source: EBF.dta" "Model A: Based Model, Model B: maternal factors, Model C: family factors, Model D: full model")b(a2) eform ci n pr2 scalars(aic df_m ) nogaps longtable obslast
>>
>> I like to present the table produced to a graph. I have tried using -parmest- , it produced graphs of each model. I need to depict y's hazard ratio of all models in a graph. I refer to the Chicago Guide to Writing about Multivariate Analysis.
>>
>> Any feedback would be greatly appreciated. Thank you very much in advance.
>>
>> Best regards,
>> Kun Susiloretni
>> *
>> * For searches and help try:
>> * http://www.stata.com/help.cgi?search
>> * http://www.stata.com/support/faqs/resources/statalist-faq/
>> * http://www.ats.ucla.edu/stat/stata/
>
> --
> Patrick Präg
> ICS/Department of Sociology
> Faculty of Social and Behavioral Sciences
> University of Groningen
> Grote Rozenstraat 31
> 9712 TG Groningen, The Netherlands
>
> Tel: +31 (0)50 363 7620
> Email: [email protected]
>
> http://www.rug.nl/staff/p.praeg
>
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/faqs/resources/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/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index