Paired returns · ordinary least squares

Linear Regression Calculator

Enter aligned predictor X and response Y percentage-point returns to fit the ordinary-least-squares line Y = intercept + slope × X. The calculator exposes residuals, R-squared, residual standard error and Student-t coefficient intervals without calling the coefficients alpha or beta or creating forecasts and recommendations.

Response Y on predictor XCoefficient intervalsNo prediction or hedge advice

Enter predictor X and response Y

Direction matters: the fitted line estimates response Y from predictor X for the entered paired sample.

Entered

Two-sided confidence from 50% through 99.9%.

Enter 5 to 500 values without percent signs; one complete aligned observation per row.

The Y row count and order must match X exactly.

Model boundary: OLS minimizes squared vertical Y residuals. Coefficient intervals require linear-model and residual assumptions; the fit does not prove causality, persist outside the sample or provide a recommended hedge ratio.

OLS coefficient and residual arithmetic

Entered Return Relationship Diagnostics 1.0.0.

Derived
No regression calculated yetEnter at least five aligned predictor X and response Y returns plus a supported confidence level, or load the audited example.

How the ordinary-least-squares fit is calculated

slope = SXY ÷ SXX
intercept = ȳ − slope × x̄
residual SE = √[Σ(Y − fittedY)² ÷ (n − 2)]
coefficient interval = estimate ± t1−α/2,n−2 × SE

The response direction is fixed: Y is fitted on X. The slope divides the centered X–Y cross-sum by the centered X sum of squares, and the intercept places the fitted line through the two sample means.

Each row’s fitted response is intercept plus slope times X. Subtracting fitted Y from entered Y gives a residual; squared residuals sum to SSE. Dividing SSE by n minus two and taking the square root gives residual standard error.

Slope and intercept standard errors follow the simple-OLS equations. The selected two-sided confidence level supplies a Student-t critical value with n minus two degrees of freedom. R-squared describes in-sample linear fit and is not a forecast score.

Worked example from the audited fixture

The audited fixture has 10 aligned return pairs with mean X = 0.25, mean Y = 0.26, SXX = 9.705 and SXY = 6.34.

  1. The fitted line is Y = 0.09668212 + 0.65327151 × X. Residual standard error is 0.14241604 percentage points, Pearson correlation is 0.98096917 and R-squared is 0.96230050.
  2. At 95% confidence with 8 residual degrees of freedom, the slope interval is 0.54785194 to 0.75869107 and the intercept interval is −0.01046275 to 0.20382699 percentage points. These are conditional coefficient intervals, not future-return ranges.

Reproduce it: select “Load audited example” above. The governed engine retains full precision and rounds only the visible interface.

How to interpret the result

  • The slope is the fitted change in response Y percentage points for one percentage-point change in predictor X within the entered sample.
  • The intercept is fitted Y when X equals zero. It is meaningful only when zero is relevant to the entered X scale and model.
  • R-squared is the fraction of entered Y variation represented by this one fitted linear relation; it does not measure causal importance or out-of-sample accuracy.
  • Residual standard error describes the in-sample vertical residual scale in Y percentage points.
  • Coefficient intervals describe estimator uncertainty under assumptions and do not recommend a hedge ratio, allocation or trade.

Assumptions and limits

  • Enter 5 to 500 aligned equal-frequency predictor X and response Y returns under consistent source and cost conventions.
  • OLS coefficient intervals require a linear conditional mean, independent errors, constant residual variance and approximately normal errors for nominal small-sample coverage.
  • Outliers, leverage points, serial dependence, volatility clustering, omitted variables and regime changes can materially distort the fit and interval.
  • Swapping X and Y changes the regression because ordinary least squares is directional.
  • The page performs no prediction interval, extrapolation, rolling stability test, cross-validation or out-of-sample evaluation.
  • No alpha, beta, causality, predictive edge, hedge recommendation, forecast, grade, signal or position instruction is generated.

Which relationship diagnostic answers which question?

Pearson correlation, partial correlation, directional regression and a historical multi-pair matrix describe different evidence. The comparison keeps direction, control variables, uncertainty and source boundaries visible instead of presenting one coefficient as a universal dependence or strategy-validation score.

Comparison of entered evidence, output and main boundary
ToolEvidence enteredPrimary outputMain boundary
Correlation Confidence IntervalTwo aligned seriesSymmetric Pearson coefficient plus Fisher limitsNo causal, stable-dependence or forecast verdict.
Partial CorrelationX, Y and one control ZResidual X–Y linear association after controlling ZOne linear control does not remove all confounding.
Linear RegressionPredictor X and response YDirectional slope, intercept, residual scale and coefficient intervalsNo alpha/beta label, extrapolation or hedge advice.
Historical Correlation MatrixGoverned multi-pair market historyMany pairwise historical coefficientsSource window and currency coverage differ from manual inference.

Frequently asked questions

  • It always fits response return Y on predictor return X as fitted Y equals intercept plus slope times X.
  • The slope is the centered X-Y cross-product sum divided by the centered X sum of squares; the intercept places the line through both sample means.
  • It is the square root of squared Y residuals divided by n minus two and remains in response-Y percentage points.
  • Slope and intercept standard errors are multiplied by a two-sided Student-t critical value with n minus two residual degrees of freedom.
  • It describes the fraction of entered Y variation represented by this one in-sample linear fit; it is not causal importance or out-of-sample accuracy.
  • No. The page does not impose CAPM, excess-return or market-benchmark conventions and therefore does not label the generic coefficients alpha or beta.
  • No. The fit omits position values, trading costs, stability tests, execution and suitability and creates no recommended position or hedge.
  • No. It produces no prediction interval, extrapolation, future-performance probability, predictive-edge verdict, forecast, grade, signal or recommendation.

Sources and methodology

Version 1.0.0 was locked only after the formulas and assumptions were checked against the cited NIST material. Canonical fixtures were independently recomputed with SciPy 1.13.1 before comparison with the browser engine. The calculator performs arithmetic locally and does not upload the entered observations.

Verify the paired return evidence before interpreting relationships

Reconcile the exact statement window, sampling frequency, timestamps, missing rows, realized P&L, spread, commission, financing, currency conversion and preprocessing across every series. Correct relationship arithmetic cannot repair mismatched, selected or cost-inconsistent evidence.

XM

Review applicable statements, symbol specifications and execution terms.

Check XM terms

FBS

Confirm account-history and trading-cost conventions for your region.

Check FBS terms

FXOpen

Verify statement, charge and execution records before deriving inputs.

Check FXOpen terms

Risk and affiliate disclosure: Leveraged forex and CFD trading can result in substantial losses. These are affiliate links, so ForexMT4Indicators.com may receive compensation if you register or trade through them, at no additional cost to you. Availability and terms vary by jurisdiction and broker entity.

Disclaimer: The results from this tool are estimates for educational and informational purposes only and may differ from your broker's figures. This is not financial or investment advice. Trading forex and CFDs carries a high level of risk and can result in the loss of all your capital. Always verify calculations with your broker and trade within your risk tolerance.