Linear regression is a statistical method that determines the equation of the line y = ax + b that best fits a set of experimental data points. It is the fundamental tool for verifying a linear law or determining physical parameters from measurements.
Discover FizziQ
How to measure it in class
With the FizziQ app and a spreadsheet, it is possible to perform linear regressions.
Steps:
- Take measurements with FizziQ (e.g., period vs. pendulum length)
- Export the data in CSV format
- Import into a spreadsheet (Excel, LibreOffice, Google Sheets)
- Plot the graph and add a linear trendline
- Display the line equation and the R² coefficient
- Interpret the slope and the y-intercept physically
Scientific activities on this topic
Learn more
Least squares method:
The line y = ax + b is chosen to minimize the sum of the squared vertical deviations between the points and the line:
S = Σ(yᵢ - (axᵢ + b))²
This minimization leads to explicit formulas for a and b.
Coefficient of determination R²:
R² is the coefficient of determination: it should not be confused with the correlation coefficient, denoted r, of which it is the square (R² = r²) in the case of simple linear regression.
| R² | Quality of fit |
|---|---|
| > 0.99 | Excellent |
| 0.95 - 0.99 | Good |
| 0.90 - 0.95 | Acceptable |
| < 0.90 | Poor |
Physical interpretation:
- The slope a often represents a physical constant (e.g., k in F = kx)
- The y-intercept b may be an offset or should be zero depending on the law
- Uncertainties on a and b can be calculated
Formula
Slope: a = [n×Σxᵢyᵢ - (Σxᵢ)(Σyᵢ)] / [n×Σxᵢ² - (Σxᵢ)²]
Y-intercept: b = (Σyᵢ - a×Σxᵢ) / n
Coefficient of determination: R² = 1 - Σ(yᵢ - ŷᵢ)² / Σ(yᵢ - ȳ)²
where ŷᵢ = axᵢ + b are the predicted values.
Application examples
- Hooke’s law (F vs x): slope = spring constant k
- Beer-Lambert law (A vs c): slope = ε×l
- Free fall (v vs t): slope = g
- Pendulum period (T² vs L): slope = 4π²/g
FAQ
Q: When should you use linear regression? A: When you expect a linear relationship between two quantities, or when you have linearized a relationship (e.g., T² as a function of L for the pendulum).
Q: What should you do if R² is low? A: Check for outliers, measurement uncertainties, and whether the linear model is appropriate. A low R² may indicate a non-linear relationship.
Q: How do you obtain the uncertainties on a and b? A: Advanced spreadsheets (Excel with the “Analysis ToolPak”) provide these values. Otherwise, formulas exist but are rarely required at the high school level.
Q: Should the line be forced through the origin? A: Only if physics requires it (e.g., F = kx implies F = 0 when x = 0). In this case, use a regression without a y-intercept.
Related concepts
Measurement Uncertainty