Skip to content
Infinitesimal Dynamics home
Notebook: 0 XP

Statistics / Testing and modelling

Correlation and Linear Regression

Fit the best straight line to a cloud of points, measure how well it fits, and resist reading causation into it.

3 min read · 1 sections · 1 checks

Contents 2 sections
  1. §1The least-squares line
  2. ?Check yourself

By the end you can

  • Compute and interpret the correlation coefficient
  • Find the least-squares line
  • Interpret R2R^2 and residuals

Helps to know: Describing Data

§1The least-squares line

y^=a+bx,b=r sysx,a=yˉ−bxˉ\hat{y} = a + bx, \qquad b = r\,\frac{s_y}{s_x}, \qquad a = \bar{y} - b\bar{x}

The line minimises the sum of squared vertical distances to the points and always passes through (xˉ,yˉ)(\bar{x}, \bar{y}). R2=r2R^2 = r^2 is the fraction of the variation in yy that the line explains. See least squares for the linear algebra behind it.

Check yourself

  1. Q1
    If r=−0.8r = -0.8, what fraction of the variation in yy does the line explain?