Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

st: "twoway function" (& closure on "test 2")

From   "Allan Reese (Cefas)" <>
To   <>
Subject   st: "twoway function" (& closure on "test 2")
Date   Wed, 11 May 2011 10:57:37 +0100

As a health & safety champion, I have to demur from Nick Cox's attitude
to IT pratfalls.

From: Nick Cox Subject: Re: st: plotting a regression function with
time-dummies indicating structural breaks

- -twoway function- has been around since Stata 8 (2003). Its use of x
regardless of whatever x might be in the data is documented. Its
capacity for small surprises when you want to use some or all of your
data as well is less surprising on brief examination. I agree that
there is a case for considering a tweak of the documentation here, but
I see no evidence that -twoway function- does not work as intended.

In the first place, I'm not sure I understand how, or if, y=function(x
z) was intended to operate.  It is documented that y and x are
interpreted as dummy variables and not affected by "y" or "x" being in
the current dataset.  The documentation does not say how z will be used
when it is in the dataset, and it appears to be controlled by the number
of calculated points (default 300) and number of observations in the
dataset.  Eg, using the auto data,  
     twoway function y=mpg  /* plots over 74/300 of the "x" range */
     twoway function y1=mpg, n(37) range(0 .5) || function y2=mpg, n(74)
/* doesn't quite match */
     twoway function y1=mpg, n(37) range(0 `=36.5/74') clcol(blue) ||
function y2=mpg, n(74) clpattern(_) /* kludge! */

The H&S approach to hazards is hierarchical: (1) can the hazard be
removed? (2) can it be circumvented or mitigated? (3) protect and warn
people who might meet it.

Computers are deterministic machines, and I don't appreciate small
surprises.  Over to the Corp...

Re "Test 2" yesterday.  The reason my messages to Statalist started
bouncing last week was that "the system" started adding an HTML
disclaimer to my messages, after I had set the email editor to plain
text. Grrr.


*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index