---
title: "STAT 3340 Assignment 4, Fall  2025, due Thursday, November 20, 11:59 PM"
output:
  pdf_document: default
  html_document: default
  word_document: default
---



1.  The regression model  $y = \beta_0 + \beta_1 X_1 + \beta_2 X_2 + \epsilon$ was fit to a data set   with $n=24$ observations, and resulted in MSE=16, with $\hat \beta$ and  $(X'X)^{-1}$ given by:

```{r}  
hatbeta= c(1000, 100, -200); hatbeta
xpxinverse=matrix(c(15,8,7,8,12,5,7,5,20), byrow=T,ncol=3); xpxinverse
```
  + 1a) Construct a 95\% confidence interval for $\beta_1$.

  + 1b) Construct simultaneous 90\% confidence intervals for $\beta_1$ and $\beta_2$.

  + 1c) Construct a 99\% confidence interval for $\beta_0 - 2 \beta_1 + \beta_2$.

  + 1d) Is the value $\beta=c(950, 90, -230)$ contained in the 95\% confidence ellipse
for $\beta$?   (Hint: Calculate  the value of ${({\hat \beta} - \beta)}^T (X'X) (\hat \beta - \beta)$ and compare it to
$p MSE \,\, qf(.95, p, n-p)$.)  Show your work.

2. In a study of 1006 men in four occupations, a multiple regression was carried out to show how lung function was related to age, smoking and occupation.  The four occupations represented in the study were physician, firefighter, farm worker, and chemical worker.  The variables in the regression were:

\begin{center}
\begin{tabular}{l l}
Y& air capacity (ml) that the worker can expire in one second \\
$X_1$& age in years \\
$X_2$& number of cigarettes smoked per day \\
$X_3$& 1 if chemical worker, 0 otherwise \\
$X_4$& 1 if farm worker, 0 otherwise \\
$X_5$& 1 if firefighter, 0 otherwise 
\end{tabular}
\end{center}

The model $Y=\beta_0+\beta_1 X_1 + \beta_2 X_2 + \beta_3 X_3 + \beta_4 X_4 + \beta_5 X_5 + e$ was fit to the data with the following result:
$$\hat Y = 4500 - 39 X_1 -9 X_2 - 350 X_3 -380 X_4 -180 X_5$$

   +  2a) What is the mean air capacity of a 20 year old farmworker who smokes 10 cigarettes per day? 

   +  2b) What is the estimated difference in air capacity between two farmers of the same age, one of whom smokes 10 cigarettes per day, and the other of whom does not smoke? 

3.  Prove that $\bf H \bf X = \bf X$. \marginpar{(2)} (Hint:  this is one line of algebra.)






