Hierarchical Bayesian Regression
v1.0.2
Architecture, Planning & Design context — multilevel regression with a random intercept that varies across mahalle. It estimates the park_kullanim_yogunlugu ~ erisilebilirlik_skoru relationship separately for each neighborhood and reports the posterior distribution + 95% CrI. PyMC NOT REQUIRED — statsmodels MixedLM + Empirical Bayes BLUP.
🎯 What is it for?
If your data are hierarchical (student-school, patient-hospital, measurement-device, etc.), OLS regression ignores within-group correlation → type-I error increases. Hierarchical Bayesian learns each group’s own intercept and reports it together with the 95% CrI. With BF₁₀ (LMM vs OLS), whether group-level variance is needed is tested.
📌 When is it used?
- In Architecture, Planning & Design, neighborhood-level clustered data (≥10-20 individuals per neighborhood)
- ICC > 0.05 — group-level variance must be taken into account
- Shrinkage-corrected ranking for the question “Which neighborhood performs high/low?”
⚙ Assumptions
- Random effect ~ Normal(0, σ²mahalle).
- Within-group residual ~ Normal(0, σ²).
- ≥10 observations per group are recommended; with fewer, an informative prior is critical.
📊 How Is It Run in MerQur?
Panel assignments (form fields in the program):
- Columns:
{'dv': 'memnuniyet', 'fixed': ['yesil_orani'], 'group': 'sehir'} - Parameters:
{}
📊 Sample Dataset — Architecture, Planning & Design
ℹ Note: The scenario, MerQur output and interpretation below were produced by actually running the real example dataset in MerQur. Numeric results on your own data will differ; the goal is to show how the analysis is set up and interpreted end-to-end.
🎬 Example File
This analysis is demonstrated on the following example dataset for Architecture, Planning & Design:
Peyzaj_Mimarligi/104_hierarchical_bayesian_city_random.xlsx
🎬 Scenario
In multi-city data we predict satisfaction from green ratio with a city random effect
using a Bayesian hierarchical model.
⚙️ Variable Selection
- Dependent: satisfaction | Group: city | Predictor: green_ratio
Data Preview (First 5 Rows)
| city | green_ratio | satisfaction |
|---|---|---|
| Ankara | 0.751 | 5.0 |
| Ankara | 0.739 | 4.87 |
| Ankara | 0.273 | 3.78 |
| Ankara | 0.354 | 3.98 |
| Ankara | 0.124 | 2.44 |
n = 200 · Columns: city, green_ratio, satisfaction
📈 MerQur Output
─────────────────────────────────────────────
Group (city) random variance = 0.0604 (33.5%) residual = 0.1202 (66.5%) ICC = 0.335
Satisfaction ~ green ratio + (1 | city) (Bayesian)
💬 Interpretation
We analysed multi-city data (parks within cities) with a Bayesian hierarchical model — the Bayesian counterpart of
LMM. The city-level variance is 33.5% of the total (ICC = 0.335); a significant part of the variability comes from
between-city differences, most from the park level. So satisfaction depends on both the city and the individual
park. The Bayesian hierarchical model’s strength: it expresses both within- and between-group uncertainty with full
probability distributions and balances cities with few observations via “partial pooling”. In multi-city/multi-
centre landscape studies it is the modern way to model both local and general effects.
⚠ Common Mistakes
- If a group has <5 observations, its group-level estimate is unreliable — a more informative prior is needed.
- A random slope (a random slope for erisilebilirlik_skoru) is not the default; if there is a cross-level interaction it must be added explicitly.
- If ICC < 0.05, OLS may suffice — check BF₁₀.
📚 MerQur’a Atıf
Örücü, Ö. K. (2026). MerQur: Integrated Academic Data Analysis & Reporting Platform [Computer software] (Version 1.0.0). https://doi.org/10.53463/merqur.2026001
📝 Üretim Notu — Bu sayfadaki örnek veri sentetik olarak üretilmiştir (sabit SEED=42, generator: samples/Ileri_Duzey_v102/_generate_v102_datasets.py). Sayfa içeriği Anthropic Claude desteği ile hazırlanmış, akademik doğruluk yazar tarafından kontrol edilmiştir.