Scatterplots with fit lines and loess
Plots one scale variable against another, optionally by group, with a linear, quadratic or cubic fit line (and R²), a confidence band, or a loess smoother (50% of points, Epanechnikov kernel, as SPSS).
Menu: Graphs → More charts → Scatterplot (groups, fit lines, loess)…
When should I use it?
- Checking a relationship before correlation or regression.
- Seeing whether the relationship differs by group.
What are the assumptions?
- Two scale variables.
How do I run it in StatLab?
- Choose X and Y.
- Optionally choose a group variable and a fit line.
- Choose a confidence band for the mean or for individual values.
How do I read the output?
| Output | Meaning |
|---|---|
| Points | One per case (hover for values; click to select the case). |
| Fit line | With R² and equation; the band is the chosen confidence interval. |
Worked example
On the practice survey dataset (File → Sample dataset), this command — which the dialog's Paste button also produces — runs the procedure:
PROC vizScatter /x=score /y=age /color='' /fit=linear /fitBy=total /ci=none /labelCases=NO.
Computed by StatLab's validated procedure code when this page was built. The example only illustrates the steps; choose variables that fit your own research question.
What are common mistakes?
- Fitting a straight line to a clearly curved pattern — try loess first.
- Extrapolating the line beyond the data range.