A linear regression fits a straight line to paired observations. This scientific calculator takes four pairs and estimates the slope and intercept by least squares. It then uses the fitted line to predict a y value for an x value you choose. It is a browser-based way to check the arithmetic you may also see in two-variable regression on a Texas Instruments scientific calculator.
Keep each observation paired correctly
Enter one x and one y for each observation. An x value is the input or explanatory coordinate, and y is the modeled output. The measured relationship can be meaningful only when the pairs match their original observation. Sorting x values without moving the corresponding y values would fit a different dataset.
Choose the x value at which you want to evaluate the line. It can match an existing point or fall between observations. At a measured x, the predicted y can differ from the observed y because the line is fitted across all four points. The residual is the difference between that observed value and its fitted value.
At least two x values need to differ. If all four x values are the same, there is no spread in x to estimate a slope for y as a function of x. With different x values and a constant y, a horizontal fitted line is possible. The tool shows that case while reporting that R squared is undefined when the observed y values have no variation.
Fit a line to four sample observations
Use points (1, 2.4), (2, 3.8), (3, 5.2), and (4, 7.1). The mean x is 2.5 and the mean y is 4.625. For each pair, find its differences from those means. The sum of the x differences squared is five. The sum of each x difference multiplied by its y difference is 7.75.
The least-squares slope is the second sum divided by the first, or 1.55. The intercept is the mean y minus the slope times the mean x. Subtracting 1.55 times 2.5 from 4.625 gives 0.75. The model line is y equals 1.55 times x plus 0.75.
At x equal to 3.5, the model gives y equal to 6.175. That estimate comes from inserting 3.5 into the equation and is not one of the original recorded y values. The displayed R squared is approximately 0.99380. These digits describe the fit to the four observed pairs under this model.
Read slope, intercept, and fit in their context
Read the slope as the fitted output difference between adjacent x readings separated by one unit. Its unit is y units per x unit. The intercept describes the line value at x equal to zero, which may be outside the observed range. Even when the intercept lacks a practical interpretation for the data, it positions the line mathematically.
R squared describes the proportion of sample variation in y accounted for by the linear fit with an intercept. A high value for four points does not establish cause and effect or ensure that the relationship holds for new data. Graph the pairs when interpreting a fit. A single unusual point or a narrow x range can affect the fitted line.
Predictions between observed x values stay within the observed range of the explanatory variable. Extrapolating far outside it can produce values unsupported by the original observations. Use the fitted line with care when the x value you ask about is outside the data range.
Compare with a classroom or handheld calculation
Texas Instruments documents the symbols used for linear regression on the TI-36X Pro. Its slope and intercept outputs can be compared with the two coefficients shown here when the same paired data and linear model are used. Devices can display different numbers of decimal places, so check the unrounded relationship or allow for display rounding when comparing.
If your problem gives more than four observations or asks for a different regression model, use the relevant procedure for that full dataset. The calculation here treats the four entered observations equally and fits a single straight line with an intercept.
To verify the intercept, evaluate the fitted equation at the mean x. The line passes through the point formed by the two sample means, so the fitted y at that x should match the sample mean y.
Frequently asked questions
Does the result depend on the order of the pairs?
Reordering whole pairs preserves the same data and fitted line. Keep each x with its original y value.
What if I swap x and y?
The model then predicts the original x from the original y. The fitted coefficients generally change because the line minimizes errors in the variable designated as y.
Can I enter a repeated x value?
Repeated x values are allowed, provided there is some spread in x across the four pairs.
What is a predicted value for one of the entered x coordinates?
It is the corresponding value on the fitted line. It can be compared with the observed y to find the residual.
Texas Instruments reference for a two-variable linear regression on the TI-36X Pro