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]

Re: st: logarithmic graphing problem


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: logarithmic graphing problem
Date   Thu, 2 Jun 2011 09:43:06 +0100

See

Cox, N. J. 2011. Stata tip 96: Cube roots. Stata Journal 11(1): 149-154.

http://www.stata-journal.com/article.html?article=st0223

for some suggestions. In a sentence, cube root is suggested there as
the simplest transformation that pulls in tails and treats values
around 0 symmetrically. See also

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

On Wed, Jun 1, 2011 at 11:57 PM, Dimitriy V. Masterov
<dvmaster@gmail.com> wrote:

> I would like to graph the effect of various variables on two outcomes.
> My effects data looks like this:
>
> outcome1        outcome2        variable
> -1.236299       -74.97698       one
> 1.316959        35.64509        two
>
> I want to make a scatter plot with outcome2 on the y axis and outcome1
> on the x, with variable serving as the label for the points. The
> problem is that the effects for the two outcomes are clustered around
> (0,0), so it would be nice to put the data on a log-like scale. The
> problem is that I have negative and zero effects and I would like to
> keep the axis labels in dollars. Is there any way of doing this in
> Stata?
>
> You can see the problem I have with the following fake data example
> (which uses num2words from ssc to generate the variable variable):
>
> /* fake data */
> #delimit;
> clear;
> matrix m = (0,0);
> matrix sd =(5,10);
> drawnorm x y, n(100) means(m) sds(sd);
>
> gen outcome1=sign(x)*x^2;
> gen outcome2=sign(y)*y^2;
> gen l=_n;
> num2words l, gen(variable);
> drop l;
>
> /* graph */
> twoway scatter outcome2 outcome1, xline(0) yline(0) mlab(variable)
> mlabangle(45);

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