0

How can you with Stata test the null hypothesis against the alternative hypothesis. If I have the hypothesis H_0:\beta_1=\beta_2=0 against H_A:\beta_1 ≠ \beta_2 ≠ 0. What will the code be?

Lifeni
  • 159
  • 5

1 Answers1

3

This can be done using testparm or test:

. sysuse auto, clear
    (1978 Automobile Data)

. replace weight = weight/1000
variable weight was int now float
(74 real changes made)

. reg price mpg weight i.foreign 

      Source |       SS           df       MS      Number of obs   =        74
-------------+----------------------------------   F(3, 70)        =     23.29
       Model |   317252879         3   105750960   Prob > F        =    0.0000
    Residual |   317812517        70  4540178.81   R-squared       =    0.4996
-------------+----------------------------------   Adj R-squared   =    0.4781
       Total |   635065396        73  8699525.97   Root MSE        =    2130.8

------------------------------------------------------------------------------
       price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         mpg |   21.85361   74.22114     0.29   0.769    -126.1758     169.883
      weight |   3464.706    630.749     5.49   0.000     2206.717    4722.695
             |
     foreign |
    Foreign  |    3673.06   683.9783     5.37   0.000     2308.909    5037.212
       _cons |  -5853.696   3376.987    -1.73   0.087    -12588.88    881.4934
------------------------------------------------------------------------------

. test weight=1.foreign=3500

 ( 1)  weight - 1.foreign = 0
 ( 2)  weight = 3500

       F(  2,    70) =    0.05
            Prob > F =    0.9466

The two-sided p-value is stored in r(p):

. display r(p)
.94664298
dimitriy
  • 9,077
  • 2
  • 25
  • 50