Linear Regression: Coefficients, R-Squared & MSE0%

Linear Regression: Coefficients, R-Squared & MSE

Beginner12 min read•Updated: Jul 11, 2026
Study Materials

Linear Regression: Coefficients, R-Squared & MSE

Ordinary Least Squares (OLS) Linear Regression is the foundation of predictive modeling in business analytics. Whether forecasting quarterly corporate revenue, estimating customer lifetime value (LTV), or quantifying price elasticity, linear regression provides an interpretable, transparent mathematical model that executive leadership can trust.


1. The Mathematical Formulation

Linear regression models the relationship between a continuous dependent target variable $Y$ and one or more independent predictor features $X$:

$$Y = \beta_0 + \beta_1 X_1 + \beta_2 X_2 + \dots + \beta_p X_p + \epsilon$$

Where:

  • $\beta_0$ is the intercept (the expected baseline value of $Y$ when all $X=0$).
  • $\beta_j$ represents the slope coefficient (the expected change in $Y$ for every 1-unit increase in $X_j$, holding all other variables constant).
  • $\epsilon$ is the random Gaussian error term.

2. Training a Revenue Prediction Model in Scikit-Learn

Python
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
from sklearn.metrics import mean_squared_error, mean_absolute_error, r2_score
 
# Features: marketing spend across channels
features = ['adwords_spend', 'meta_ads_spend', 'influencer_spend', 'store_footfall']
X = df[features]
y = df['quarterly_revenue']
 
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.20, random_state=42)
 
# Train model
lr = LinearRegression()
lr.fit(X_train, y_train)
 
# Generate predictions
y_pred = lr.predict(X_test)

3. Interpreting Regression Coefficients

In business analytics, explaining the coefficients is far more important than just printing predictions:

Python
# Create coefficient dataframe
coef_df = pd.DataFrame({
'Feature': features,
'Coefficient (ROI)': lr.coef_
}).sort_values(by='Coefficient (ROI)', ascending=False)
 
print(f"Baseline Intercept: ${lr.intercept_:,.2f}")
print(coef_df)

Example Interpretation:

If meta_ads_spend has a coefficient of 4.25, it implies: "For every additional $1.00 invested in Meta Advertising, quarterly revenue increases by $4.25, assuming AdWords and influencer spend remain constant."


4. Key Performance Metrics

MetricFormulaInterpretation
$R^2$ (Coefficient of Determination)$1 - \frac{SS_{res}}{SS_{tot}}$Proportion of target variance explained by features (0.0 to 1.0).
MAE (Mean Absolute Error)$\frac{1}{n} \sumy - \hat{y}$Average dollar forecast error in raw currency units.
MSE (Mean Squared Error)$\frac{1}{n} \sum (y - \hat{y})^2$Penalizes large catastrophic outliers quadratically.
RMSE (Root MSE)$\sqrt{MSE}$Error standard deviation in original unit of measurement.
Python
r2 = r2_score(y_test, y_pred)
mae = mean_absolute_error(y_test, y_pred)
rmse = np.sqrt(mean_squared_error(y_test, y_pred))
 
print(f"Model R-Squared: {r2:.3f}")
print(f"MAE: ${mae:,.2f}")
print(f"RMSE: ${rmse:,.2f}")

Interactive Quiz

Multiple Choice Questions

Question 1
In a multiple linear regression model, what does a coefficient of $\beta = 3.50$ for the feature email_campaigns mean?
Question 2
What does an $R^2$ score of 0.82 signify to business stakeholders?
Question 3
Why is RMSE often preferred over MSE when communicating results to non-technical executives?
Question 4
What happens if two input features in a multiple linear regression model are almost perfectly correlated ($r = 0.99$)?
Question 5
If an analyst observes high $R^2$ on the training set (0.95) but low $R^2$ on the test set (0.41), what problem is present?

Next Lesson

Logistic Regression: Odds Ratios & Customer Churn Prediction

Continue learning with hands-on practice, examples, and exercises in the upcoming topic.

Practice Quiz

Test your understanding of this lesson with 5 questions. Each question has one correct answer.

PrevNext