Nested LMM (Hierarchical Mixed Model)

Nested LMM (Hierarchical Mixed Model)

⚡ Advanced · Mixed Models · Nested

v1.0.1

Architecture, Planning & Design context — fixed effect (treatment) + nested random effects. kullanici_memnuniyet_skoru ~ tedavi + (1|sehir/mahalle/yapi). Difference from VARCOMP: a fixed effect (e.g. treatment/group comparison) is added.

sehir/mahalle/yapi nestedTedavi sabit etkenREMLFixed effect estimate + p

🎯 What is it for?

When interpreting fixed effects in hierarchical data, it also accounts for the variance of the random factors. In Architecture, Planning & Design, if the same buildings receive different treatments, a classic t-test/ANOVA ignores the clustering → Type-I error. A nested LMM computes this correctly.

📌 When is it used?

  • Comparison of a fixed effect (treatment, intervention, condition) + hierarchical sampling
  • Multi-site clinical research, multi-center field trial
  • Adjusting site/group-level variance in RCTs

⚙ Assumptions

  1. Continuous DV, categorical fixed effect.
  2. Nested structure: neighborhood within city, building within neighborhood.
  3. Random effects ~ Normal(0, σ²).
  4. ≥1 observation in each treatment-building combination.

📊 How to Run It in MerQur?

1
Load the data.
2
Analysis → ⚡ Advanced → Nested LMM.
3

Panel assignments (form fields in the program):

  • Dependent variable (DV): memnuniyet
  • Replication (R): vizit
  • Upper-level group (P): sehir
  • Lower-level group (F): park_no
  • SS method: 1
4
Estimator: REML.
5
▶ Run. Fixed effect β̂ + p + σ² for each random level.

📊 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/108_nested_lmm_city_park_visit.xlsx

🎬 Scenario

In a nested design (city > park > visit) we test each level’s contribution separately;
nested LMM is appropriate.

⚙️ Variable Selection

  • Dependent: satisfaction | Replication: visit | Upper group: city | Lower group: park_no

Data Preview (First 5 Rows)

participant_id visit city park_no satisfaction
K0001 V1 Ankara P01 2.73
K0002 V1 Ankara P01 2.17
K0003 V1 Ankara P01 2.87
K0004 V2 Ankara P01 3.08
K0005 V2 Ankara P01 3.81

n = 288 · Columns: participant_id, visit, city, park_no, satisfaction

📈 MerQur Output

NESTED LMM (HIERARCHICAL MIXED MODEL) RESULT
─────────────────────────────────────────────

city (P): F = 9.06, p < .001 *** | park_no [within city] (F): F = 8.30, p < .001 ***
visit (R): F = 2.98, p = 0.038 *

💬 Interpretation

In this design the measurements are nested: city > park > visit. The nested mixed model tests each level’s
contribution to the variance separately. The results are significant at all levels: there are real differences
between cities (F = 9.06), between parks within a city (F = 8.30), and between visits (F = 2.98). Mixing up the
levels in nested data (e.g. ignoring the city) produces spurious significance or wrong standard errors. Nested LMM
is the correct framework for hierarchical urban designs (city/park/visit, region/neighborhood/unit), separating
the genuine contribution of each scale; it is the basis of multi-level urban green-space analysis.

⚠ Common Mistakes

  • Specifying “crossed” instead of “nested” — the neighborhood-ids must not repeat across each sehir.
  • Optimizer stalling (lbfgs llf=inf) — MerQur resolves it with a bfgs/cg cascade.
  • Treatment × sehir imbalance — the fixed-effect coefficient may be biased.

📚 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

Tüm atıf formatları →

📝 Ü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.