Linear Regression Calculator
Calculate linear regression equation, correlation coefficient, and R-squared value for your data
Linear Regression Analysis
Data Points (x, y)
Example Calculation
Sample Data
Data points: (1, 3), (2, 6), (3, 6)
Goal: Find the linear regression equation
Results
Regression equation: y = 1.5x + 2
R-squared: 0.75
Correlation: 0.866
Interpretation: 75% of variance in Y is explained by X
Key Concepts
Slope (a)
Change in Y per unit change in X
Intercept (b)
Y value when X = 0
R-squared (R²)
Proportion of variance explained (0 to 1)
Correlation (r)
Strength of linear relationship (-1 to 1)
R² Interpretation
Formulas
Slope:
a = Σ(xy) - nxy̅ / Σ(x²) - nx̅²
Intercept:
b = y̅ - ax̅
Correlation:
r = a × (sx / sy)
Understanding Linear Regression
What is Linear Regression?
Linear regression is a statistical method that models the relationship between two variables by fitting a linear equation to observed data. It finds the line that best predicts the dependent variable (Y) based on the independent variable (X).
Key Applications
- •Predicting sales based on advertising spend
- •Analyzing the relationship between height and weight
- •Forecasting stock prices or economic trends
- •Medical research and dose-response studies
Interpreting Results
Slope Interpretation
The slope tells you how much Y changes when X increases by 1 unit. Positive slopes indicate Y increases as X increases.
R-squared Interpretation
R² ranges from 0 to 1. Higher values indicate the model explains more of the variance in your data. R² = 0.8 means 80% of the variance is explained.
Correlation Coefficient
Values closer to +1 or -1 indicate stronger linear relationships. Values near 0 suggest weak linear relationships.
Important Notes
- • Linear regression assumes a linear relationship between variables
- • Check residual plots to validate model assumptions
- • Correlation does not imply causation
- • Outliers can significantly affect the regression line