Fiveable

🥖Linear Modeling Theory Unit 17 Review

QR code for Linear Modeling Theory practice questions

17.4 Comparing Linear and Non-Linear Models

17.4 Comparing Linear and Non-Linear Models

Written by the Fiveable Content Team • Last updated August 2025
Written by the Fiveable Content Team • Last updated August 2025
🥖Linear Modeling Theory
Unit & Topic Study Guides

Linear vs Non-linear Models

Assumptions and Relationships

Linear models assume that the relationship between predictors and the response variable can be expressed as a weighted sum of the predictors (plus an error term). The "linear" in linear model refers to linearity in the parameters, not necessarily in the predictors themselves. A polynomial regression like y=β0+β1x+β2x2y = \beta_0 + \beta_1 x + \beta_2 x^2 is still a linear model because the parameters β0,β1,β2\beta_0, \beta_1, \beta_2 enter linearly.

Non-linear models, by contrast, have parameters that enter the model in a non-linear way. Think of something like y=β0eβ1xy = \beta_0 e^{\beta_1 x}, where β1\beta_1 appears inside an exponential. These models can capture relationships that no linear-in-parameters specification can represent.

The choice between linear and non-linear models depends on:

  • The nature of the underlying data-generating process
  • How complex the relationship between predictors and response actually is
  • Whether your goal is prediction, inference, or both

Simplicity and Interpretability

Linear models are simpler to estimate, interpret, and communicate. Each coefficient has a direct meaning: a one-unit change in xjx_j is associated with a βj\beta_j change in yy, holding other predictors constant. Estimation uses closed-form solutions (ordinary least squares), so computation is fast.

Non-linear models require iterative optimization algorithms (like Gauss-Newton or Levenberg-Marquardt), which are more computationally intensive and sensitive to starting values. Their parameters often lack the clean "one-unit change" interpretation that linear coefficients have.

A few practical trade-offs to keep in mind:

  • Linear models tend to be more robust to outliers and less prone to overfitting
  • Non-linear models are more flexible and can capture a wider range of patterns
  • If a linear model fits the data well, adding non-linear complexity rarely pays off

Model Goodness-of-Fit

Goodness-of-Fit Measures

Goodness-of-fit measures quantify how well a model explains the observed data.

R-squared (R2R^2) measures the proportion of variance in the response variable explained by the model:

R2=1SSresSStotR^2 = 1 - \frac{SS_{res}}{SS_{tot}}

where SSresSS_{res} is the residual sum of squares and SStotSS_{tot} is the total sum of squares. An R2R^2 of 0.85 means the model explains 85% of the variability in the response.

Adjusted R-squared corrects for the number of predictors by penalizing unnecessary complexity:

Radj2=1SSres/(np1)SStot/(n1)R^2_{adj} = 1 - \frac{SS_{res} / (n - p - 1)}{SS_{tot} / (n - 1)}

where nn is the number of observations and pp is the number of predictors. This is especially useful when comparing models with different numbers of parameters, because raw R2R^2 will never decrease when you add a predictor, even a useless one.

When comparing a linear and a non-linear model, be cautious with R2R^2. For non-linear models estimated without an intercept or via maximum likelihood, the standard R2R^2 decomposition may not hold. Adjusted R2R^2 or information criteria are often more reliable comparison tools.

Assumptions and Relationships, Types of Regression

Predictive Performance Metrics

These metrics assess how well a model generalizes to new, unseen data, which is often more important than how well it fits the training data.

  • Mean Squared Error (MSE): MSE=1ni=1n(yiy^i)2MSE = \frac{1}{n}\sum_{i=1}^{n}(y_i - \hat{y}_i)^2. Averages the squared prediction errors. Sensitive to large errors because squaring amplifies them.
  • Root Mean Squared Error (RMSE): RMSE=MSERMSE = \sqrt{MSE}. Same units as the response variable, making it easier to interpret. If your response is in dollars, RMSE is also in dollars.
  • Mean Absolute Error (MAE): MAE=1ni=1nyiy^iMAE = \frac{1}{n}\sum_{i=1}^{n}|y_i - \hat{y}_i|. Less sensitive to outliers than MSE/RMSE because it doesn't square the errors.

When comparing a linear model to a non-linear alternative, compute these metrics on a held-out test set or via cross-validation. A non-linear model that achieves only marginally better RMSE than a linear model may not be worth the added complexity.

Cross-Validation and Bias-Variance Trade-off

Cross-validation estimates out-of-sample performance without requiring a separate test set.

K-fold cross-validation works in these steps:

  1. Split the data into kk roughly equal subsets (folds)
  2. For each fold ii, train the model on all data except fold ii
  3. Predict the response for the held-out fold ii and compute the error metric
  4. Average the error across all kk folds to get the cross-validated estimate

Common choices are k=5k = 5 or k=10k = 10. Leave-one-out cross-validation (LOOCV) is the special case where k=nk = n, meaning each observation gets its own fold. LOOCV has low bias but can have high variance and is computationally expensive for large datasets.

