Assessing a trend line

Statistical Techniques in Tableau

Maarten Van den Broeck

Content Developer at DataCamp

Linear and logarithmic models

Linear Linear model of species richness vs. distance, with a trend line.

Logarithmic Linear model of species richness vs. distance, with a logarithmic line.

Statistical Techniques in Tableau

Linear model

Linear model of species richness vs. distance, with a linear trend line.

  • $y=a*x+b$
  • Regression: quantify how $x$ causes $y$ to change
  • $a$ = slope, $b$ = intercept
  • $richness = a * distance + b$
  • $richness = 0.0038 * distance + 13.4$
Statistical Techniques in Tableau

Residuals and $R^2$ of linear model

Linear model of species richness vs. distance, with a linear line.

  • Goal is to minimize distance between observation and trend line
  • The distance is called a residual
  • Coefficient of determination $R^2$
  • For linear model, $R^2$ = correlation coefficient squared
  • Between 0 (worst) and 1 (best)
  • $R^2 = 0.33$
  • Explains $n\%$ of the variation
Statistical Techniques in Tableau

$R^2$ of logarithmic model

Linear model of species richness vs. distance, with a logarithmic line.

  • $R^2 = 0.59$
Statistical Techniques in Tableau

Residual standard error (RSE)

  • Average difference between observed values and trend line
  • Linear model: RSE = 3.69 Linear model of species richness vs. distance, with a linear line and confidence intervals.
  • Confidence interval is wider at low and high distances
  • Same unit as unit on y axis                                       
  • Logarithmic model: RSE = 2.91 Linear model of species richness vs. distance, with a logarithmic line and confidence intervals.
  • Confidence interval is only wider at very high distances
Statistical Techniques in Tableau

p-value

Linear model

  • p-value = 0.001
  • Chance of $\frac{1}{1000}$ there is no correlation
  • p-value < 0.05: model is statistically significant, fits data well

Logarithmic model

  • p-value = 0.0001
  • Chance of $\frac{1}{10000}$ there is no correlation
  • The lower the p-value, the better, but p-value isn't everything!
Statistical Techniques in Tableau

Let's practice!

Statistical Techniques in Tableau

Preparing Video For Download...