In this project, developed in collaboration with a fellow coursemate, we analyzed the variation in U.S. home prices using a Bayesian hierarchical modeling approach. The dataset included over 20,000 observations from neighborhoods across North America, with variables covering socio-demographics, housing characteristics, and geographical proximity to the ocean.
- Investigate how ocean proximity affects median house values
- Model the effect of covariates (e.g., income, housing age) across groups using Bayesian hierarchical regression
We applied two main modeling frameworks:
- Groups based on ocean proximity levels
- Posterior estimation via Gibbs Sampling
- Parameters: group-specific means, common variance, between-group variance
- Group-specific intercepts + shared slopes (β) across all groups
- Priors placed on all model components, including a Wishart prior on the precision matrix of the regression coefficients
- Inference through Gibbs Sampling with custom update steps for each parameter
- Exploratory data analysis: boxplots, smoothed trends by group
- Convergence diagnostics: traceplots, ACF, and Geweke test
- Posterior predictive checks and simulation for new hypothetical neighborhoods
- Median house values varied significantly by ocean proximity: Inland areas had notably lower prices
- Income, housing age, and household size were among the most impactful covariates
- Posterior estimates were stable and showed good convergence properties
- The Bayesian approach captured group-level structure and uncertainty not addressed by standard regression
The data was sourced from Kaggle and originally published on Zenodo by researchers.
Each row corresponds to a U.S. neighborhood in 2012, with the following variables:
- Median house value (response)
- Housing median age
- Total rooms and bedrooms
- Population and households
- Median inco