This is an exam!! You can use any written material and online source, but you can NOT discuss the exam with ANYONE!

Problem 1

Say we have a simple regression model \(y_i=\beta_0+\beta_1 x_i+\epsilon_i\), \(\pmb{\epsilon}\sim N(\pmb{0},\sigma^2\pmb{I})\).

  1. Derive a test for

\[H_0:\beta_1=b\text{ vs. }H_a:\beta_1\ne b\]

  1. Use the test in a. to find a \((1-\alpha)100\%\) confidence interval for \(\beta_1\).

Problem 2

Say we have a regression model \(y_i=\beta_0+\beta_1 x_i+\beta_2 z_i+\epsilon_i\), \(\pmb{\epsilon}\sim N(\pmb{0},\sigma^2\pmb{I})\). Find a \((1-\alpha)100\%\) confidence interval for \(\delta=\beta_1-\beta_2\).

Problem 3

In a drug trial participants were divided into three groups: No Drug, Placebo and Drug. The hours until marked improvement were noted. The data is

## $`No Drug`
##  [1] 17.7 18.5 19.0 19.1 19.5 19.7 19.7 19.8 20.1 20.2
## 
## $Placebo
## [1] 18.4 19.6 19.6 19.8 19.9 20.4 20.8 21.8
## 
## $Drug
##  [1] 21.2 21.7 21.8 22.8 23.2 23.2 23.3 23.3 23.4 23.4 23.6 25.7

Applying the summary to the aov command yields

summary(aov(Time~Treatment, data=df))
##             Df Sum Sq Mean Sq F value  Pr(>F)
## Treatment    2  85.73   42.86   42.94 4.1e-09
## Residuals   27  26.95    1.00

Write an R routine myaovsummary that takes data from ANY one-way ANOVA experiment and print the same output. Your routine should NOT use either the aov or lm commands.

myaovsummary(df$Treatment, df$Time)
##           Df Sum Sq Mean Sq F value Pr(>F)
## Treatment  2  85.73   42.86   42.94      0
## Residuals 27  26.95    1.00

Problem 4

A pharmaceutical company set up an experiment in which patients with a common type of headache were treated with a new analgesic or pain reliever. The analgesic was given to each patient in one of four dosage levels: 2,5,7 or 10 grams. Then the time until noticeable relieve was recorded in minutes. In addition the sex and the blood pressure of each patient was recorded. The blood pressure groups where formed by comparing each patients diastolic and systolic pressure reading with historical data. Based on this comparison the patients are assigned to one of three types: low (0.25), medium (0.5), high (0.75) according to the respective quantiles of the historic data.

The data set is called headache and is part of Resma3.

Find best (statistically significantly) best dosage level(s) for each patient. Make sure your analysis is complete (that is check assumptions etc)