Linear Regression Calculator
Simple linear regression with slope, intercept, R², adjusted R², residuals, predictions, and scatter/residual plots
This free online linear regression calculator provides instant results with no signup required. All calculations run directly in your browser — your data is never sent to a server. Supports both metric (SI) and imperial units with built-in unit selection dropdowns on every input field, so you can work in whatever units your problem provides. Designed for engineering students and professionals working through coursework, design projects, or quick reference calculations.
Linear Regression Calculator
Simple linear regression: ŷ = b₀ + b₁x with R², residuals, and predictions.
| Coeff | Estimate | Std Error | t-stat | p-value |
|---|---|---|---|---|
| b₀ (intercept) | 0.3429 | 0.1702 | 2.0147 | 0.090560 |
| b₁ (slope) | 1.8738 | 0.0337 | 55.6030 | 0.000000 |
Scatter Plot with Regression Line
Residual Plot
How to Use This Calculator
Enter your input values
Fill in all required input fields for the Linear Regression Calculator. Most fields include unit selectors so you can work in your preferred unit system — metric or imperial, whichever matches your problem.
Review your inputs
Double-check that all values are correct and that you have selected the right units for each field. Incorrect units are the most common source of calculation errors and can produce results that are off by factors of 2, 10, or more.
Read the results
The Linear Regression Calculator instantly computes the output and displays results with units clearly labeled. All calculations happen in your browser — no loading time and no data sent to a server.
Explore parameter sensitivity
Try adjusting individual input values to see how the output changes. This is a quick and effective way to develop intuition about how different parameters influence the result and to identify which inputs have the largest effect.
Formula Reference
Linear Regression Calculator Formula
See calculator inputs for the governing equation
Variables: All variables and their units are labeled in the calculator interface above. Input fields accept values in multiple unit systems — select your preferred unit from the dropdown next to each field.
When to Use This Calculator
- •Use the Linear Regression Calculator when solving homework or exam problems that require quick numerical verification of your hand calculations — instant feedback helps identify arithmetic errors before they propagate.
- •Use it during the early design phase to rapidly iterate on parameters and narrow down feasible configurations before committing time to detailed finite element simulations or full design packages.
- •Use it when reviewing a colleague's calculation or checking a vendor's data sheet for plausibility — a quick sanity check can prevent costly downstream errors.
- •Use it to generate reference data for a technical report or presentation without manual computation, ensuring consistent, reproducible numbers throughout the document.
- •Use it in the field when a quick estimate is needed and a full engineering software package is not available.
About This Calculator
The Linear Regression Calculator is a precision engineering calculation tool designed for students, engineers, and technical professionals. Simple linear regression with slope, intercept, R², adjusted R², residuals, predictions, and scatter/residual plots All calculations are performed using established engineering formulas from the relevant scientific literature and standards. Inputs support both metric (SI) and imperial unit systems, with unit conversion handled automatically — simply select your preferred unit from the dropdown next to each field. Results are computed instantly in the browser without sending data to a server, ensuring both speed and privacy. This calculator is intended as a supplementary tool for learning and design exploration; always verify results against authoritative references for safety-critical applications.
The Theory Behind It
Simple linear regression fits a straight line y = β₀ + β₁·x + ε to data, minimizing the sum of squared residuals (method of least squares). The slope β₁ = Σ((x − x̄)(y − ȳ)) / Σ(x − x̄)² and the intercept β₀ = ȳ − β₁·x̄. The coefficient of determination R² = 1 − SS_residual/SS_total measures the proportion of variance in y explained by x, ranging from 0 (no fit) to 1 (perfect fit). The adjusted R² accounts for the number of predictors: R²_adj = 1 − (1 − R²)·(n−1)/(n−p−1), where p is the number of predictors. For simple linear regression, p = 1. Standard errors of the coefficients quantify uncertainty: SE(β₁) = √(MSE/Σ(x − x̄)²) and SE(β₀) similarly. Hypothesis tests on β₁ use t = β₁/SE(β₁), which follows a t-distribution with n−2 degrees of freedom. Confidence intervals on β₁ are β₁ ± t_(α/2, n−2)·SE(β₁). The regression assumes: (1) linearity — y is a linear function of x; (2) independence — observations are independent; (3) homoscedasticity — residuals have constant variance; (4) normality — residuals are normally distributed. Violations require transformations, weighted regression, or non-parametric methods. For multiple predictors, use multiple linear regression with matrix computations. The calculator handles simple linear regression with slope, intercept, R², SE, and prediction intervals.
Real-World Applications
- •Calibration curves: relate instrument readings (x) to actual values (y) from calibration standards, then use the regression to convert new readings to values.
- •Trend analysis: fit linear trend to time-series data (revenue, temperature, performance metrics) to quantify direction and rate of change.
- •Predictive modeling: predict one variable from another using the fitted regression, with prediction intervals quantifying uncertainty.
- •Quality control: relate process variables to output variables and identify which process factors control product quality.
- •Scientific data analysis: fit experimental data to a theoretical linear relationship to estimate the slope (often a physical constant) and test agreement.
Frequently Asked Questions
What's the formula for simple linear regression slope?
β₁ = Σ((x − x̄)(y − ȳ)) / Σ((x − x̄)²), which is the covariance of x and y divided by the variance of x. The intercept is β₀ = ȳ − β₁·x̄. These minimize the sum of squared residuals Σ(y − ŷ)² and are the 'best' fit in a least-squares sense.
What's R²?
The coefficient of determination R² measures the proportion of variance in y explained by x. R² = 0 means the regression explains nothing (as good as just using ȳ). R² = 1 means perfect fit (all variance explained). R² = 0.6 means 60% of the variance is explained, 40% is unexplained (random or due to other factors). High R² doesn't imply causation or practical significance — it just means the data fit the linear model well.
How do I test if the slope is significant?
Compute t = β₁/SE(β₁), where SE(β₁) is the standard error of the slope. Compare to t critical value with n−2 degrees of freedom. Equivalently, compute p-value from the t-statistic and reject H₀ (slope = 0) if p < α. If p < 0.05, you have evidence that the slope is significantly different from zero, meaning x has a statistically significant relationship with y.
When is linear regression inappropriate?
When the relationship between x and y is nonlinear (curved), when residuals have non-constant variance (heteroscedasticity), when observations are not independent (autocorrelation in time series), when outliers dominate the fit, or when predictors are highly correlated (multicollinearity in multiple regression). Check residual plots to detect these problems.
What's the difference between correlation and regression?
Correlation measures the strength of a linear relationship (r ranges from −1 to +1); it is symmetric in x and y. Regression fits a specific linear relationship y = f(x) and treats x as predictor and y as response; the roles are not symmetric. R² in simple regression equals r² (the squared correlation coefficient). Regression predicts; correlation just measures strength.
Related Calculators
Normal Distribution Calculator
Compute P(X < x), P(X > x), P(a < X < b), z-scores, and inverse normal with an interactive bell curve
t-Distribution Calculator
Compute p-values (one-tail and two-tail) and critical t-values for Student's t-distribution with any degrees of freedom
Confidence Interval Calculator
Compute confidence intervals using z or t distribution with margin of error, SE, and visual interval bar
Hypothesis Testing Calculator
Step-by-step one-sample z-test, one-sample t-test, and two-sample Welch t-test with rejection region chart
ANOVA Calculator
One-way ANOVA for 2–5 groups: SSB, SSW, MSB, MSW, F-statistic, p-value, and pairwise post-hoc comparisons
Chi-Square Calculator
Chi-square test of independence and goodness-of-fit with cell contribution table, df, and p-value