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 at the end of May, and its replacement, statalist.org is already up and running.


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

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


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Correct labeling in egenmore axis()?
Date   Tue, 11 May 2010 16:09:54 +0100

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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index