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

st: RE: Re: Putting variable ylines in a graph

From   "Lachenbruch, Peter" <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   st: RE: Re: Putting variable ylines in a graph
Date   Thu, 21 Jan 2010 14:28:01 -0800

Thanks, Nick.  I got everything but the equals in one try or another...


Peter A. Lachenbruch
Department of Public Health
Oregon State University
Corvallis, OR 97330
Phone: 541-737-3832
FAX: 541-737-4001

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Nick Cox
Sent: Thursday, January 21, 2010 11:54 AM
To: [email protected]
Subject: st: Re: Putting variable ylines in a graph

-yline()- is strict: it needs a numlist. However, you can do calculations on the fly using a standard construct. 

rvfplot, yli(`=-2*e(rmse)' `=2*e(rmse)') 

The `=exp' syntax is explained at -help macro-. 

If you type `=2 * e(rmse)', for example, Stata reads this as 

1. Do the calculation 2 * e(rmse)

2. Insert the result at this place so that the command being typed can see it. 

Thus -yline()- is pretty dumb and certainly contains no hidden calculator, but the rest of Stata is up to doing what you want. 

As usual, start with a left quote ` and finish with a right quote '. 

[email protected] 

From: Lachenbruch, Peter [mailto:[email protected]] 
I am using rvfplot to graph residuals and I would like to draw lines at -2 sd and 2 sd limits.
My thought was to use rvfplot, yline(-2*e(rmse) 2*e(rmse))
But Stata did not like it:
. rvfplot,yline(2*e(rmse) 2*e(rmse))
invalid line argument, -2*(e(rmse) 2*e(rmse)
I tried setting the limits to a scalar or a local scalar, but I got the same result (I had set scalar L= 2*e(rmse) )
.rvfplot,yline(-L L)
invalid line argument, -L L
Is there a way to do this or does yline require numbers rather than functions?
I could do several twoway plots (one for residuals,one for the upper limit, one for the lower limit), but this seems a bit cumbersome

*   For searches and help try:

*   For searches and help try:

© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index