1001Ferramentas
📐Calculators

Linear Regression Slope and Intercept (Least Squares)

Paste two comma-separated lists of paired X and Y values and get the ordinary least squares coefficients a and b of the line y = ax + b.

a, b

Simple linear regression — coefficients (a, b)

Ordinary least squares (OLS) fits the line y = a·x + b by making the sum of squared residuals as small as it can be. The slope comes out as a = Σ((xᵢ−x̄)(yᵢ−ȳ)) / Σ(xᵢ−x̄)² and the intercept as b = ȳ − a·x̄. The coefficient of determination R² = SSR/SST tells you how much of the variance in Y the model accounts for. Run X=[1,2,3,4,5], Y=[2.1,3.9,6.2,7.8,10.1] through it and you get a ≈ 2.00, b ≈ 0.04 and R² ≈ 0.999. Every estimate carries a standard error, which is what lets you run t-tests against H₀: coefficient = 0. Legendre published the method in 1805 and Gauss in 1809.

Applications

Forecasting sales, experimental physics (Hooke's law F = k·x, Ohm's law V = R·I), econometrics like the Phillips curve and demand functions, classical machine learning with scikit-learn LinearRegression, calibration curves in pharmacology, and quality control on the engineering side.

FAQ

Gauss-Markov assumptions? Linearity, independent errors, homoscedasticity (constant variance) and normal residuals. Those are what OLS needs to be BLUE, the best linear unbiased estimator.

R² close to 1 is always good? Not necessarily. A high R² can also signal overfitting or a spurious correlation. Look at the residual plots, and when you're comparing models with different numbers of predictors, lean on adjusted R² instead.

What about non-linear data? Transform it first (log, √) or switch to polynomial or non-linear regression. For outliers, robust regression such as Huber or RANSAC handles them well.

Related Tools

📉

Linear Regression OLS Calculator

Computes simple linear regression coefficients by ordinary least squares method from a list of x y data pairs.

📈

Linear Regression (Least Squares)

Fit y = a·x + b by least squares; reports slope, intercept, R².

📐

Timber Design Strength (kmod, NBR 7190)

Computes the timber design strength per the Brazilian NBR 7190, f_d = k_mod1 · k_mod2 · k_mod3 · f_k / γ_w, where the three modification factors correct the characteristic strength for load duration, service moisture class and timber grade, and γ_w is the material partial safety factor. Timber is the only common structural material whose strength falls with the DURATION of the applied load, and that is what k_mod1 encodes: it is 1.10 for instantaneous action and only 0.60 for permanent load, so the same member is worth nearly twice as much under impact as under self weight. In the most common design combination — long-duration action (0.70), moisture class 1 or 2 (1.00), first-grade sawn timber (1.00) and compression parallel to the grain with γ_wc = 1.4 — the factors cancel such that the design strength comes out exactly half the characteristic value, a shortcut worth memorising to sanity-check any result. Enter the three modification factors, the characteristic strength and the partial safety factor.

🔗

GCD with Bezout Coefficients

Compute gcd(a,b) and Bezout coefficients x,y where a·x + b·y = gcd.

🧨

Linear Explosive Charge

Calculate the linear loading density of a blast hole, q = (π/4) × d² × ρ, from the hole diameter d (mm) and the explosive density ρ (g/cm³). The result, in kg of explosive per meter of hole, is how much explosive fits in each meter of charged column — a central parameter of rock blast design. Multiplied by the hole charge height, it gives the charge per hole; combined with the blasted rock volume, it gives the powder factor. Larger diameters and denser explosives raise the linear charge. Enter the hole diameter and the explosive density.

🔗

Pearson Correlation Calculator

Calculate the Pearson correlation coefficient (r) between two data sets and measure the strength of the linear relationship, from -1 to +1.

The results provided by this tool are for general informational and educational purposes only and do not constitute professional, financial, medical, legal, tax or accounting advice. Always confirm important decisions with a qualified professional and official sources.