+ - 0:00:00
Notes for current slide
Notes for next slide

Confounding and Variable Transformations

1 / 32

Adjusting for confounders

  • What is the relationship between average SAT scores and average teacher salaries?
2 / 32

Adjusting for confounders

  • What is the relationship between average SAT scores and average teacher salaries?

  • Are we doing inference or prediction?
2 / 32

Adjusting for confounders

  • I fit a linear model for sat^=β^0+β^1salary
## # A tibble: 2 x 5
## term estimate std.error statistic p.value
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 (Intercept) 1159. 57.7 20.1 5.13e-25
## 2 salary -5.54 1.63 -3.39 1.39e- 3
3 / 32

Adjusting for confounders

  • I fit a linear model for sat^=β^0+β^1salary
## # A tibble: 2 x 5
## term estimate std.error statistic p.value
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 (Intercept) 1159. 57.7 20.1 5.13e-25
## 2 salary -5.54 1.63 -3.39 1.39e- 3
  • How do we interpret this result?
3 / 32

Adjusting for confounders

  • There is a third variable, the fraction of students that took the SAT in that state. It is grouped as "Low", "Medium", and, "High".
## # A tibble: 4 x 5
## term estimate std.error statistic p.value
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 (Intercept) 852. 38.9 21.9 5.56e-26
## 2 salary 1.09 0.988 1.10 2.76e- 1
## 3 frac_groupLOW 150. 12.8 11.7 2.09e-15
## 4 frac_groupMED 38.6 14.1 2.75 8.59e- 3
4 / 32

Adjusting for confounders

  • There is a third variable, the fraction of students that took the SAT in that state. It is grouped as "Low", "Medium", and, "High".
## # A tibble: 4 x 5
## term estimate std.error statistic p.value
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 (Intercept) 852. 38.9 21.9 5.56e-26
## 2 salary 1.09 0.988 1.10 2.76e- 1
## 3 frac_groupLOW 150. 12.8 11.7 2.09e-15
## 4 frac_groupMED 38.6 14.1 2.75 8.59e- 3
  • What is the referent category?
4 / 32

Adjusting for confounders

  • There is a third variable, the fraction of students that took the SAT in that state. It is grouped as "Low", "Medium", and, "High".
## # A tibble: 4 x 5
## term estimate std.error statistic p.value
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 (Intercept) 852. 38.9 21.9 5.56e-26
## 2 salary 1.09 0.988 1.10 2.76e- 1
## 3 frac_groupLOW 150. 12.8 11.7 2.09e-15
## 4 frac_groupMED 38.6 14.1 2.75 8.59e- 3
  • What is the referent category?
  • How do you interpret the β^ for frac_groupLOW?
4 / 32

Adjusting for confounders

  • There is a third variable, the fraction of students that took the SAT in that state. It is grouped as "Low", "Medium", and, "High".
## # A tibble: 4 x 5
## term estimate std.error statistic p.value
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 (Intercept) 852. 38.9 21.9 5.56e-26
## 2 salary 1.09 0.988 1.10 2.76e- 1
## 3 frac_groupLOW 150. 12.8 11.7 2.09e-15
## 4 frac_groupMED 38.6 14.1 2.75 8.59e- 3
  • What is the referent category?
  • How do you interpret the β^ for frac_groupLOW?
  • How do you interpret the β^ for salary now?
4 / 32

β^ interpretation in multiple linear regression

The coefficient for x is β^ (95% CI: LBβ^,UBβ^). A one-unit increase in x yields an expected increase in y of β^, holding all other variables constant.

5 / 32

β^ interpretation in multiple linear regression

The coefficient for average salary is 1.09 (95% CI: -0.90, 3.08). A one-unit increase in average salary yields an expected increase in average SAT score of 1.09, holding the fraction of students that took the SAT constant.

6 / 32

Adjusting for confounders

7 / 32

Adjusting for confoundrs

8 / 32

Adjusting for confoundrs

  • What is this called? Where the direction reverses?
8 / 32

Adjusting for confoundrs

  • What is this called? Where the direction reverses?
  • Notice here the lines are parallel so holding the group constant, this is the effect we see.
8 / 32

Adjusting for confoundrs

  • What is this called? Where the direction reverses?
  • Notice here the lines are parallel so holding the group constant, this is the effect we see.
  • 😱 what if the lines aren't parallel?
