Lab 7: Regression

Two or More Variables

Dave Brocker

Farmingdale State College

Warm-Up Question

How many cups of coffee do you drink per day? Do you feel more awake when you drink more?

Example data from a fictional class:

Finding the Regression Line

  • Does the relationship look positive or negative? More coffee is generally linked to higher energy, but there may be a limit.

Simple regression equation

\(\text{Energy Level} = \text{Intercept} + (\text{Slope} \times \text{Cups of Coffee}) = 2.62 + 1.25(\text{Cups})\)

  • Slope (1.25): for each additional cup of coffee, the predicted energy level increases by about 1.25 points.

  • Intercept (2.62): the predicted energy level when no coffee is consumed (cups = 0).

Activity: The Limits of Prediction

Step 1: Make Predictions

Question:
“Based on our regression equation:
\[ \text{Energy Level} = 2.62 + 1.25(\text{Cups of Coffee}) \]
what do you predict the energy level will be for a student who drinks 10 cups? 20 cups?”

  • Calculate and share your predictions, and write them on the board.

Step 2: Visualizing the Problem

  • Look at the scatterplot with the regression line.
  • Let’s extend the line beyond our observed data (e.g., past 10 cups).
  • Does this seem realistic? Why or why not?

Step 3: Critical Thinking Discussion

Discuss with a partner or in groups:

  1. At what point do you think this model stops making sense?
  2. What real-world factors might cause the energy level to level off or decrease?
    • Caffeine crashes?
    • Health risks?
    • Individual differences in tolerance?
  3. Why is it risky to make predictions outside of the observed range?

Step 4: Alternative Models

  • Some relationships are nonlinear (e.g., caffeine effects might follow a curve).

Conclusion: Key Takeaways

  • Linear models have limits—extrapolating beyond observed data can lead to unrealistic predictions.
  • Real-world relationships often have thresholds where effects change.
  • Always consider context before making predictions!

Adding More Predictors

Characteristic Beta 95% CI p-value
Cups_of_Coffee 1.2 1.0, 1.4 <0.001
sleep_quality_num 3.3 2.4, 4.1 <0.001
Study_Time 0.47 0.39, 0.56 <0.001
Abbreviation: CI = Confidence Interval

Multiple Regression Equation

\(\hat{Y} = 3.63 + 1.20(A) + 3.26(B) + 0.47(C)\)

  • \(A\) = Cups_of_Coffee (continuous)

  • \(B\) = Sleep_Quality (categorical: 0 = “Poor”, 1 = “Good”)

  • \(C\) = Study_Time (continuous)

  • Each cup of coffee adds 1.20 to predicted energy; good sleep adds 3.26 (poor sleep adds nothing); each extra unit of study time adds 0.47, each holding the others constant.

\(\hat{Y} = \beta_0 + \beta_1 A + \beta_2 B + \beta_3 C\)