Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Regplot Problems!


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: Regplot Problems!
Date   Wed, 19 Feb 2003 18:50:58 -0000

Al-Zakwani, Ibrahim

> Just to add to a question that was posted earlier regarding
> <regplot>
> I am also experiencing problems..
> Below, please find the output..
> I would appreciate any insight as to what might be a problem...
> I am using Stata version 8 - Windows 2000
> Thanking you in advance..
>
> Ibrahim
>
>
> . sysuse auto
> (1978 Automobile Data)
>
> . regress foreign
>
>       Source |       SS       df       MS
> Number of obs =
> 74
> -------------+------------------------------           F(
> 0,    73) =
> 0.00
>        Model |           0     0           .           Prob
> > F      =
> .
>     Residual |  15.4594595    73  .211773417
> R-squared     =
> 0.0000
> -------------+------------------------------           Adj
> R-squared =
> 0.0000
>        Total |  15.4594595    73  .211773417           Root
> MSE      =
> .46019
>
> ------------------------------------------------------------
> ----------------
> --
>      foreign |      Coef.   Std. Err.      t    P>|t|     [95% Conf.
> Interval]
> -------------+----------------------------------------------
> ----------------
> --
>        _cons |   .2972973   .0534958     5.56   0.000     .1906803
> .4039143
> ------------------------------------------------------------
> ----------------
> --
>
> . regplot
> variable _cons not found
> no variables defined
> no variables defined
> r(111);
>

This one's different.

You fitted a regression with response and no
predictor. That's perfectly meaningful and
-regress- bounced back the mean of foreign
at you.

However, -regplot- expects to pick up
a predictor from among the -regress- results,
but it can only find _cons, and Stata tells
-regplot- that no such variable exists, because
_cons is just Stata jargon for the intercept.

There is an interesting little question of
program design here. I as programmer should
trap this. I can think of two possibilities.

1. You want this
================

. regress foreign

was entirely deliberate and you do want
to see -regplot-, which would be a single
horizontal line y = mean of foreign and
anything you like on the horizontal axis.
That wouldn't be tremendously interesting
or useful but it would be valid, except
that it would be quite arbitrary what
I plot the data for foreign against.

2. You made a mistake
=====================

You forgot to specify a predictor
and haven't spotted that yet. -regplot-
should say, "Excuse me, no predictor variable".

I incline to 2.

Nick
[email protected]

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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