The bias-variance trade-off is central to model comparison:

  • Linear models tend to have higher bias (they may underfit complex patterns) but lower variance (their predictions are stable across different samples)
  • Non-linear models tend to have lower bias (they can fit complex patterns) but higher variance (they're more sensitive to the specific training data)

The sweet spot depends on your data. With a small dataset, the variance penalty of a complex non-linear model often outweighs its bias advantage, and a simpler linear model generalizes better.

Complexity vs Interpretability

Model Complexity

Model complexity refers to the number of parameters and the flexibility of the functional form. A simple linear regression with one predictor has two parameters (β0\beta_0 and β1\beta_1). A neural network might have thousands.

As complexity increases, the model can capture more intricate patterns. But there's a ceiling: once the model starts fitting noise rather than signal, you've overfit. An overfit model will look great on training data and perform poorly on new data. This is why training-set R2R^2 alone is a misleading guide for model selection.

Assumptions and Relationships, Why It Matters: Nonlinear Models | Concepts in Statistics

Model Interpretability

Interpretability is how easily you can understand and communicate what the model is doing.

  • In a linear model, you can say: "For every additional year of education, income increases by $3,200\$3{,}200 on average, holding other factors constant." That's a clear, actionable statement.
  • In a complex non-linear model, the relationship between a predictor and the response may change depending on the values of other predictors, making such clean statements impossible.

When your audience includes decision-makers, regulators, or non-technical stakeholders, interpretability often matters as much as predictive accuracy.

Parsimony and Overfitting

The principle of parsimony (Occam's razor) says that among models with similar performance, prefer the simpler one. A simpler model is easier to interpret, more robust to new data, and less likely to have overfit.

This doesn't mean always choose the simplest model. It means complexity needs to earn its place by delivering meaningfully better performance. If a non-linear model reduces RMSE by 15% over a linear model on cross-validated data, that complexity is justified. If it reduces RMSE by 1%, it probably isn't.

Model Selection Techniques

Stepwise Selection Methods

Stepwise methods automate predictor selection by iteratively adding or removing variables based on statistical criteria (typically p-values or F-statistics).

  • Forward selection: Start with no predictors. At each step, add the predictor that most improves the model (lowest p-value below a threshold). Stop when no remaining predictor meets the threshold.
  • Backward elimination: Start with all candidate predictors. At each step, remove the predictor that contributes least (highest p-value above a threshold). Stop when all remaining predictors are significant.
  • Stepwise regression: Combines both directions. After adding a predictor, check whether any previously included predictor should now be removed, and vice versa.

These methods are convenient but have well-known limitations: they can be unstable (small changes in data lead to different selected models), they inflate Type I error rates due to multiple testing, and they don't search all possible model subsets. Use them as exploratory tools, not as definitive model selectors.

Regularization Techniques

Regularization controls model complexity by adding a penalty term to the objective function, shrinking coefficients toward zero.

Ridge regression (L2) minimizes:

i=1n(yiy^i)2+λj=1pβj2\sum_{i=1}^{n}(y_i - \hat{y}_i)^2 + \lambda \sum_{j=1}^{p}\beta_j^2

The penalty shrinks all coefficients toward zero but never sets them exactly to zero. Ridge is useful when you have many correlated predictors.

Lasso regression (L1) minimizes:

i=1n(yiy^i)2+λj=1pβj\sum_{i=1}^{n}(y_i - \hat{y}_i)^2 + \lambda \sum_{j=1}^{p}|\beta_j|

The absolute-value penalty can force some coefficients to exactly zero, effectively performing variable selection. This produces sparser, more interpretable models.

The tuning parameter λ\lambda controls the strength of the penalty. When λ=0\lambda = 0, you get ordinary least squares. As λ\lambda increases, coefficients shrink more aggressively. The optimal λ\lambda is typically chosen via cross-validation.

Information Criteria and Cross-Validation

Information criteria provide a single number that balances fit and complexity, making model comparison straightforward.

  • AIC (Akaike Information Criterion): AIC=2p2ln(L^)AIC = 2p - 2\ln(\hat{L}), where pp is the number of parameters and L^\hat{L} is the maximized likelihood. Lower AIC is better.
  • BIC (Bayesian Information Criterion): BIC=pln(n)2ln(L^)BIC = p\ln(n) - 2\ln(\hat{L}). BIC penalizes complexity more heavily than AIC (especially for large nn), so it tends to favor simpler models.

AIC and BIC values are only meaningful in comparison to other models fit on the same data. An AIC of 342 by itself tells you nothing; an AIC of 342 vs. 358 for a competing model tells you the first model is preferred.

Cross-validation complements information criteria by directly estimating prediction error. When AIC/BIC and cross-validation agree on the best model, you can be fairly confident in your choice. When they disagree, cross-validation results are generally more trustworthy for prediction-focused problems, while BIC is often preferred when the goal is identifying the "true" model.

The right selection technique depends on your dataset size, the number of candidate models, and whether your priority is prediction or interpretation.