Basic Linear Regression
Basic Linear Regression models the linear relationship between one predictor (X) and one outcome (Y), producing a regression equation you can use for prediction. Example: predicting systolic blood pressure from body mass index.
Step 1 — Provide your data
The Data Input panel asks for two columns:
- X values (independent variable / predictor)
- Y values (dependent variable / outcome)
The Sample Data Generator offers six scenarios:
- Age vs Systolic Blood Pressure
- Study Hours vs Exam Score
- Height vs Weight
- Exercise Duration vs Weight Loss
- Experience vs Salary
- Temperature vs Ice Cream Sales
Step 2 — Data Analysis Summary
As soon as you load data, a Data Analysis Summary panel appears showing:
- Number of Used Pairs
- Original X and Y observation counts
- Number of Observations not used (and why)
- Basic descriptive statistics
Step 3 — Calculate
Click Calculate Regression.
Step 4 — Read the results
The Detailed Results panel shows:
- Slope (β₁) — change in Y for each unit increase in X
- Intercept (β₀) — predicted Y when X = 0
- R² (Coefficient of Determination) — proportion of variance in Y explained by X
A Model Statistics block follows with:
- Correlation (r)
- Standard Error — residual standard error
- F-statistic — overall model significance test
- p-value — for the F-test
A Regression Equation block: Y = β₀ + β₁X
A Model Interpretation block with:
| Sub-section | What it explains |
|---|---|
| R² | Adaptive interpretation based on R² magnitude |
| Relationship Strength | Qualitative label with direction |
| Statistical Significance | Whether the relationship is significant at α = 0.05 |
Step 5 — Scatter Plot with regression line
A scatter plot shows every observation with the fitted regression line overlaid. The equation is displayed on the chart.
Step 6 — Predictions Table
Click Show Table to expand a table listing every observation with:
| Column | Meaning |
|---|---|
| X | Observed X value |
| Y | Observed Y value (actual) |
| Predicted Y | β₀ + β₁ × X |
| Residual | Y − Predicted Y |
Step 7 — Discuss
A UniversalChatBot appears at the end for interpretation.
Statistical methods used
Model
Ordinary least squares (OLS) simple linear regression: Y = β₀ + β₁ × X + ε
Parameter estimation
| Parameter | Formula |
|---|---|
| Slope (β₁) | Σ((xᵢ − x̄)(yᵢ − ȳ)) / Σ((xᵢ − x̄)²) |
| Intercept (β₀) | ȳ − β₁ × x̄ |
Goodness-of-fit
| Statistic | Formula |
|---|---|
| R² | 1 − (SS_residual / SS_total) |
| Correlation (r) | ±√R², sign matches slope |
| Residual Standard Error | √(SS_residual / (n − 2)) |
| F-statistic | MS_regression / MS_residual |
R² interpretation tiers
| R² value | Interpretation |
|---|---|
< 0.10 |
Very weak relationship |
0.10 – 0.25 |
Weak relationship |
0.25 – 0.50 |
Moderate relationship |
0.50 – 0.70 |
Strong relationship |
0.70 – 0.90 |
Very strong relationship |
≥ 0.90 |
Exceptionally strong (check for overfitting) |
Error handling
| Condition | Error message |
|---|---|
| All X values identical | "All X values are identical. Regression analysis is not meaningful." |
| All Y values identical | "All Y values are identical. Regression analysis is not meaningful." |
| Denominator = 0 | "Cannot calculate regression: denominator is zero." |