Nested LMM (Hierarchical Mixed Model)

Nested LMM (Hierarchical Mixed Model)

⚡ Advanced · Mixed Models · Nested

v1.0.1

Natural Sciences & Mathematics context — fixed effect (treatment) + nested random effects. reaksiyon_verimi_pct ~ tedavi + (1|laboratuvar/tezgah/tekrar). The difference from VARCOMP: a fixed effect (e.g., treatment/group comparison) is added.

laboratuvar/tezgah/tekrar 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 Natural Sciences & Mathematics, if the same tekrar receives different treatments, a classical 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: bench within laboratory, replicate within bench.
  3. Random effects ~ Normal(0, σ²).
  4. ≥1 observation in each treatment-replicate combination.

📊 How to Run It in MerQur?

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

Panel assignments (form fields in the program):

  • Dependent Variable: deger
  • Repeat Variable: blok
  • Upper Group: ust_grup
  • Nested Group: alt_grup_no
  • SS Type: 1
4
Estimator: REML.
5
▶ Run. Fixed effect β̂ + p + σ² for each random level.

📊 Sample Dataset — Natural Sciences & Mathematics

ℹ 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 Natural Sciences & Mathematics:

Fen_Matematik/108_nested_lmm_R_P_F.xlsx

🎬 Scenario

We model a value in a nested design (upper>lower>block). For nested hierarchies,
nested LMM is appropriate.

⚙️ Variable Selection

  • Dependent variable: value
  • Factor (categorical): lower_group_no
  • Factor (categorical): upper_group
  • Factor (categorical): block

Data Preview (First 5 Rows)

unit_id block upper_group lower_group_no value
B001 R1 P1 F01 43.23
B002 R1 P1 F01 48.59
B003 R1 P1 F01 43.18
B004 R2 P1 F01 41.92
B005 R2 P1 F01 43.46

n = 288 · Columns: unit_id, block, upper_group, lower_group_no, value

📈 MerQur Output

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

upper_group (P) effect: F = 27.44, p < .001 *** lower_group_no (R) effect: F = 6.11, p < .001 ***
nested variance components (block within P)

💬 Interpretation

We modeled a value in a nested design (upper group > lower group > block): both the upper level (F = 27.44,
p < .001) and the lower/replication level (F = 6.11, p < .001) make significant contributions. Nested LMM correctly
handles hierarchies where sub-units are nested within super-units (each block belongs to only one group); by
partitioning variance into levels it shows each layer’s share. In the lab it is used to correctly separate effects
in batch/sample/replicate hierarchies.

⚠ Common Mistakes

  • Specifying “crossed” instead of “nested” — the bench-ids must not repeat across each laboratuvar.
  • Optimizer stalling (lbfgs llf=inf) — MerQur resolves it with a bfgs/cg cascade.
  • Treatment × laboratuvar 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.