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]

st: Graphing odds ratios


From   "McGrath, Andrew (Psychology)" <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: Graphing odds ratios
Date   Thu, 18 Apr 2013 20:40:10 +1000

Dear all

Using these previous very informative posts:
http://www.stata.com/statalist/archive/2011-08/msg01156.html
http://www.stata.com/statalist/archive/2011-12/msg00542.html

I have graphed the odds ratios and confidence intervals using -parmest- and -egenmore- using Stata 11.

This is the code I have used:

**
logit prison  i. age_in_gen cr_hist i.legrep i.bail_rec seifa_indexq osi_qu aria_index i.count_dic i.concurr_dic


egen axis= axis(estimate), label(parm)

keep if inlist(parm,"Indigenous male, 17-21", "Indigenous male, 10-16", ///
"Non-Indigenous male, 17-21", "Non-Indigenous male, 10-16", "Indigenous female, 17-21", ///
"Indigenous female, 10-16", "Non-Indigenous female, 17-21", "Non-Indigenous female, 10-16")

twoway bar  estimate axis, base(1) horizontal barw(.5) ///
           xline(1) ylab(#8, valuelabel angle(45)) ||             ///
      rcap min95 max95 axis, horizontal               ///
           legend(order(1 "point estimate"            ///
                        2 "95% conf. int.") pos(6))   ///
           xtitle("odds ratio") ytitle("")

**

I only want to graph the odds ratios for the indicator variable age_in_gen however in
my final graph the variable legrep is appearing. I can't see the error in my
code that is causing this.

The following code gives the graph I want but only with the variable names, not labels:

**
logit prison  i. age_in_gen cr_hist i.legrep i.bail_rec seifa_indexq osi_qu aria_index i.count_dic i.concurr_dic
parmest, norestore eform

keep if inlist(parm, "1b.age_in_gen", "2.age_in_gen", "3.age_in_gen", ///
"4.age_in_gen", "5.age_in_gen", "6.age_in_gen", "7.age_in_gen", "8.age_in_gen")

egen axis= axis(estimate), label(parm)
twoway bar  estimate axis, base(1) horizontal barw(.5) ///
xline(1) ylab(1(1)8, valuelabel angle(45)) || rcap min95 max95 axis, ///
horizontal legend(order(1 "point estimate" 2 "95% conf. nt.") pos(6)) ///
xtitle("odds ratio") ytitle("")
**

Apologies for the lengthy post and many thanks for your consideration.

Best wishes
Andrew
Charles Sturt University

| ALBURY-WODONGA | BATHURST | CANBERRA | DUBBO | GOULBURN | MELBOURNE | ONTARIO | ORANGE | PORT MACQUARIE | SYDNEY | WAGGA WAGGA |

LEGAL NOTICE
This email (and any attachment) is confidential and is intended for the use of the addressee(s) only. If you are not the intended recipient of this email, you must not copy, distribute, take any action in reliance on it or disclose it to anyone. Any confidentiality is not waived or lost by reason of mistaken delivery. Email should be checked for viruses and defects before opening. Charles Sturt University (CSU) does not accept liability for viruses or any consequence which arise as a result of this email transmission. Email communications with CSU may be subject to automated email filtering, which could result in the delay or deletion of a legitimate email before it is read at CSU. The views expressed in this email are not necessarily those of CSU.

Charles Sturt University in Australia  http://www.csu.edu.au  The Grange Chancellery, Panorama Avenue, Bathurst NSW Australia 2795  (ABN: 83 878 708 551; CRICOS Provider Numbers: 00005F (NSW), 01947G (VIC), 02960B (ACT)). TEQSA Provider Number: PV12018

Charles Sturt University in Ontario  http://www.charlessturt.ca 860 Harrington Court, Burlington Ontario Canada L7N 3N4  Registration: www.peqab.ca

Consider the environment before printing this email.

Disclaimer added by CodeTwo Exchange Rules 2007
http://www.codetwo.com


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