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

st: Re: Putting variable ylines in a graph

From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: Re: Putting variable ylines in a graph
Date   Thu, 21 Jan 2010 19:54:16 -0000

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

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