8 / 32

Interactions

  • Data looking at the growth rate for kids
9 / 32

Interactions

10 / 32

Interactions

  • Will β^age be positive or negative?
10 / 32

Interactions

  • Let's look at this relationship split by sex (blue: Girl, black: Boy)

11 / 32

Interactions

  • Let's look at this relationship split by sex (blue: Girl, black: Boy)

12 / 32

Interactions

  • Let's look at this relationship split by sex (blue: Girl, black: Boy)

  • 😱 the lines cross! That means there is an interaction, that is the slopes differ based on the group
12 / 32

Interactions

  • Let's look at this relationship split by sex (blue: Girl, black: Boy)

13 / 32

Interactions

  • Let's look at this relationship split by sex (blue: Girl, black: Boy)

  • What is the equation for this relationship?
13 / 32

Interactions

Weight=β0+β1Age+β2Girl+β3Age×Girl+ϵ

lm(Weight ~ Age + Sex + Age * Sex, data = Kids198)
##
## Call:
## lm(formula = Weight ~ Age + Sex + Age * Sex, data = Kids198)
##
## Coefficients:
## (Intercept) Age Sex Age:Sex
## -33.6925 0.9087 31.8506 -0.2812
14 / 32

Interactions

Weight=β0+β1Age+β2Girl+β3Age×Girl+ϵ

lm(Weight ~ Age + Sex + Age * Sex, data = Kids198)
##
## Call:
## lm(formula = Weight ~ Age + Sex + Age * Sex, data = Kids198)
##
## Coefficients:
## (Intercept) Age Sex Age:Sex
## -33.6925 0.9087 31.8506 -0.2812
  • What does this model become for boys (When Sex = 0)
14 / 32

Interactions

Weight=β0+β1Age+β2Girl+β3Age×Girl+ϵ

lm(Weight ~ Age + Sex + Age * Sex, data = Kids198)
##
## Call:
## lm(formula = Weight ~ Age + Sex + Age * Sex, data = Kids198)
##
## Coefficients:
## (Intercept) Age Sex Age:Sex
## -33.6925 0.9087 31.8506 -0.2812
  • What does this model become for boys (When Sex = 0)
    • Weight=β0+β1Age+ϵ
14 / 32

Interactions

Weight=β0+β1Age+β2Girl+β3Age×Girl+ϵ

lm(Weight ~ Age + Sex + Age * Sex, data = Kids198)
##
## Call:
## lm(formula = Weight ~ Age + Sex + Age * Sex, data = Kids198)
##
## Coefficients:
## (Intercept) Age Sex Age:Sex
## -33.6925 0.9087 31.8506 -0.2812
  • What does this model become for boys (When Sex = 0)
    • Weight=β0+β1Age+ϵ
  • What does this model become for girls (When Sex = 1)
14 / 32

Interactions

Weight=β0+β1Age+β2Girl+β3Age×Girl+ϵ

lm(Weight ~ Age + Sex + Age * Sex, data = Kids198)
##
## Call:
## lm(formula = Weight ~ Age + Sex + Age * Sex, data = Kids198)
##
## Coefficients:
## (Intercept) Age Sex Age:Sex
## -33.6925 0.9087 31.8506 -0.2812
  • What does this model become for boys (When Sex = 0)
    • Weight=β0+β1Age+ϵ
  • What does this model become for girls (When Sex = 1)
    • Weight=β0+β1Age+β21+β3Age×1+ϵ
14 / 32

Interactions

Weight=β0+β1Age+β2Girl+β3Age×Girl+ϵ

lm(Weight ~ Age + Sex + Age * Sex, data = Kids198)
##
## Call:
## lm(formula = Weight ~ Age + Sex + Age * Sex, data = Kids198)
##
## Coefficients:
## (Intercept) Age Sex Age:Sex
## -33.6925 0.9087 31.8506 -0.2812
  • What does this model become for boys (When Sex = 0)
    • Weight=β0+β1Age+ϵ
  • What does this model become for girls (When Sex = 1)
    • Weight=β0+β1Age+β21+β3Age×1+ϵ
    • Weight=(β0+β2)+(β1+β3)Age+ϵ
14 / 32

Interactions

Weight=β0+β1Age+β2Girl+β3Age×Girl+ϵ

