# Multiple Linear Regression

**Multiple Linear Regression** models the relationship between several predictors (numeric or categorical) and one continuous outcome.

---

## 📌 When to Use
- One continuous outcome variable
- Two or more predictor variables (numeric or categorical)
- Assessing independent contributions of each predictor while controlling for others

> ⚠️ No standard non-parametric counterpart exists. If assumptions are violated, verify residual normality after fitting and consider robust regression.

---

## 📐 Model

$$
Y = \beta_0 + \beta_1 X_1 + \beta_2 X_2 + \ldots + \beta_k X_k + \varepsilon
$$

---

## 🔬 What StatInsight Reports
- Coefficient (β) for each predictor with 95% CI and p-value
- R² and adjusted R²
- Overall model F-statistic and p-value
- VIF (Variance Inflation Factor) for collinearity detection
- Power analysis

---

## 🧩 Collinearity Warning
If two predictors are highly correlated (VIF > 5), StatInsight will flag specific pairs and recommend removing one.

---

## 🧪 Assumptions
- Linearity
- Normality of residuals (check post-fit)
- Homoscedasticity
- No perfect multicollinearity
- Independent observations

---

## 🧠 Interpretation
- Each β represents the change in Y per unit increase in that predictor, **holding all others constant**
- R² = proportion of variance in Y explained by the full model
- VIF > 5: multicollinearity concern; VIF > 10: serious problem

---

## 🐍 Python Implementation

```python
import statsmodels.api as sm

X = sm.add_constant(predictors_df)
model = sm.OLS(y, X).fit()
print(model.summary())
```

---

## 📎 Related Tests

[Simple Linear Regression](simple-linear.md)

[Multiple Logistic Regression](logistic.md)

[Automatic Predictor Selection](/statistics/predictors/auto-predictor-selection.md)
