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-sectionWhat it explains
Adaptive interpretation based on R² magnitude
Relationship StrengthQualitative label with direction
Statistical SignificanceWhether 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:

ColumnMeaning
XObserved X value
YObserved Y value (actual)
Predicted Yβ₀ + β₁ × X
ResidualY − 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

ParameterFormula
Slope (β₁)Σ((xᵢ − x̄)(yᵢ − ȳ)) / Σ((xᵢ − x̄)²)
Intercept (β₀)ȳ − β₁ × x̄

Goodness-of-fit

StatisticFormula
1 − (SS_residual / SS_total)
Correlation (r)±√R², sign matches slope
Residual Standard Error√(SS_residual / (n − 2))
F-statisticMS_regression / MS_residual

R² interpretation tiers

R² valueInterpretation
< 0.10Very weak relationship
0.10 – 0.25Weak relationship
0.25 – 0.50Moderate relationship
0.50 – 0.70Strong relationship
0.70 – 0.90Very strong relationship
≥ 0.90Exceptionally strong (check for overfitting)

Error handling

ConditionError 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."