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: RE: twoway, xscale( exp )?


From   Nick Cox <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   st: RE: twoway, xscale( exp )?
Date   Fri, 12 Aug 2011 17:19:07 +0100

I've pointed out a few times that Stata's "nice" labels for logarithmic scales don't work well and some unfinished code in a program not yet released is an attempt to do better. 

Two things of mine in this territory that are public are 

mylabels from http://fmwww.bc.edu/RePEc/bocode/m
    'MYLABELS': module for axis labels or ticks on transformed scales or for
    daily dates / mylabels and myticks generate axis labels and ticks on /
    transformed scales. Their use is best explained by example. You / draw a
    graph and one axis is on a transformed square root scale. / You wish the

SJ-8-1  gr0032  . . . . . . .  Stata tip 59: Plotting on any transformed scale
        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  N. J. Cox
        Q1/08   SJ 8(1):142--145                                 (no commands)
        tip on how to graph data on a transformed scale

In this case, something like 

. mylabels 4000(2000)16000, myscale(ln(@)) local(lbl)

And you then use `lbl' within -xla()-. 

Nick 
[email protected] 

Stas Kolenikov

I have performed some analysis for a variable in its log scale, and I
wanted to graph these results (a moderately complex combination of
several -twoway- plots) showing the original scale of the variable.
There is -xscale( log )- option to go from $ to log($) for income
distributions and from OR to logit coefficients in binary models, but
I could not find an option that goes the other direction to
exponentiate things for labeling purposes. Is it possible to
meaningfully emulate it? I have logs in the range of about 5 to 10
which translate to levels in the thousands range, so putting them on
the same graph, while technically possible, leads to totally obscure
(and simply wrong) pictures.

As an example, think about

sysuse auto, clear
gen lprice = log(price)
twoway (kdensity lprice) (hist lprice)

My idea is to have something like -twoway ... , xaxis(1 2)- with the
second axis showing the original dollar amounts.

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