# Joint hypothesis testing: How to set up restricted model for equality of more than 2 coefficients?

Say I am running the following regression:

$$Y=\beta_0 + \beta_1X + \beta_2Z +\beta_3W + othercontrols + error$$

I want to test the null hypothesis that the first three coefficients are equal, or: $$H_o = \beta_1=\beta_2=\beta_3$$

I know how to calculate this on statistical software(e.g. Stata), but I am curious how you would do this by hand. Here is my thought, first setting up the 'restricted' model:

Noting that this is saying $$\beta_1 = \beta_2$$ and $$\beta_1=\beta_3$$,

I can plug in $$\beta_1$$ for all three coefficients to get:

$$Y=\beta_0 + \beta_1X + \beta_1Z +\beta_1W + othercontrols + error$$

which becomes:

$$Y=\beta_0 + \beta_1(X+Y+Z) + othercontrols + error$$

and from that, I can generate a new variable which is just the sum of these three, call it G,and the regress:

$$Y=\beta_0 + \beta_1G + othercontrols + error$$

and use that to get the error some of squares for the F test? Is this the right track?

• Minor comment. When you change the specification like this, it's often helpful to also alter the coefficients with new letters (or tildes or primes) since they are no longer quite the same. Commented Jun 24, 2021 at 23:30
• Ditto for the error terms. Commented Jun 24, 2021 at 23:41
• ok that makes sense, thanks for pointing that out! Commented Jun 25, 2021 at 18:20

Your approach is indeed on the right track. More precisely, you first fit the unrestricted model where all the covariates can have different coefficients. You then fit the restricted model where you enter the sum as a covariate instead of individual terms, so the coefficients are restricted to be the same for all three of them. An adjusted change in the sum of squared residuals between the two models gives you the F statistic you use to test the equality restriction.

This is covered here for a different type of restriction, but the formula is the same, so it is straightforward to extend it to your setting.

Here is Stata code showing how to do the calculation:

. sysuse auto, clear
(1978 automobile data)

.
. /* Hypothesis Test Using Stata */
. reg price mpg weight foreign length

Source |       SS           df       MS      Number of obs   =        74
-------------+----------------------------------   F(4, 69)        =     21.01
Model |   348708940         4    87177235   Prob > F        =    0.0000
Residual |   286356456        69  4150093.57   R-squared       =    0.5491
Total |   635065396        73  8699525.97   Root MSE        =    2037.2

------------------------------------------------------------------------------
price | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
mpg |  -13.40719   72.10761    -0.19   0.853    -157.2579    130.4436
weight |   5.716181   1.016095     5.63   0.000     3.689127    7.743235
foreign |   3550.194   655.4564     5.42   0.000     2242.594    4857.793
length |  -92.48018    33.5912    -2.75   0.008    -159.4928   -25.46758
_cons |    5515.58   5241.941     1.05   0.296    -4941.807    15972.97
------------------------------------------------------------------------------

. test  mpg == weight == foreign

( 1)  mpg - weight = 0
( 2)  mpg - foreign = 0

F(  2,    69) =   15.46
Prob > F =    0.0000

. display "F = " r(F)
F = 15.462448


Now we can do it by hand:

. /* Same Hypothesis Test By Hand in Stata */
. /* (1) Fit Unconstrained Model */
. reg price mpg weight foreign length

Source |       SS           df       MS      Number of obs   =        74
-------------+----------------------------------   F(4, 69)        =     21.01
Model |   348708940         4    87177235   Prob > F        =    0.0000
Residual |   286356456        69  4150093.57   R-squared       =    0.5491
Total |   635065396        73  8699525.97   Root MSE        =    2037.2

------------------------------------------------------------------------------
price | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
mpg |  -13.40719   72.10761    -0.19   0.853    -157.2579    130.4436
weight |   5.716181   1.016095     5.63   0.000     3.689127    7.743235
foreign |   3550.194   655.4564     5.42   0.000     2242.594    4857.793
length |  -92.48018    33.5912    -2.75   0.008    -159.4928   -25.46758
_cons |    5515.58   5241.941     1.05   0.296    -4941.807    15972.97
------------------------------------------------------------------------------

.
. /* (2) Fit Constrained Model */
. gen sum_of_three = mpg + weight + foreign

. reg price sum_of_three length

Source |       SS           df       MS      Number of obs   =        74
-------------+----------------------------------   F(2, 71)        =     18.86
Model |   220367724         2   110183862   Prob > F        =    0.0000
Residual |   414697672        71  5840812.28   R-squared       =    0.3470
Total |   635065396        73  8699525.97   Root MSE        =    2416.8

------------------------------------------------------------------------------
price | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
sum_of_three |   4.709994   1.127407     4.18   0.000     2.462008     6.95798
length |  -97.29181   39.10159    -2.49   0.015    -175.2582   -19.32545
_cons |    10126.2    4263.61     2.38   0.020     1624.799    18627.59
------------------------------------------------------------------------------