lm(Weight ~ Age + Sex + Age * Sex, data = Kids198)
##
## Call:
## lm(formula = Weight ~ Age + Sex + Age * Sex, data = Kids198)
##
## Coefficients:
## (Intercept) Age Sex Age:Sex
## -33.6925 0.9087 31.8506 -0.2812
  • What does this model become for boys (When Sex = 0)
    • Weight=β0+β1Age+ϵ
  • What does this model become for girls (When Sex = 1)
    • Weight=β0+β1Age+β21+β3Age×1+ϵ
    • Weight=(β0+β2)+(β1+β3)Age+ϵ
  • How do you interpret β^0 now?
14 / 32

Interactions

lm(Weight ~ Age + Sex + Age * Sex, data = Kids198)
##
## Call:
## lm(formula = Weight ~ Age + Sex + Age * Sex, data = Kids198)
##
## Coefficients:
## (Intercept) Age Sex Age:Sex
## -33.6925 0.9087 31.8506 -0.2812
  • What does this model become for boys (When Sex = 0)
    • Weight=β0+β1Age+ϵ
  • What does this model become for girls (When Sex = 1)
    • Weight=β0+β1Age+β21+β3Age×1+ϵ
    • Weight=(β0+β2)+(β1+β3)Age+ϵ
  • How do you interpret β^2 now?
15 / 32

Interactions

lm(Weight ~ Age + Sex + Age * Sex, data = Kids198)
##
## Call:
## lm(formula = Weight ~ Age + Sex + Age * Sex, data = Kids198)
##
## Coefficients:
## (Intercept) Age Sex Age:Sex
## -33.6925 0.9087 31.8506 -0.2812
  • What does this model become for boys (When Sex = 0)
    • Weight=β0+β1Age+ϵ
  • What does this model become for girls (When Sex = 1)
    • Weight=β0+β1Age+β21+β3Age×1+ϵ
    • Weight=(β0+β2)+(β1+β3)Age+ϵ
  • How do you interpret β^2 now?
    • The difference in intercepts between boys and girls
15 / 32

Interactions

lm(Weight ~ Age + Sex + Age * Sex, data = Kids198)
##
## Call:
## lm(formula = Weight ~ Age + Sex + Age * Sex, data = Kids198)
##
## Coefficients:
## (Intercept) Age Sex Age:Sex
## -33.6925 0.9087 31.8506 -0.2812
  • What does this model become for boys (When Sex = 0)
    • Weight=β0+β1Age+ϵ
  • What does this model become for girls (When Sex = 1)
    • Weight=β0+β1Age+β21+β3Age×1+ϵ
    • Weight=(β0+β2)+(β1+β3)Age+ϵ
  • How do you interpret β^3 now?
16 / 32

Interactions

lm(Weight ~ Age + Sex + Age * Sex, data = Kids198)
##
## Call:
## lm(formula = Weight ~ Age + Sex + Age * Sex, data = Kids198)
##
## Coefficients:
## (Intercept) Age Sex Age:Sex
## -33.6925 0.9087 31.8506 -0.2812
  • What does this model become for boys (When Sex = 0)
    • Weight=β0+β1Age+ϵ
  • What does this model become for girls (When Sex = 1)
    • Weight=β0+β1Age+β21+β3Age×1+ϵ
    • Weight=(β0+β2)+(β1+β3)Age+ϵ
  • How do you interpret β^3 now?
    • How much the slope changes as we move from the regression line for boys to that for girls
16 / 32

Interactions

Weight=β0+β1Age+β2Girl+β3Age×Girl+ϵ

  • Hypothesis testing: What if you want to test whether the slope is different between groups?
  • Is the growth rate different for boys and girls?
  • What is H0?
17 / 32

Interactions

Weight=β0+β1Age+β2Girl+β3Age×Girl+ϵ

  • Hypothesis testing: What if you want to test whether the slope is different between groups?
  • Is the growth rate different for boys and girls?
  • What is H0?
    • H0:β3=0
17 / 32

Interactions

Weight=β0+β1Age+β2Girl+β3Age×Girl+ϵ

  • Hypothesis testing: What if you want to test whether the slope is different between groups?
  • Is the growth rate different for boys and girls?
  • What is H0?
    • H0:β3=0
  • What is HA?
17 / 32

Interactions

