Simple Linear Regression Calculator
Fit paired market and stock returns to understand the model's slope and explanatory share.
Returns entered in % · OLS with intercept · in-sample fit
Results
Review or adjust your inputs, then calculate to see your results and interpretation.
Understand this calculation
Slope b is the fitted change in Y for a one-unit increase in X. Intercept a is the line's fitted value at X=0. R² compares residual variation with total Y variation and describes in-sample fit.
See calculation method and assumptions
Formula
Simple Linear Regression
Ordinary least squares with an intercept
Residuals and sample explanatory proportion
Fitted Y equals intercept a plus slope b times X. b is the paired deviation-product sum divided by the X squared-deviation sum; a is mean Y minus b times mean X.
A residual is observed Y minus fitted Y. R² is one minus residual squared error divided by total squared deviations of Y from its mean; it is undefined for constant Y.
Variables, rates and periods
- xᵢ / yᵢ
- Observations from the same period. A return input of 2 means 2%, calculated directly in percentage units.
- a / b / ŷ
- a is fitted Y at X=0. b is fitted Y's percentage-point change per additional percentage point of X. Ŷ is a fitted value, not a future guarantee.
- eᵢ / R²
- eᵢ is observed Y minus fitted Y. R² is this sample's reduction in squared deviations and is undefined for constant Y.
- Model
- Slope illustrates sample Beta in this market/stock return model; the intercept is not a completed risk-adjusted Jensen's alpha.
Correlation and regression ask different questions
- Correlation is symmetric when X and Y are swapped and is unitless.
- Regression assigns X as explanatory and Y as response;
- slope depends on their units.
- In simple regression with an intercept and nonconstant X and Y, R²=r².
Sample fit and limitations
- A residual is observed Y minus fitted Y.
- Outliers can change the slope and intercept substantially.
- Serial dependence, heteroskedasticity and nonlinearity also matter.
- This tool does not provide coefficient confidence intervals, causal conclusions or trading advice.
Fit an ordinary least-squares line to paired market and stock returns, then read intercept, slope, R² and residuals.
Worked example
- Enter paired market X and stock Y returns from the same periods; 2 means 2%.
- Fit simple linear regression with an intercept and inspect the scatter plot and fitted line.
- Read slope, intercept, R² and residuals together, considering outliers and model limitations.
Frequently asked questions
Can this slope be interpreted as beta?
With market returns as X and stock returns as Y using matching periods and units, the slope describes sample market sensitivity. Its estimate depends on the window, data quality and model assumptions.
Is the intercept Jensen’s alpha?
Not directly. This tool uses ordinary paired returns, without establishing an excess-return CAPM specification relative to a risk-free rate or testing risk-adjusted performance.
Does a high R² predict stock prices?
No. R² describes the share of in-sample Y variation explained by the fitted model. It is not causation, future forecast accuracy or trading advice.
What happens when X or Y is constant?
With no variation in X, slope is not uniquely identifiable. A constant Y can yield a horizontal line, but R² and Pearson r are undefined and must not be called perfect explanatory power.
Related calculators
Pearson Correlation Calculator
Inspect linear co-movement in paired returns.
Mean Confidence Interval Calculator
Estimate a mean interval using Student’s t.
Mean & Standard Deviation Calculator
Separate mean return from dispersion.