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: logarithmic graphing problem


From   "Dimitriy V. Masterov" <dvmaster@gmail.com>
To   Statalist <statalist@hsphsun2.harvard.edu>
Subject   st: logarithmic graphing problem
Date   Wed, 1 Jun 2011 18:57:39 -0400

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