Skip to content

eminsin/Price_Prediction_with_Regression_Analysis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

93 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation


image_summary of the project

Theory-to-Implementation Study of Regression Analysis


๐ŸŽฏ Project Overview

This project was designed as an in-depth study of regression analysis, with a primary focus on understanding and practicing the underlying statistical and mathematical theory rather than treating regression as a black-box modeling technique.
The objective was to manually implement core regression concepts and compare the results with established R and Python libraries to gain a detailed understanding of estimation, inference, and model evaluation.


๐Ÿ”ฌ Laboratory

  • Developed and validated multiple linear regression models for real estate price prediction incorporating feature engineering, dummy variable encoding, and heteroscedasticity correction with weighted least squares.
  • Conducted comprehensive regression diagnostics and influence analysis, including leverage (hat values), Cookโ€™s distance, Breusch-Pagan test for heteroscedasticity, and robust standard error estimation (Whiteโ€™s correction), improving model reliability and interpretability.
  • Implemented prediction interval estimation for new observations using both standard and weighted models, demonstrating expertise in model evaluation, statistical inference, and advanced econometric techniques relevant to pricing, forecasting, and risk analysis.

๐Ÿ“‚ Folder Structure

Price_Prediction_with_Regression_Analysis/
โ”œโ”€โ”€ notebooks/
โ”‚   โ””โ”€โ”€ Regression_Analysis_with.ipynb                                 # Main walkthrough notebooks 
|   โ””โ”€โ”€ Regression_Analysis_with.R 
โ”œโ”€โ”€ data/
โ”‚   โ””โ”€โ”€ biele_WM_new.csv                                               # Real-world dataset
โ”œโ”€โ”€ scripts/
โ”‚   โ””โ”€โ”€ 1- Data_Preprocessing                                          # Step-by-step analysis
โ”‚   โ””โ”€โ”€ 2- OLS_Estimation
โ”‚   โ””โ”€โ”€ 3- Hypothesis_Testing
โ”‚   โ””โ”€โ”€ 4- Model_Selection
โ”‚   โ””โ”€โ”€ 5- Problem_Analysis
โ”‚   โ””โ”€โ”€ 6- (back to) Model_Selection
โ”‚   โ””โ”€โ”€ 7- Model_Diagnosis
โ”‚   โ””โ”€โ”€ 8- Linearity
โ”‚   โ””โ”€โ”€ 9- Homoscedasticity
โ”‚   โ””โ”€โ”€ 10- Variance_Inflation_Factor
โ”‚   โ””โ”€โ”€ 11- Outlier_Analysis
โ”‚   โ””โ”€โ”€ 12- Leverage
โ”‚   โ””โ”€โ”€ 13- Cook's_Distance
โ”‚   โ””โ”€โ”€ 14- Heteroscedastic_Errors
โ”‚   โ””โ”€โ”€ 15- Breusch-Pagan_Test
โ”‚   โ””โ”€โ”€ 16- Two-Stage_Least_Squares
โ”‚   โ””โ”€โ”€ 17- White-Estimators
โ”‚   โ””โ”€โ”€ 18- Final_Model
โ”œโ”€โ”€ README.md                                                          # Project overview (you are here)
โ””โ”€โ”€ LICENSE                                                            # MIT License

๐Ÿง  Notebook Topics

๐Ÿงฎ 1. Data Preprocessing

  • Cleaned and validated the dataset for missing values.
  • Transformed variables and prepared features for regression analysis.

๐Ÿงฎ 2. OLS Estimation

  • Implemented OLS estimation and calculated regression coefficients manually.
  • Built an OLS regression model and interpreted coefficients, significance tests, and goodness-of-fit metrics.
  • Validated manual results against built-in statistical outputs.

๐Ÿงฎ 3. Hypothesis Testing

  • Tested statistical significance of regression coefficients.
  • Conducted t-tests and evaluated p-values.
  • Assessed evidence for predictor effects on the response variable (F-Test).

๐Ÿงฎ 4. Model Selection

  • Compared alternative model specifications.
  • Evaluated predictor relevance and model performance.
  • Selected variables based on statistical and practical significance.

โ— 5. Problem Analysis

  • Investigated potential issues affecting model validity.
  • Assessed assumptions and data characteristics.
  • Identified areas requiring further diagnostic analysis.

๐Ÿงฎ 6. (back to) Model Selection

  • Refined the model by removing or retaining predictors.
  • Compared candidate models using performance metrics.
  • Improved model interpretability and predictive quality.

๐Ÿงฎ 7. Model Diagnosis

  • Evaluated overall model assumptions and fit.
  • Analyzed residual behavior and model adequacy.
  • Identified sources of bias or misspecification.

๐Ÿงฎ 8. Linearity

  • Verified the linear relationship between predictors and response.
  • Examined residual and fitted value plots.
  • Assessed whether linear regression assumptions were satisfied.

๐Ÿงฎ 9. Homoscedasticity

  • Checked for constant variance of residuals.
  • Evaluated residual patterns across fitted values.
  • Assessed suitability of standard OLS inference.

๐Ÿงฎ 10. Variance Inflation Factor

  • Measured multicollinearity among predictors.
  • Calculated VIF scores for each explanatory variable.
  • Identified variables causing instability in coefficient estimates.

๐Ÿงฎ 11. Outlier Analysis

  • Detected observations with unusual residual behavior.
  • Evaluated the impact of extreme data points.
  • Determined whether outliers should be investigated further.

๐Ÿงฎ 12. Leverage

  • Identified observations with extreme predictor values.
  • Assessed their potential influence on model estimates.
  • Examined leverage statistics and influence measures.

๐Ÿงฎ 13. Cook's Distance

  • Measured the influence of individual observations.
  • Identified points that substantially affected regression results.
  • Evaluated robustness of model estimates.

๐Ÿงฎ 14. Heteroscedastic Errors

  • Investigated non-constant error variance.
  • Analyzed residual dispersion patterns.
  • Assessed implications for statistical inference.

๐Ÿงฎ 15. Breusch-Pagan Test

  • Performed a formal test for heteroscedasticity.
  • Evaluated whether residual variance depended on predictors.
  • Determined the validity of OLS standard errors.

๐Ÿงฎ 16. Two-Stage Least Squares

  • Addressed potential endogeneity issues.
  • Implemented instrumental variable regression.
  • Estimated consistent coefficients under endogenous predictors.

๐Ÿงฎ 17. White-Estimators

  • Computed heteroscedasticity-robust standard errors.
  • Improved inference when variance assumptions were violated.
  • Compared robust and conventional statistical results.

๐Ÿงฎ 18. Final Model

  • Constructed the final validated regression model.
  • Incorporated diagnostic findings and model improvements.
  • Presented the final estimates, inference, and conclusions.

๐Ÿ›  Built With

  • Python 3.12 and R 4.4.0
  • numpy, pandas, scipy, statsmodels, scikitlearn, seaborn, matplotlib
  • Jupyter Notebook, RStudio

๐ŸŒฑ Inspired By

  • Regression Models, Methods and Applications by Ludwig Fahrmeir et al.

๐Ÿค Connect

Feel free to reach out or star this repo!

Letโ€™s learn together. ๐ŸŒฑ