Simple Linear Regression

Lecture Demo

Dr. Elijah Meyer

Duke University
STA 199 - Fall 2023

2024-02-05

Checklist

Before class starts, I pull up a checklist of information that students may reference to help best situate them in and outside of class. Items often include:

– Be checking Slack

– Clone the in-class activity from GitHub

– Due Dates

Warm Up Questions

– Typically between 1-3 questions

– Provide students a “no stakes” assessment on previous material

– Students are encouraged to work alone, or in a group setting

Warm Up

– What is a simple linear regression? Why do we care?

Warm Up

– What is a simple linear regression? Why do we care?

– Model data using a straight line

– Helps us understand the relationship between two variables

– Allows us to make predictions

  • Response variable

  • Explanatory variable

Vocab - Response variable

Vocab - Explanatory variable

What is simple linear regression?

– Model data using a straight line (linear model)

– Quantitative response

– Quantitative (today) or categorical explanatory

In R

linear_reg() |>
  set_engine("lm") |>
  fit(y ~ x, data = data-set)

Goales for Today

– How are SLR models fit

– Practice fitting SLR models in R

– Reading output

– Making predictions

– Interpreting output

ae-jmu-demo

– We have been using GitHub since day 1

– We have been using R + Tidyverse since day 1

– The expectation of learning through doing + conversation has been established