Problem 1

Find formulas for prediction and confidence intervals for \(y|x=x_0\) in a no-intercept model. Use simulation to show that your formulas are proper 95% confidence intervals in the case \(x=1:100/100\), \(y=x+\epsilon_i\), \(\epsilon_i\sim N(0,1/2)\) and \(x_0=0.5\).

Problem 2

A popular graph in many fields of science is the following: A scatterplot with the fitted curve and “error bars” on each of the observations, that is 95% confidence intervals. An example is shown here:

set.seed(111)
x=1:10
y=2+4*x+rnorm(10, 0, 2)

## [1] 7
  1. write a routine that creates this graph for any simple regression problem.

  2. Use simulation to find the coverage of these intervals if they are interpreted as familywise intervals.

Note: in the example above 7 of the 10 intervals cross the least squares regression line. The familywise-coverage is the percentage of cases where all of the intervals cross the line.

  1. Find a method that yields intervals which have a true familywise error rate of 68%.