Statistics and data analysis are core applications of the graphing calculator in science, economics, and education. The graphing calculator at graphingcalculate.com lets you plot scatter data, draw regression lines, and compute the R² correlation coefficient — entirely in the browser.
What Is Linear Regression?
Linear regression finds the best-fit straight line through a set of data points. This line, called the regression line or line of best fit, minimises the sum of squared vertical distances between each data point and the line.
The regression line has the form: y = mx + b
- m = slope (how much y changes per unit of x)
- b = y-intercept (predicted y when x = 0)
Adding a Data Table
- Open the calculator
- Click the "+ Add table" button at the bottom of the expression panel
- A data table grid appears with X and Y columns
- Enter your data values — each row is one data point
- Data points appear as coloured dots on the canvas immediately
Example dataset: Temperature vs Ice cream sales
| X (Temperature °C) | Y (Sales £) |
|---|---|
| 15 | 120 |
| 18 | 145 |
| 22 | 190 |
| 25 | 220 |
| 28 | 265 |
| 32 | 310 |
| 35 | 340 |
Enter this data into the table to see the scatter plot and explore the correlation.
Enabling Linear Regression
Once you have data in the table, toggle "Show linear regression" using the switch that appears below the table. This draws the best-fit line through your data points and displays:
- The regression equation: y = mx + b with exact values
- The R² coefficient (coefficient of determination)
Interpreting the Regression Line
Slope (m)
The slope tells you how much y increases (or decreases) for every 1-unit increase in x. For the ice cream example, a slope of ~9 means every 1°C increase predicts ~£9 more in sales.
Y-intercept (b)
The y-intercept is the predicted y value when x = 0. In many real-world contexts this may not be meaningful (e.g. "sales at 0°C"), but it completes the line equation.
Making Predictions
Once you have the regression equation, substitute any x value to predict y. For example, if the equation is y = 9.2x − 18, at 30°C you'd predict sales of 9.2 × 30 − 18 = £258.
The R² Coefficient
R² (R-squared) measures how well the regression line fits your data. Its value ranges from 0 to 1:
- R² = 1.0 — perfect fit; all points lie exactly on the line
- R² = 0.9+ — very strong linear relationship
- R² = 0.7–0.9 — strong relationship
- R² = 0.5–0.7 — moderate relationship
- R² < 0.5 — weak linear relationship (consider other models)
⚠️ A high R² doesn't prove causation — only correlation. Two variables can be strongly correlated without one causing the other.
Overlaying the Regression Line on the Graph
After enabling regression, the best-fit line is drawn on the canvas over your scatter plot. You can also manually add the regression equation as a separate expression to compare it with other functions:
- Note the slope and intercept shown by the regression tool
- Add a new expression, e.g.
y = 9.2*x - 18 - The line plots alongside your data — visually confirming the fit
When Regression Isn't Linear
If your scatter plot shows a curved pattern rather than a straight line, linear regression may not be the best model. You can visually fit alternative curves by adding equations manually:
- Quadratic:
y = a*x^2 + b*x + cwith sliders - Exponential:
y = a * exp(b*x)with sliders - Power:
y = a * x^bwith sliders
Adjust sliders until the curve visually fits your scatter data.
Correlation vs Causation
A key concept in statistics: just because two variables have a high R² doesn't mean one causes the other. Classic examples of spurious correlations:
- Ice cream sales and drowning rates — both increase in summer (common cause: hot weather)
- Shoe size and reading ability in children — both increase with age
Always think critically about what your data represents, not just what the numbers show.
- Enter this height/weight dataset and compute the regression: (150, 55), (162, 65), (170, 72), (175, 78), (180, 85), (185, 90). What does R² tell you?
- Add a perfectly linear dataset (e.g. x = 1,2,3,4,5 and y = 2x + 1). What should R² be?
- What happens to R² if you add an outlier point far from the trend line?