Exercise

# Confidence intervals for the average response for all observations

The confidence interval for the average response can be computed for all observations in the dataset. Using `augment()`

directly on the `twins`

dataset gives predictions and standard errors for the Foster twin based on all the Biological observations.

Note that the calculation of the regression line is more stable at the center, so predictions for the extreme values are more variable than predictions in the middle of the range of explanatory IQs.

The foster twin IQ predictions that you calculated last time are provided as `predictions`

. These predictions are shown in a plot using `geom_smooth()`

.

Instructions

**100 XP**

Manually create what `geom_smooth()`

does, using `predictions`

. Provide the aesthetics and data to each geom.

- Add a point layer of
`Foster`

vs.`Biological`

, using the`data = twins`

dataset. - Add a line layer of
`.fitted`

vs.`Biological`

, using the`data = predictions`

dataset. Color the line`"blue"`

. - Add a ribbon layer with
`x`

mapped to`Biological`

,`ymin`

mapped to`lower_mean_prediction`

and`ymax`

mapped to`upper_mean_prediction`

. Use the`data = predictions`

dataset and set the transparency,`alpha`

to`0.2`

.