Exercise

# Intercepts

Intercepts are an important part of regression models, including hierarchical models. Without other coefficients, a single intercept is the global mean of the data. Similarly, multiple intercepts allow you to estimate the mean for each group as long as other coefficients are not estimated.

Using simulated data, you will see how means and intercepts are identical under situations without other coefficients. First, plot the raw data. Second, build a linear model and then plot the results. Extracting and plotting linear models results in R requires data wrangling, a topic covered in other R courses, so the code to do this is included here.

The simulated `data.frame`

, `intDemo`

, includes 2 columns: `predictor`

and `response`

.

Instructions

**100 XP**

Use

`ggplot2`

to plot the means of each group.`predictor`

is your x-variable.`response`

is your y-variable.Fit a linear model and then plot the results.

`predictor`

"predicts" the response`response`

.Run the code to extract and plot the outputs. This code should work as written.