Statistics IIUnit 211 min read
Correlation & Regression: Models, Analysis & Applications
Unit 2 of Statistics II covers correlation analysis (measuring linear relationships), simple and multiple linear regression (prediction models), model diagnostics, and ANOVA for regression, with practical applications in IT/CS domains like efficiency prediction, resource allocation, and experimental des
Core Concepts & Definitions
1. Correlation Analysis
Definition & Purpose
- Correlation measures the strength and direction of a linear relationship between two continuous variables.
- Key metrics:
- Pearson’s r (parametric, linear): (range: -1 to +1)
- Spearman’s ρ (non-parametric, monotonic): Rank-based correlation.
- Kendall’s τ (ordinal data, small samples).
Interpretation of r
| Value of r | Interpretation |
|---|---|
| 0.0 to 0.3 | Weak/negligible correlation |
| 0.3 to 0.7 | Moderate correlation |
| 0.7 to 1.0 | Strong correlation |
Limitations
- Not causal: Correlation ≠ causation (e.g., ice cream sales and drowning deaths both rise in summer).
- Sensitive to outliers: Extreme values distort r.
- Linear only: Fails for non-linear relationships (e.g., ).
2. Simple Linear Regression (SLR)
Mathematical Model
The population regression line:
- Estimated model (OLS): where:
- (intercept),
- (slope).
Assumptions of SLR
- Linearity: Relationship between and is linear.
- Independence: Observations are independent (no autocorrelation).
- Homoscedasticity: Constant variance of errors ().
- Normality: Errors .
- No multicollinearity (irrelevant for SLR but critical in MLR).
Worked Example: Predicting Computer Efficiency
Problem: A manager tests a new program’s efficiency (: processing speed in ops/sec) against:
- : Data size (MB),
- : Number of tables used.
Given data (hypothetical):
| Data Size () | Tables () | Efficiency () |
|---|---|---|
| 10 | 2 | 45 |
| 20 | 3 | 70 |
| 30 | 1 | 55 |
| ... | ... | ... |
Steps:
- Plot scatterplots (e.g., vs. ) to check linearity.
- Calculate Pearson’s r between and each predictor:
- (strong positive),
- (moderate negative).
- Fit SLR models:
- Model 1: (),
- Model 2: ().
- Choose better predictor: explains more variance.
3. Multiple Linear Regression (MLR)
Model Equation
- Coefficients estimated via Ordinary Least Squares (OLS):
- Partial regression coefficients: Measure effect of one predictor holding others constant.
ANOVA Table for Regression
| Source | df | SS | MS | F | p-value |
|---|---|---|---|---|---|
| Regression | SSR | MSR = SSR/k | < 0.05 (significant) | ||
| Error | SSE | MSE = SSE/(n-k-1) | |||
| Total | SST = SSR + SSE |
Example Interpretation: From the past exam question:
- Regression SS = 740, df = 2 → MSR = 370.
- Error SS = 510, df = 17 → MSE = 30.
- F = 370 / 30 = 12.33 → p < 0.05 (significant model).
Key Metrics
- Coefficient of Determination ():
- Adjusted : Penalizes extra predictors:
- Standard Error of Estimate (SEE):
- t-tests for coefficients: Check if .
Worked Example: CVS Study
Problem: Predict Computer Vision Syndrome (CVS) score () using:
- : Age (years),
- : Working hours/day.
Regression Output:
- SSR = 450, SSE = 150, , .
- ANOVA Table:
Source df SS MS F Regression 2 450 225 30 Error 27 150 5.56 Total 29 600
Calculations:
- (75% variance explained).
- Adjusted :
- F-test: → p < 0.05 (model significant).
4. Model Diagnostics
Common Issues & Fixes
| Issue | Detection Method | Solution |
|---|---|---|
| Non-linearity | Residual plots (curved pattern) | Add polynomial terms (e.g., ) |
| Heteroscedasticity | Funnel-shaped residuals | Transform (log, sqrt) |
| Multicollinearity | High VIF (>5-10) or | Remove/retain one correlated predictor |
| Outliers | Large studentized residuals (>3) | Remove or use robust regression |
| Autocorrelation | Durbin-Watson test (DW ≈ 0 or 4) | Use ARMA models or lag variables |
Residual Analysis
- Plot residuals vs. fitted values:
- Good: Random scatter around 0.
- Bad: Patterns (e.g., curves, fans).
- Normal Q-Q plot:
- Points should lie on a straight line.
5. Partial and Multiple Correlation
Definitions
- Partial Correlation (): Correlation between and removing effect of .
- Multiple Correlation (): Correlation between and a set of predictors.
Worked Example
Given: , , .
Find:
Partial correlation : → Weak partial correlation.
Multiple correlation : Use the formula for 3 variables: (Derivation omitted; typically computed via software.)
6. Applications in Computer Science/IT
| Scenario | Regression/Correlation Use Case |
|---|---|
| Software Efficiency | Predict processing time () vs. input size (). |
| Hardware Lifespan | Model RAM degradation () vs. usage hours (). |
| User Satisfaction | Regression of job satisfaction () on training hours () and salary (). |
| Network Traffic | Correlate latency () with server load (). |
| Algorithm Performance | Compare runtime () across different data structures (). |
7. Latin Square Design (LSD) – Brief Link
(Note: LSD is covered in Unit 3, but regression is used in its analysis.)
- Purpose: Control two blocking variables (e.g., operator skill and machine type) in experiments.
- ANOVA Table (for LSD):
Source df SS MS F Rows (A) m-1 Columns (B) m-1 Treatments (T) m-1 Error (m-1)(m-2) Total m²-1 - Assumption: One observation per cell.
Exam Tip: How to Score Full Marks
1. Structured Answers
For correlation:
- Always state the type of correlation (Pearson/Spearman).
- Interpret r with direction and strength.
- Mention limitations (e.g., non-linearity, outliers).
For regression:
- Write the full model equation ().
- Show ANOVA table with SS, df, MS, F.
- Calculate and interpret and adjusted .
- Discuss significance of coefficients (t-tests).
2. Common Pitfalls to Avoid
- Ignoring assumptions: Always check linearity, homoscedasticity, etc.
- Misinterpreting : It’s not causal! High ≠ good model if predictors are nonsensical.
- Forgetting units: Report coefficients with units (e.g., "Efficiency increases by 2 ops/sec per MB of data").
- Partial vs. multiple correlation: Clearly label which is being asked.
3. Numerical Questions
- Always show steps:
- For : .
- For partial correlation: Use the formula and simplify.
- Use given data: If SS/df are provided, compute MS and F directly.
4. Theoretical Questions
- Define key terms precisely:
- "Partial correlation controls for the effect of a third variable."
- "Multiple regression extends SLR to multiple predictors."
- Compare SLR vs. MLR:
Aspect Simple Linear Regression Multiple Linear Regression Predictors One () Two or more () Equation Interpretation Slope is total effect. Coefficients are partial effects. Assumptions Easier to check. Harder (multicollinearity, etc.).
5. Practical Tips
- For ANOVA tables: Memorize the df formula:
- Regression df = number of predictors.
- Error df = (where = predictors).
- For partial correlation: If given 3 variables, always compute or similar.
- For exam questions:
- If asked to "complete the ANOVA table," ensure SS adds up (SSR + SSE = SST).
- If asked to "interpret," always link back to the context (e.g., "This means efficiency improves with data size...").
Summary Checklist
Before submitting, verify: ✅ Definitions are precise (e.g., "Pearson’s r measures linear association"). ✅ Formulas are correctly applied (e.g., calculation). ✅ Assumptions are listed for regression. ✅ Interpretations are contextual (not just numbers). ✅ Tables/figures are labeled clearly (e.g., "ANOVA Table for MLR"). ✅ Units are included where applicable (e.g., "per MB").
Final Note: This unit is heavily numerical—practice calculating r, regression coefficients, ANOVA tables, and partial correlations under time constraints. Use past exam questions to drill these skills! For IT/CS applications, always relate regression to real-world scenarios (e.g., predicting system performance).
Based on the TU BSc CSIT syllabus for Statistics II (STA215), unit 2.
Discussion
Loading…