Skip to content
Registration for R in 3 Months opens August 21. Get notified →

Inferential Statistics with R

# Linear Regression

### Transcript

Click on the transcript to go to that point in the video. Please note that transcripts are auto generated and may contain minor inaccuracies.

## Your Turn

Perform a linear regression examining how `iq` predicts `act_reading`. Ask for standardized coefficients before calling for the summary of results. Is IQ a significant predictor of ACT reading scores? If so, what is the standardized coefficient?

## Learn More

Read more about the `lm()` function in the stats package. If you’d like to learn more, check out this tutorial in YaRrr! The Pirate’s Guide to R by Nathaniel D. Phillips.

Although not covered in these videos, it should be noted that all previously covered statistics up to this point are essentially linear models. This blog post by Dr. Athanasia Monika Mowinckel nicely illustrates how we could have done all the statistics using the lm() function instead.

## Have any questions? Put them below and we will help you out!

You need to be signed-in to comment on this post. Login.

#### Amalie Baisgaard • June 20, 2024

I cant seem to get the code to work with:

college |> lm(act_reading ~ iq, data = .) ....

I get the following message: Error in eval(mf, parent.frame()) : object '.' not found.

However, I can get it to work if I just assign the data as data = college

lm(act_reading ~ iq, data = college)

Can you explain what I am missing?

#### David Keyes Founder • June 20, 2024

Yes, you can't use the `.` with the native pipe (`|>`). However, if you use the tidyverse pipe, it should work:

``````college %>% lm(act_reading ~ iq, data = .)
``````

Let me know if that solves the issue!

21 Lessons