Regression: Model Development
Variable Selection
- Variable selection is crucial in model development to identify the most relevant predictors.
- David Russell's quote: “The hardest thing to learn in life is which bridge to cross and which to burn.” emphasizes the importance of choosing the right variables.
Model Development Workflow
- Model Development: This involves several steps:
- Exploration: Visualizing and summarizing the data.
- Transformation: Linearizing and reducing skewness/leverage of predictors.
- Modeling: Fitting the model, checking assumptions, interpreting results, and transforming as needed. This process is iterative.
- Variable Selection: This involves:
- VIF (Variance Inflation Factor): Removing predictors with high variance inflation factors.
- Model selection methods: stepwise selection, AIC (Akaike Information Criterion), and the principle of parsimony. Assumption checks are essential.
- Predictive Modeling: This includes:
- Prediction: Using the model to predict new data.
- Validation: Evaluating the model’s performance.
Principles of a Good Model
- A good model should:
- Include only useful predictors (principle of parsimony).
- Have no redundant predictors (principle of orthogonality, avoiding multicollinearity).
- Be interpretable (principle of transparency) or predict well (principle of accuracy).
- Equation from previous lecture:
log(Ozone)=−0.262+0.0492⋅Temp+0.00252⋅Solar.R−0.0616⋅Wind
Principle of Parsimony (Ockham’s Razor)
- Ockham’s Razor: “Entities should not be multiplied unnecessarily.”
- Prefer the simplest explanation that fits the data adequately.
- William of Ockham: “It is vain to do with more what can be done with fewer.”
Impact of Adding More Predictors
- Adding more predictors increases the variance explained by the model.
- However, it can also lead to overfitting, where the model becomes too complex.
Variance-Bias Trade-off
- As model complexity increases:
- Bias decreases (the model's predictions get closer to the true mean).
- Prediction variance increases.
- Goal: Find a model that balances bias and variance.
- Mean Squared Error (MSE) Formula:
MSE=Bias2+Variance+ImmeasurableError
∑(O−Pˉ)2=∑(P−Pˉ)
Determining the Best Model
- Model Quality Measures:
- R-squared (R2): Variance explained by the model, with a maximum value of 1 (100%).
- Residual Standard Error: Mean error of observed values from predicted values.
- Partial F-test: Compares the full model to a reduced model; effective for small and simple models.
- Other Measures:
- Information criteria: AIC, BIC, etc.
- Error measures: Useful when the goal is prediction. The best model has the smallest residual error.
Model Selection Strategies
- Everything: Trying all possible combinations of predictors.
- Each variable can be either included or excluded, resulting in 2n possible combinations.
- E.g., 3 predictors (x1, x2, x3) yield 8 models: null hypothesis (no variables), single variables (x1, x2, x3), two variables (x1 + x2, x1 + x3, x2 + x3), and all three variables (x1 + x2 + x3).
- Not recommended due to the high number of combinations.
- Stepwise Regression: Adding/removing predictors one at a time.
- Select Meaningful Predictors: Based on domain knowledge, correlation, or significance.
- Complex Approaches: Available for big data and machine learning.
Air Quality Example: Reducing Predictors?
- Full Model: Includes Temp, Solar.R, and Wind.
- Wind has the highest p-value, suggesting it might be removable without significant impact.
- Full Model:
- Multiple R-squared = 0.66, Adjusted R-squared = 0.66
- Call: lm(formula = log(Ozone) ~ Temp + Solar.R + Wind, data = airquality)
Code output is omitted for brevity. It includes residuals, coefficients, and significance codes.
Comparing Full and Reduced Models
- Full model: Multiple R-squared = 0.66, Adjusted R-squared = 0.66
- Reduced model (without Wind): Multiple R-squared = 0.62, Adjusted R-squared = 0.61
- Adjusted R-squared is lower by 4%. Is this difference significant and