Bookmark and Share

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]

st: AW: RE: Correct labeling in egenmore axis()?


From   "Kaulisch, Marc" <kaulisch@forschungsinfo.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: AW: RE: Correct labeling in egenmore axis()?
Date   Tue, 11 May 2010 18:07:52 +0200

Ad 1: The missings on mean1 are on purpose because I want to display/plot mean1 and mean2 in one row per category.
So the simplified code is:
---
sysuse bpwide, clear
statsby mean1=r(mean) ub1=r(ub) lb1=r(lb) N1=r(N), by(agegrp sex): ci bp_before
sort agegrp sex mean1
egen axis = axis(mean1 agegrp sex), label(agegrp sex) 
egen group = group(agegrp sex), label 
---

Even here, labelling is not doing what it is supposed to do (see Nick's 2. point)

Ad 3: I realised that your solution uses a long dataset. But I am not sure if it is suitable for me because (see ad 1) I would like to compare confidence intervals for blood pressure before and after in one row per category.
(I reshape my data already in a long format in order to create a categorical var).


Marc

-----Ursprüngliche Nachricht-----
Von: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Nick Cox
Gesendet: Dienstag, 11. Mai 2010 17:10
An: statalist@hsphsun2.harvard.edu
Betreff: st: RE: Correct labeling in egenmore axis()?

I see three issues here:

1. What you are feeding to -egen, axis()- includes missing values on -mean1-. -list- what you are feeding it to see that. 

The -axis()- function can't know what those missing values should be. It ignores them, therefore. Note that its -missing- option won't help here, as the missings would still be classified differently from the non-missings. 

So, you need to fix the data before you call -egen, axis()-. 

2. Independently of that, I think you've unearthed a bug in -axis()-, but I don't yet know what it is. 

3. As with previous examples, I think you are making the problem more difficult than it need be. The bplong dataset is in more congenial structure than the bpwide dataset and wouldn't pose this problem for you, as one of my previous examples showed. Although it's not your real data, presumably, there's probably an implication for that, i.e. things may be easier after a -reshape-. 

Nick
n.j.cox@durham.ac.uk 

Kaulisch, Marc

Follow up on my earlier graphing issue.

It looks like if the label-option in egenmore (ssc) axis() is not doing what it supposed to do or am I overlooking something again?

-----
sysuse bpwide, clear
tempfile tf1 tf2
statsby mean1=r(mean) ub1=r(ub) lb1=r(lb) N1=r(N), by(agegrp sex)
saving(`tf1'): ci bp_before
statsby mean2=r(mean) ub2=r(ub) lb2=r(lb) N2=r(N), by(agegrp sex)
saving(`tf2'): ci bp_after
dsconcat `tf1' `tf2'
sort agegrp sex mean1
egen axis = axis(mean1 agegrp sex), label(agegrp sex) replace axis = axis[_n-1] if axis == .
egen group = group(agegrp sex), label
----

Here I get as labels in axis correctly labelled cases and incorrect labelled cases whereas group() does the labelling correctly.

Correct labels are 30-45 Male
Incorrect labels are 46-59 or Male

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index