This book is in Open Review. We want your feedback to make the book better for you and other students. You may annotate some text by selecting it with the cursor and then click the on the pop-up menu. You can also see the annotations of others: click the in the upper right hand corner of the page

7.7 Exercises

1. Hypothesis Testing in a Multiple Regression Model — tt-statistics and pp-values

Reconsider the Boston data set and the following estimated model (homoscedasticity-only standard errors in parentheses) from the previous chapter:

^medvi=32.828(0.75)0.994(0.05)×lstati0.083(0.04)×crimi+0.038(0.01)×agei.ˆmedvi=32.828(0.75)0.994(0.05)×lstati0.083(0.04)×crimi+0.038(0.01)×agei.

Just as in the simple linear regression framework we can conduct hypothesis tests about the coefficients in multiple regression models. The most common hypothesis is H0:βj=0H0:βj=0 against the alternative H1:βj0H1:βj0 for some jj in 0,1,,k0,1,,k.

The packages AER and MASS have been loaded. The coefficient estimates as well as the corresponding standard errors are available in coefs and SEs, respectively.

Instructions:

Use vector arithmetics to solve the following tasks:

  • Compute tt-statistics for each coefficient by using the predefined objects coefs and SEs. Assign them to tstats.

  • Compute pp-values for each coefficient and assign them to pval.

  • Check with the help of logical operators whether the hypotheses are rejected at the 1%1% significance level.

Hints:

  • The tt-statistic for each coefficient is defined as t=ˆβjβj,0SE(ˆβj)t=ˆβjβj,0SE(ˆβj).

  • The pp-value for a two-sided test using is computed as 2Φ(|tact|)2Φ(|tact|) where tacttact denotes the computed tt-statistic.

2. Hypothesis Testing in a Multiple Regression Model - Confidence Intervals

Consider again the estimated model

^medvi=32.828(0.75)0.994(0.05)×lstati0.083(0.04)×crimi+0.038(0.01)×agei.ˆmedvi=32.828(0.75)0.994(0.05)×lstati0.083(0.04)×crimi+0.038(0.01)×agei.

which is available as the object mod in your working environment. The packages AER and MASS have been loaded.

Instructions:

  • Construct 99%99% confidence intervals for all model coefficients. Use the intervals to decide whether the individual null hypotheses H0:βj=0H0:βj=0, j=0,1,2,3,4j=0,1,2,3,4 are rejected at the 1%1% level.

Hint:

  • You may use confint() to construct confidence intervals. The confidence level can be set via the argument level.

3. Robust Hypothesis Testing in Multiple Regression Models

The lm object mod from the previous exercises is available in your working environment. The packages AER and MASS have been loaded.

Instructions:

  • Print a coefficient summary that reports heteroscedasticity-robust standard errors.

  • Access entries of the matrix generated by coeftest() to check whether the hypotheses are rejected at a 1% significance level. Use logical operators <,>.

Hints:

  • Using the argument vcov. in coeftest() forces the function to use robust standard errors.

  • The pp-values are contained in the fourth column of the output generated by coeftest(). Use square brackets to subset the matrix accordingly.

4. Joint Hypothesis Testing — FF-Test I

Sometimes we are interested in testing joint hypotheses which impose restrictions on multiple regression coefficients. For example, in the model

medvi=β0+β1×lstati+β2×crimi+β3×agei+uimedvi=β0+β1×lstati+β2×crimi+β3×agei+ui

we may test the null H0:β2=β3H0:β2=β3 vs. the alternative H1:β2β3H1:β2β3 (which is a joint hypothesis as we impose a restriction on two regression coefficients).

The basic idea behind testing such a hypothesis is to conduct two regressions and to compare the outcomes: for one of the regressions we impose the restrictions of formalized by the null (we call this the restricted regression model), whereas for the other regression the restriction is left out (we call this the unrestricted model). From this starting point we construct a test-statistic which, under the null, follows a well known distribution, an FF distribution (see the next exercise).

However, in this exercise we start with the initial computations necessary to construct the test statistic.

The packages AER and MASS have been loaded.

Instructions:

  • Estimate the restricted model, that is, the model where the restriction formalized by H0:β2=β3H0:β2=β3 is assumed to be true. Save the model in model_res.

  • Compute the SSRSSR of the restricted model and assign it to RSSR.

  • Estimate the unrestricted model, that is, the model where the restriction is assumed to be false. Save it in model_unres.

  • Compute the SSRSSR of the unrestricted model and assign it to USSR.

Hints:

  • The restricted model can be written as medvi=β0+β1×lstati+β2×crimi+β2×agei+uimedvi=β0+β1×lstati+β2×crimi+β2×agei+ui which, after rearranging, can be expressed as medvi=β0+β1×lstati+β2×(crimi+agei)+ui.medvi=β0+β1×lstati+β2×(crimi+agei)+ui.

  • The SSRSSR is defined as the sum of the squared residuals.

  • Note that the residuals of a regression model are available as residuals in the corresponding lm object. So you can access them as usual via the $-operator.

5. Joint Hypothesis Testing — F-Test II

After estimating the models and computing the SSRSSRs you now have to compute the test-statistic and conduct the FF-test. As mentioned in the last exercise, the test-statistic follows an FF distribution. More precisely, we deal with the Fq,nk1Fq,nk1 distribution where qq denotes the number of restrictions under the null and kk is the of regressors in the unrestricted model, excluding the intercept.

The packages AER and MASS have been loaded. Both models (model_res and model_unres) as well as their SSR (RSSR and USSR) are available in your working environment.

Instructions:

  • Compute the FF-statistic and assign it to Fstat.

  • Compute the pp-value and assign it to pval.

  • Check whether the null is rejected at the 1%1% level using logical operators.

  • Verify your result by using linearHypothesis() and printing the results.

Hints:

  • The FF-statistic is defined as RSSRUSSR/qUSSR/(nk1)RSSRUSSR/qUSSR/(nk1).

  • The pp-value can be computed as 1Fq,nk1(Fact)1Fq,nk1(Fact) where Fq,nk1Fq,nk1 denotes the CDF of the FF-distribution (pf()) with degrees of freedom qq and nk1nk1 and FactFact the computed FF-statistic.

  • linearHypothesis() expects the unrestricted model as well as the null hypothesis as arguments.

6. Joint Hypothesis Testing - Confidence Set

As you know from previous chapters constructing a confidence set for a single regression coefficient results in a simple confidence interval on the real line. However if we consider nn regression coefficients jointly (as we do in a joint hypothesis testing setting) we move from R to Rn resulting in a n-dimensional confidence set. For the sake of illustration we then often choose n=2, so that we end up with a representable two-dimensional plane.

Recall the estimated model

^medvi=32.828(0.75)0.994(0.05)×lstati0.083(0.04)×crimi+0.038(0.01)×agei.

which is available as mod in your working environment. Assume you want to test the null H0:β2=β3=0 vs. H1:β20 or β30.

The packages AER and MASS have been loaded.

Instructions:

  • Construct a 99% confidence set for the coefficients of crim and lstat, that is a two-dimensional confidence set. Can you reject the null stated above?

  • Verify your visual inspection by conducting a corresponding F-test.

Hints:

  • Use confidenceEllipse() to construct a two-dimensional confidence set. Besides the coefficients for which the confidence set shall be constructed (which.coef), you have to specify the confidence level (levels).

  • As usual you can use linearHypothesis() to conduct the F-test. Note that there are two restrictions now, hence you have to pass a vector containing both restrictions.