Weight=β0+β1Age+β2Girl+β3Age×Girl+ϵ

  • Hypothesis testing: What if you want to test whether the slope is different between groups?
  • Is the growth rate different for boys and girls?
  • What is H0?
    • H0:β3=0
  • What is HA?
    • HA:β30
17 / 32

Interactions

lm(Weight ~ Age + Sex + Age * Sex, data = Kids198) %>%
tidy(conf.int = TRUE)
## # A tibble: 4 x 7
## term estimate std.error statistic p.value conf.low conf.high
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 (Intercept) -33.7 10.0 -3.37 9.17e- 4 -53.4 -14.0
## 2 Age 0.909 0.0611 14.9 6.47e-34 0.788 1.03
## 3 Sex 31.9 13.2 2.41 1.71e- 2 5.73 58.0
## 4 Age:Sex -0.281 0.0816 -3.44 7.00e- 4 -0.442 -0.120
18 / 32

Interactions

lm(Weight ~ Age + Sex + Age * Sex, data = Kids198) %>%
tidy(conf.int = TRUE)
## # A tibble: 4 x 7
## term estimate std.error statistic p.value conf.low conf.high
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 (Intercept) -33.7 10.0 -3.37 9.17e- 4 -53.4 -14.0
## 2 Age 0.909 0.0611 14.9 6.47e-34 0.788 1.03
## 3 Sex 31.9 13.2 2.41 1.71e- 2 5.73 58.0
## 4 Age:Sex -0.281 0.0816 -3.44 7.00e- 4 -0.442 -0.120
  • What is the result of our hypothesis test?
18 / 32

β^ interpretation for interactions between x and a binary indicator I

The coefficient for the interaction between x and I is β^ (95% CI: LBβ^,UBβ^). This means that the effect of x on y differs by β^ when I=1 compared to I=0 holding all other variables constant*.

19 / 32

β^ interpretation for interactions between x and a binary indicator I

The coefficient for the interaction between x and I is β^ (95% CI: LBβ^,UBβ^). This means that the effect of x on y differs by β^ when I=1 compared to I=0 holding all other variables constant*.

  • You must include this line if there are additional variables in your model.
19 / 32

β^ interpretation for interactions between x and a binary indicator I

The coefficient for the interaction between Age and Sex is -0.28 (95% CI: -0.44, -0.12). This means that the effect of Age on Weight lower by 0.28 among girls compared to boys.

20 / 32

Non-linear relationships

  • Sometimes the relationships between the outcome y and x variables are nonlinear.
  • We can use polynomials to address this!
  • Returning to the Diamonds data, let's say we are interested in predicting Total Price from the Carats.
21 / 32

Non-linear relationships

  • Sometimes the relationships between the outcome y and x variables are nonlinear.
  • We can use polynomials to address this!
  • Returning to the Diamonds data, let's say we are interested in predicting Total Price from the Carats.
    • Is this an example of inference or prediction?
21 / 32

Non-linear relationships

22 / 32

Non-linear relationships

lm(TotalPrice ~ Carat, data = Diamonds)

23 / 32

Non-linear relationships

lm(TotalPrice ~ Carat + I(Carat^2), data = Diamonds)

24 / 32

Non-linear relationships

lm(TotalPrice ~ Carat + I(Carat^2), data = Diamonds)

  • What is the equation for this relationship?
24 / 32

Interpreting β^s in the presence of polynomials

TotalPrice=β0+β1Carat+β2Carat2+ϵ

  • What is the interpretation of β^1?
25 / 32

Interpreting β^s in the presence of polynomials

TotalPrice=β0+β1Carat+β2Carat2+ϵ

  • What is the interpretation of β^1?
  • Typically, in multiple linear regression, the interpretation of β^i is: a one-unit change in x yields an expected change in y of β^i holding all other variables constant.
25 / 32

Interpreting β^s in the presence of polynomials

TotalPrice=β0+β1Carat+β2Carat2+ϵ

  • What is the interpretation of β^1?
  • Typically, in multiple linear regression, the interpretation of β^i is: a one-unit change in x yields an expected change in y of β^i holding all other variables constant.
    • What does it mean to see a change in Caret holding Carat 2 constant?
25 / 32

Interpreting β^s in the presence of polynomials

