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   Mon, 31 Mar 2014 08:36:01 +0700

Dear Roger,

I am sorry for the late reply. 
I went to your web page and searched what you suggested. I found many helpful ways to do. Finally, I used this commands:

Use file.dta
tempfile tf1 tf2 tf3 tf4
parmby "stcox stcox i.x0 i.x1 i.x2 i.x3 i.x4 i.x5 i.x6", eform  lab saving(tf1,replace) idn(1) ids(mode1)
parmby "stcox  i.x0 i.x5 i.x6", eform  lab saving(tf2,replace) idn(2) ids(mode2)
parmby "stcox i.x0 i.x1 i.x2 i.x3 i.x4", eform  lab saving(tf3,replace) idn(3) ids(mode3)
parmby "stcox i.x0", 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 4" 4 "Model 3" 6 "Model 2" 8 "Model 1") si(small) row(1) ring(0)) scheme(lean1)  xlabel(0(1) 5) xline(1, lpattern(shortdash))

Is that okay? 
Thanks very much

Best regards,
Kun

  
----------------------------------------
> Date: Sun, 30 Mar 2014 17:20:35 +0100
> From: [email protected]
> To: [email protected]
> Subject: Re: st: Transform table to graph
>
> The -parmest- package does not produce graphs. However, the -eclplot-
> package (also downloadable from SSC) produces graphs. And the graphs
> that it produces may contain parameters from 1 model, or from several
> models, depending on the dtaset in which it is used.
>
> To produce an output dataset (or resultsset) containing parameters from
> several models, you need to produce multiple -parmest- resultssets for
> the multiple models, and then append them (using -append- in recent
> versions of Stata or the SSC package -dsconcat- in early versions of
> Stata). You can then use -if- to select the parameters you wanted to
> plot, and use -eclplot- to plot them.
>
> Examples of the use of concatenated resultssets appear in the online
> help for -parmest-, which you can view by typing, in Stata,
>
> help parmest
>
> if -parmest- is installed. The online help for -parmest- also contains
> hypertext to Stata Journal articles, and Stata User Meeting
> presentations, about -parmest-.
>
> I hope this helps.
>
> Best wishes
>
> Roger
>
>
> Roger B Newson BSc MSc DPhil
> Lecturer in Medical Statistics
> Respiratory Epidemiology, Occupational Medicine
> and Public Health Group
> National Heart and Lung Institute
> Imperial College London
> Royal Brompton Campus
> Room 33, Emmanuel Kaye Building
> 1B Manresa Road
> London SW3 6LR
> UNITED KINGDOM
> Tel: +44 (0)20 7594 7931
> Email: [email protected]
> Web page: http://www.imperial.ac.uk/nhli/r.newson/
> Departmental Web page: http://www.imperial.ac.uk/nhli/reomph/
>
> Opinions expressed are those of the author, not of the institution.
>
> On 30/03/2014 13:10, 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/
>>
> *
> * 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