Trend Lines &
Regression
Learn to add trend lines in Tableau, interpret regression outputs, and use \( R^2 \) to evaluate model fit.
What Is a Trend Line?
A trend line is a straight or curved line fitted through a scatter plot that summarizes the overall direction and strength of the relationship between two continuous variables.
Why Trend Lines Matter
Key Vocabulary
The Linear Regression Model
Tableau fits a line that minimizes the sum of squared residuals:
Understanding \( R^2 \)
\( R^2 \) tells you what fraction of the variation in your dependent variable is captured by the model. The formula is:
Linear vs. Polynomial vs. Exponential
Tableau offers multiple trend line models. Choosing the right one depends on the shape of your scatter plot.
| Linear | Polynomial | Exponential | |
|---|---|---|---|
| Equation | \( y = mx + b \) | \( y = a_n x^n + \ldots + a_0 \) | \( y = ae^{bx} \) |
| Best For | Constant rate of change | Curves, peaks, or valleys | Growth or decay patterns |
| Risk | Misses curvature | Overfitting with high degree | Sensitive to outliers |
Correlation vs. Causation
A trend line shows that two variables move together: it does not prove one causes the other. Always consider lurking variables and confounders.
How to Add a Trend Line in Tableau
Reading the Tooltip
When you hover over a Tableau trend line, a tooltip displays the full regression model. Here is how to interpret each part:
Example 1: Sales vs. Ad Spend
Example 2: Temperature vs. Defects
Example 3: Interpreting Output
A Tableau tooltip for a sales-vs-discount scatter shows:
Trend Lines by Category
When you add a dimension to Color, Tableau automatically fits separate trend lines for each category. This lets you compare slopes and strengths across groups.
Confidence Bands
Confidence bands display the range of uncertainty around the trend line. A 95% band means: if we repeated the study many times, 95% of the true regression lines would fall within the shaded region.
Common Mistakes
Summary Table
| Metric | What It Tells You | Good Value | |
|---|---|---|---|
| Slope (\(m\)) | Rate of change per unit of \( x \) | Direction and steepness of trend | Context-dependent |
| Intercept (\(b\)) | Predicted \( y \) when \( x = 0 \) | Starting point of the model | Context-dependent |
| \( R^2 \) | Proportion of variance explained | Strength of model fit | Closer to 1.0 |
| \( p \)-value | Statistical significance | Whether the relationship is real | \( < 0.05 \) |
Question 1 of 5
A Tableau trend line shows \( R^2 = 0.92 \). What does this mean?
Question 2 of 5
You see a U-shaped scatter plot in Tableau. Which trend line model is most appropriate?
Question 3 of 5
A trend line has \( R^2 = 0.85 \) but \( p = 0.12 \). How should you interpret this?
Question 4 of 5
In the equation \( \hat{y} = -2.5x + 100 \), what does the slope of \( -2.5 \) mean?
Question 5 of 5
In Tableau, how do you add a trend line to a scatter plot?