TotalPrice=β0+β1Carat+β2Carat2+ϵ

  • What is the interpretation of β^1?
  • Typically, in multiple linear regression, the interpretation of β^i is: a one-unit change in x yields an expected change in y of β^i holding all other variables constant.
    • What does it mean to see a change in Caret holding Carat 2 constant?
  • When you have a polynomial term, you need to specify the values you are changing between, since the change is no longer constant across all values of x.
25 / 32

Interpreting β^ in the presence of polynomials

lm(TotalPrice ~ Carat + I(Carat^2), data = Diamonds) %>%
tidy()
## # A tibble: 3 x 5
## term estimate std.error statistic p.value
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 (Intercept) -523. 466. -1.12 2.63e- 1
## 2 Carat 2386. 753. 3.17 1.66e- 3
## 3 I(Carat^2) 4498. 263. 17.1 5.09e-48

What is the expected change in TotalPrice for a one-unit change in Carat, changing from 0.8 to 1.8?

26 / 32

Interpreting β^ in the presence of polynomials

lm(TotalPrice ~ Carat + I(Carat^2), data = Diamonds) %>%
tidy()
## # A tibble: 3 x 5
## term estimate std.error statistic p.value
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 (Intercept) -523. 466. -1.12 2.63e- 1
## 2 Carat 2386. 753. 3.17 1.66e- 3
## 3 I(Carat^2) 4498. 263. 17.1 5.09e-48

What is the expected change in TotalPrice for a one-unit change in Carat, changing from 0.8 to 1.8?

(-522.7 + 2386 * 1.8 + 4498.2 * 1.8^2) -
(-522.7 + 2386 * 0.8 + 4498.2 * 0.8^2)
## [1] 14081.32
26 / 32

Interpreting β^ in the presence of polynomials

lm(TotalPrice ~ Carat + I(Carat^2), data = Diamonds) %>%
tidy()
## # A tibble: 3 x 5
## term estimate std.error statistic p.value
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 (Intercept) -523. 466. -1.12 2.63e- 1
## 2 Carat 2386. 753. 3.17 1.66e- 3
## 3 I(Carat^2) 4498. 263. 17.1 5.09e-48

What is the expected change in TotalPrice for a one-unit change in Carat, changing from 0.8 to 1.8?

(-522.7 + 2386 * 1.8 + 4498.2 * 1.8^2) -
(-522.7 + 2386 * 0.8 + 4498.2 * 0.8^2)
## [1] 14081.32
2386 * (1.8 - 0.8) +
4498.2 * (1.8^2 - 0.8^2)
## [1] 14081.32
26 / 32

Interpreting β^ in the presence of polynomials

lm(TotalPrice ~ Carat + I(Carat^2), data = Diamonds) %>%
tidy()
## # A tibble: 3 x 5
## term estimate std.error statistic p.value
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 (Intercept) -523. 466. -1.12 2.63e- 1
## 2 Carat 2386. 753. 3.17 1.66e- 3
## 3 I(Carat^2) 4498. 263. 17.1 5.09e-48

What is the expected change in TotalPrice for a one-unit change in Carat, changing from 1.8 to 2.8?

27 / 32

Interpreting β^ in the presence of polynomials

lm(TotalPrice ~ Carat + I(Carat^2), data = Diamonds) %>%
tidy()
## # A tibble: 3 x 5
## term estimate std.error statistic p.value
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 (Intercept) -523. 466. -1.12 2.63e- 1
## 2 Carat 2386. 753. 3.17 1.66e- 3
## 3 I(Carat^2) 4498. 263. 17.1 5.09e-48

What is the expected change in TotalPrice for a one-unit change in Carat, changing from 1.8 to 2.8?

2386 * (2.8 - 1.8) + 4498.2 * (2.8^2 - 1.8^2)
## [1] 23077.72
27 / 32

Interpreting β^ in the presence of polynomials

lm(TotalPrice ~ Carat + I(Carat^2), data = Diamonds) %>%
tidy()
## # A tibble: 3 x 5
## term estimate std.error statistic p.value
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 (Intercept) -523. 466. -1.12 2.63e- 1
## 2 Carat 2386. 753. 3.17 1.66e- 3
## 3 I(Carat^2) 4498. 263. 17.1 5.09e-48

What is the expected change in TotalPrice for a one-unit change in Carat, changing from 1.8 to 2.8?

