In the *Creating scatterplots and line plots* section in Chapter 1, *Base Graphics in R – One Step at a Time*, we saw how to use the `abline()`

command and the `lm()`

command to include a regression line in your graph. Now, we will take this idea a little further. The following regression uses a datafile in which a sample of 10 people rated a film by awarding scores out of 100. These people then viewed the film a second time 1 month later and again awarded scores. We wish to use a regression model to see how well the first rating scores predicted the second rating.

In an OLS regression with one predictor, we fit a model of the following form:

Y_{i}= β_{0}+ β_{1}X_{i}+ e_{i}

In this form, β

is the intercept, β_{0}

is the slope, ..._{1}

Start Free Trial

No credit card required