# Week Learning Objectives

By the end of this module, you will be able to

- Describe the statistical model for regression
- Write out the model equations
- Simulate data based on a regression model
- Plot interactions

## Task Lists

- If you have questions, attend the Tuesday Q&A session
- Complete the assigned readings
- Attend the Thursday session and participate in the class
exercise
- Complete Homework 2

# Lecture

## Slides

You can view and download the slides here: HTML PDF

## Statistical Model

Check your learning: In the example in the video, why do we need a
random component?

## Import Data

Check your learning: What is the coding for the `sex`

variable?

Take a pause and look at the scatterplot matrix. Ask yourself the
following:

- How does the distribution of
`salary`

look?
- Are there more males or females in the data?
- How would you describe the relationship between number of
publications and salary?

## Linear Regression

### Sample regression line

Check your learning: How would you translate the regression line
\(y = \beta_0 + \beta_1
\text{predictor1}\) into R?

### Centering

Check your learning: The mean of the `pub`

variable is
18.2. If we call the mean-centered version of it as `pub_c`

,
what should be the value of `pub_c`

for someone with 10
publications?

## Categorical Predictor

Check your learning: In a regression analysis, assume that there is a
binary predictor that indicates whether a school is public (coded as 0)
or private (coded as 1). If the coefficient for that predictor is 1.5,
which category has a higher predicted score?

## Multiple Regression

Think more: the coefficient of `pub_c`

becomes smaller
after adding `time`

into the equation. Why do you think that
is the case?

## Interaction

Pratice yourself: from the interaction model obtain the regression
line when `pub`

= 50.