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

st: Re: sum of residuals=zero?


From   "Scott Merryman" <[email protected]>
To   <[email protected]>
Subject   st: Re: sum of residuals=zero?
Date   Sat, 9 Nov 2002 08:21:56 -0600

The default variable type for predict is float.  If you specify double you will
get much higher precision.

. use "C:\Stata\auto.dta", clear
(1978 Automobile Data)

. qui reg price mpg

. predict double res, res

. sum res

    Variable |     Obs        Mean   Std. Dev.       Min        Max
-------------+-----------------------------------------------------
         res |      74   -2.58e-13   2605.621  -3184.174   9669.721



Scott

----- Original Message -----
From: "Giovanni Vecchi" <[email protected]>
To: <[email protected]>
Sent: Saturday, November 09, 2002 3:45 AM
Subject: st: sum of residuals=zero?


> Dear statalisters:
>
> I would appreciate your comments on the following:
>
> use auto.dta
> regress price mpg
>
> (output omitted)
>
> predict resid,res
>
> egen sumres=sum(resid)
>
> sum sumres
>
>     Variable |     Obs        Mean   Std. Dev.       Min        Max
> -------------+-----------------------------------------------------
>       sumres |      74   -.0004654          0  -.0004654  -.0004654
>
>
> The sum of residuals (which should be zero according to the theory) is
> -.0004654. This estimates looks "high" to me.
> I run the code above in Gauss and obtained a much lower estimates
> (something like 9*10^-10).
>
> Any suggestion to understand the reason for the above discrepancy?
>
>
> Thank you.
>
> Giovanni
>


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