Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

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

From |
Tim Evans <Tim.Evans@wmciu.nhs.uk> |

To |
"'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu> |

Subject |
RE: st: Useful labelling of dummy variables following logit |

Date |
Thu, 25 Aug 2011 09:08:21 +0100 |

Hi Maarten, Thanks for the help again. I've tried your example below, but it fails on the following code: parmest, norestore eform Invalid estimates matrix: e(b) last estimates not found r(301); Any idea what is going on here? Best wishes Tim -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Maarten Buis Sent: 24 August 2011 17:43 To: statalist@hsphsun2.harvard.edu Subject: Re: st: Useful labelling of dummy variables following logit On Wed, Aug 24, 2011 at 5:41 PM, Tim Evans <Tim.Evans@wmciu.nhs.uk> wrote: > Thanks for this, it nearly works for me - I can graph it, but I don't get all of the variable values from the 'axis' column to appear - I only have random ones. Do you know why it does not display all of the variables names (but does display the estimate value) if you have say 7 estimates than your -ylab()- option should be -ylab(1/7, valuelabel ang(h) noticks ) to ensure that there is a label for each estimate. The dropping is not random, Stata tries to find nice values for labels, so it can easily happen that it only displays an axis label for every 2nd or 5th parameter. For most graphs makes perfect sense, just not for ours, so need to explicitly tell Stata to which values it needs to attach a label. The added problem here is that Tim is interested in factor variables. In that case you would not want the variable label but the value label. I have modified the example further to ensure that happens. *------------------------ begin example ------------------------- sysuse nlsw88, clear replace ttl_exp = ttl_exp / 10 // experience in decades replace grade = grade - 12 // center education at meaningful value logit union i.race i.south grade ttl_exp, or foreach v in grade ttl_ex { // continuous variables local l`v' : variable label `v' if `"`l`v''"' == "" { // if no variable label local l`v' "`v'" } } foreach v in south race { // factor variables levelsof `v' local `v'levs `r(levels)' foreach l in ``v'levs' { local l`v'_`l' : label (`v') `l' if `"`l`v'_`l''"' == "`l'" { // if no value label local l`v'_`l' `"`v' == `l'"' } } } parmest, norestore eform foreach v in grade ttl_ex { replace parm = "`l`v''" if parm == "`v'" } foreach v in south race { local i = 1 foreach l in ``v'levs' { if `i' == 1 { drop if parm == "`l'b.`v'" // drop reference } else { replace parm = "`l`v'_`l''" if parm == "`l'.`v'" } local i = `i' + 1 } } replace parm = "baseline odds" if parm == "_cons" egen axis= axis(z), label(parm) twoway bar estimate axis, base(1) horizontal barw(.5) /// xline(1) ylab(1/6, valuelabel ang(h) noticks) || /// rcap min95 max95 axis, horizontal /// legend(order(1 "point estimate" /// 2 "95% conf. int.") pos(6)) /// xtitle("odds ratio") ytitle("") *--------------------- end example ----------------------------- (For more on examples I sent to the Statalist see: http://www.maartenbuis.nl/example_faq ) Hope this helps, Maarten -------------------------- Maarten L. Buis Institut fuer Soziologie Universitaet Tuebingen Wilhelmstrasse 36 72074 Tuebingen Germany http://www.maartenbuis.nl -------------------------- * * 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/ _DISCLAIMER: This email and any attachments hereto contains proprietary information, some or all of which may be confidential or legally privileged. It is for the exclusive use of the intended recipient(s) only. If an addressing or transmission error has misdirected this e-mail and you are not the intended recipient(s), please notify the author by replying to this e-mail. If you are not the intended recipient you must not use, disclose, distribute, copy, print, or rely on this e-mail or any attachments, as this may be unlawful. * * 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/

**Follow-Ups**:**Re: st: Useful labelling of dummy variables following logit***From:*Maarten Buis <maartenlbuis@gmail.com>

**References**:**st: Useful labelling of dummy variables following logit***From:*Tim Evans <Tim.Evans@wmciu.nhs.uk>

**Re: st: Useful labelling of dummy variables following logit***From:*Maarten Buis <maartenlbuis@gmail.com>

**Re: st: Useful labelling of dummy variables following logit***From:*Nick Cox <njcoxstata@gmail.com>

**RE: st: Useful labelling of dummy variables following logit***From:*Tim Evans <Tim.Evans@wmciu.nhs.uk>

**Re: st: Useful labelling of dummy variables following logit***From:*Maarten Buis <maartenlbuis@gmail.com>

**Re: st: Useful labelling of dummy variables following logit***From:*Nick Cox <njcoxstata@gmail.com>

**RE: st: Useful labelling of dummy variables following logit***From:*Tim Evans <Tim.Evans@wmciu.nhs.uk>

**Re: st: Useful labelling of dummy variables following logit***From:*Maarten Buis <maartenlbuis@gmail.com>

**Re: st: Useful labelling of dummy variables following logit***From:*Nick Cox <njcoxstata@gmail.com>

**RE: st: Useful labelling of dummy variables following logit***From:*Tim Evans <Tim.Evans@wmciu.nhs.uk>

**Re: st: Useful labelling of dummy variables following logit***From:*Maarten Buis <maartenlbuis@gmail.com>

- Prev by Date:
**st: renaming variables from first observation** - Next by Date:
**Re: st: renaming variables from first observation** - Previous by thread:
**Re: st: Useful labelling of dummy variables following logit** - Next by thread:
**Re: st: Useful labelling of dummy variables following logit** - Index(es):