Nick Cox,
Many thanks for the reply and sorry for the mistake..
However, even after rectifying this, an error still occurs..
Please find another example below..
Thanks again...
Ibrahim
. sysuse auto, clear
(1978 Automobile Data)
. regress mpg weight
Source | SS df MS Number of obs =
74
-------------+------------------------------ F( 1, 72) =
134.62
Model | 1591.9902 1 1591.9902 Prob > F =
0.0000
Residual | 851.469256 72 11.8259619 R-squared =
0.6515
-------------+------------------------------ Adj R-squared =
0.6467
Total | 2443.45946 73 33.4720474 Root MSE =
3.4389
----------------------------------------------------------------------------
--
mpg | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+--------------------------------------------------------------
--
weight | -.0060087 .0005179 -11.60 0.000 -.0070411
-.0049763
_cons | 39.44028 1.614003 24.44 0.000 36.22283
42.65774
----------------------------------------------------------------------------
--
.
. regplot
invalid label specifier, : `"data and fit for Mileage (mpg)"':
invalid syntax
invalid syntax
r(198);
-----Original Message-----
From: Nick Cox [mailto:[email protected]]
Sent: Wednesday, February 19, 2003 1:51 PM
To: [email protected]
Subject: st: RE: Regplot Problems!
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/
*
* 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/