Statalist


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

Re: st: Bug in -test- after -estimates restore- ?


From   Austin Nichols <austinnichols@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Bug in -test- after -estimates restore- ?
Date   Fri, 4 Dec 2009 14:12:34 -0500

Antoine Terracol <terracol@univ-paris1.fr>:
Not a bug per se, but a known annoyance to many. Try instead:

sysuse auto, clear
reg price mpg weight
estimates store a
clear
estimates restore a
test mpg
test _b[mpg]=0

*similar when referring to names in e(b) that do not correspond to actual vars:
sysuse auto
svyset [pw=weight]
svy:tab rep78
test _b[p21]=.1

On Fri, Dec 4, 2009 at 1:19 PM, Antoine Terracol
<terracol@univ-paris1.fr> wrote:
> Dear _all,
>
> I think I found a bug in -test- when using -restore-d estimates when the
> original dataset has been -clear-ed:
>
> . sysuse auto, clear
> (1978 Automobile Data)
>
> . reg price mpg weight
> <snip>
>
> . estimates store a
>
> . clear
>
> . estimates restore a
> (results a are active now)
>
> . test mpg
>
>  ( 1)  mpg = 0
>
>       F(  1,    71) =    0.33
>            Prob > F =    0.5673
>
> . test mpg=0
> mpg not found
> r(111);
>
>
> when -test-ing against a given value, Stata gives an error if the variable
> being tested is absent from the dataset.
>
> Now if I
>
> . gen mpg=.
>
> . test mpg=0
>
>  ( 1)  mpg = 0
>
>       F(  1,    71) =    0.33
>            Prob > F =    0.5673
>
>
> If a variable with the "correct" name is present, -test- works again as
> expected
>
> Antoine

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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