2386 (2.8 - 1.8) + 4498.2 (2.8^2 - 1.8^2)
## [1] 23077.72
  • Can we talk about β^1 and β^2 in the context of a one-unit change in Carat?
27 / 32

Interpreting β^ in the presence of polynomials

  • β^ coefficients that are transformations of the same x variable must be interpreted together
28 / 32

Interpreting β^ in the presence of polynomials

  • β^ coefficients that are transformations of the same x variable must be interpreted together
  • You must first choose to values of x to change between, and then report the change.
28 / 32

Interpreting β^ in the presence of polynomials

  • β^ coefficients that are transformations of the same x variable must be interpreted together
  • You must first choose to values of x to change between, and then report the change.
  • A sensible choice for the two x values can be the 25th% quantile and the 75th% quantile.
28 / 32

General β^ interpretation with quadratic terms

The linear term in the model for x has a coefficient of β^1 (95% CI: (LBβ^1,UBβ^1)). The quadratic term in the model for x has a coefficient of β^2 (95% CI: (LBβ^2,UBβ^2)). A change in x from a to b yields an expected change in y of β^1(ba)+β^2(b2a2) holding all other variables constant*.

29 / 32

General β^ interpretation with quadratic terms

The linear term in the model for x has a coefficient of β^1 (95% CI: (LBβ^1,UBβ^1)). The quadratic term in the model for x has a coefficient of β^2 (95% CI: (LBβ^2,UBβ^2)). A change in x from a to b yields an expected change in y of β^1(ba)+β^2(b2a2) holding all other variables constant*.

  • You must include this line if there are additional variables in your model.
29 / 32

Specific β^ interpretation for y=β0+β1Carat+β2Carat2+ϵ model

The linear term in the model for Carat has a coefficient of 2386 (95% CI: (906,3866)). The quadratic term in the model for Carat has a coefficient of 4498 (95% CI: (3981,5016)). A change in Carat from 0.7 to 1.24 yields an expected change in TotalPrice of 6000.5.

30 / 32

Specific β^ interpretation for y=β0+β1Carat+β2Carat2+ϵ model

The linear term in the model for Carat has a coefficient of 2386 (95% CI: (906,3866)). The quadratic term in the model for Carat has a coefficient of 4498 (95% CI: (3981,5016)). A change in Carat from 0.7 to 1.24 yields an expected change in TotalPrice of 6000.5.

  • Why didn't I say holding all other variables constant?
30 / 32

Take aways

  • The interpretation of β^ in multiple linear regression
    • A one-unit change in x yields an expected change in y of β^ holding all other included variables constant
31 / 32

Take aways

  • The interpretation of β^ in multiple linear regression
    • A one-unit change in x yields an expected change in y of β^ holding all other included variables constant
  • If the slope differs between groups (the lines cross in a scatterplot), an interaction is present
31 / 32

Take aways

  • The interpretation of β^ in multiple linear regression
    • A one-unit change in x yields an expected change in y of β^ holding all other included variables constant
  • If the slope differs between groups (the lines cross in a scatterplot), an interaction is present
  • You can include polynomial terms to address non-linear relationships
31 / 32

Take aways

  • The interpretation of β^ in multiple linear regression
    • A one-unit change in x yields an expected change in y of β^ holding all other included variables constant
  • If the slope differs between groups (the lines cross in a scatterplot), an interaction is present
  • You can include polynomial terms to address non-linear relationships
    • The coefficients for a polynomial must be interpreted together
31 / 32

Diamonds

  • Go to RStudio Cloud and open Diamonds
  • Fit the model TotalPrice=β0+β1Carat+β2Carat2+β3Color+ϵ
  • Find the 0.25 quantile and 0.75 quantile of Carat
  • What is the interpretation of β^1, β^2, and β^3?
32 / 32

Adjusting for confounders

  • What is the relationship between average SAT scores and average teacher salaries?
 
2 / 32
Paused

Help

Keyboard shortcuts

, , Pg Up, k Go to previous slide
, , Pg Dn, Space, j Go to next slide
Home Go to first slide
End Go to last slide
Number + Return Go to specific slide
b / m / f Toggle blackout / mirrored / fullscreen mode
c Clone slideshow
p Toggle presenter mode
t Restart the presentation timer
?, h Toggle this help
Esc Back to slideshow