1 of 50

Lecture 9: �Uncertainty in regression and multiple regression

Josh Grossman

Stanford University

2 of 50

Simple linear regression

The “best fitting” line through the points

3 of 50

Heights of fathers and sons

Karl Pearson, circa 1900

4 of 50

Heights of fathers and sons

Karl Pearson, circa 1900

5 of 50

Simple linear regression

Minimizes the sum of squared residuals

6 of 50

Simple linear regression

Minimizes the sum of squared residuals

7 of 50

A probabilistic interpretation

8 of 50

Properties of the estimator

is a random vector.

9 of 50

Properties of the estimator

The estimator is unbiased

is a random vector.

10 of 50

11 of 50

12 of 50

Properties of the estimator

The variance

13 of 50

Standard errors�For the parameters

14 of 50

Standard errors�For the parameters

  1. A lot of samples n
  2. Inherent variance 𝜎2 of data is small
  3. The Xi’s are spread out

is small when:

15 of 50

Standard errors�For the parameters

  • A lot of samples n
  • Inherent variance 𝜎2 of data is small
  • The Xi’s are centered near zero

is small when:

16 of 50

Confidence intervals�For the parameters

[ The parameters are approximately normal. ]

17 of 50

Confidence intervals

For the mean response

For each x* value, how accurate is our estimate of the expected Y value?

18 of 50

Confidence intervals

For the mean response

For each x* value, how accurate is our estimate of the expected Y value?

19 of 50

Confidence intervals

For the mean response

20 of 50

Confidence intervals

For the mean response

21 of 50

Confidence intervals�For the mean response

Small when:

  • A lot of samples n
  • Inherent variance 𝜎2 of data is small
  • The point x* is close to the mean

22 of 50

23 of 50

Confidence intervals

For a specific response [ prediction intervals ]

24 of 50

interval="confidence" for mean response

25 of 50

26 of 50

27 of 50

Confidence intervals

For a specific response [ prediction intervals ]

28 of 50

Confidence intervals

For a specific response [ prediction intervals ]

29 of 50

Confidence intervals

For a specific response [ prediction intervals ]

30 of 50

Confidence intervals�For a specific response [ prediction intervals ]

Small when:

  • A lot of samples n
  • Inherent variance 𝜎2 of data is small
  • The point x* is close to the mean

only change compared

to the uncertainty in the

mean response

31 of 50

Confidence intervals�For a specific response [ prediction intervals ]

But never smaller than 𝜎2.

the "irreducible error" → we can't perfectly predict random error!

32 of 50

“Essentially, all models are wrong, but some are useful.”�George Box

33 of 50

Multiple regression

Outcomes modeled as a linear combination of multiple covariates.

34 of 50

35 of 50

36 of 50

37 of 50

38 of 50

39 of 50

Multiple regression

Matrix notation

40 of 50

Multiple regression

Matrix notation

41 of 50

Least-squares estimate

42 of 50

Least-squares estimate

1 x n

n x 1

43 of 50

Regression hyperplane

From Hastie, Tibshirani & Friedman, “Elements of Statistical Learning”

44 of 50

Computation�Linear regression

45 of 50

Computation�Linear regression

46 of 50

Computation�Linear regression

47 of 50

Computation�Linear regression

closed-form solution

for linear regression!

48 of 50

Multiple regression�Variance and confidence intervals

49 of 50

Multiple regression�Variance and confidence intervals

50 of 50