Loading...
Loading...
Calculate slope, intercept, R², residuals, and predictions with scatter plot visualization and Python code.
Separate values with commas, spaces, or new lines
Enter your X and Y data, then click Calculate Regression.
Quick Reference:
Linear regression assumes: (1) Linearity: the relationship between X and Y is linear, (2) Independence: observations are independent, (3) Homoscedasticity: constant variance of residuals, (4) Normality: residuals are approximately normally distributed, (5) No multicollinearity (for multiple regression). Violating these assumptions can lead to biased or inefficient estimates.
R² represents the proportion of variance in Y explained by X. R² = 0.85 means 85% of the variation in Y is explained by the linear relationship with X. However, a high R² does not prove causation, and it can be artificially inflated by adding more predictors. Use adjusted R² when comparing models with different numbers of predictors.
Use simple linear regression when you have one predictor variable (X) and one response variable (Y). Use multiple regression when you have multiple predictors. Simple regression is easier to interpret and visualize, while multiple regression captures more complex relationships. Always start with simple regression for exploratory analysis.
Residuals (observed - predicted) reveal model fit issues. Randomly scattered residuals suggest a good fit. Patterns indicate problems: a U-shape suggests non-linearity, a funnel shape suggests heteroscedasticity, and clusters suggest missing variables. Large residuals may indicate outliers that disproportionately influence the regression line.
Correlation (r) measures the strength and direction of the linear relationship between two variables symmetrically. Regression goes further by modeling the relationship as an equation (y = b0 + b1*x) for prediction. Correlation does not imply direction, while regression explicitly models Y as a function of X. R² = r² for simple linear regression.