multilevel-modeling

Estimate multilevel models with ICC-driven selection and within-person centering.

33|6|Updated Mar 17, 2026
One-click install
npx skills add https://github.com/xjtulyc/awesome-rosetta-skills --skill multilevel-modeling
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: multilevel-modeling
Source: https://github.com/xjtulyc/awesome-rosetta-skills/tree/main/skills/11-psychology/multilevel-modeling
Command: npx skills add https://github.com/xjtulyc/awesome-rosetta-skills --skill multilevel-modeling

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires pymer4, statsmodels, pandas, numpy, matplotlib.

What problem does it solve?

This Skill helps you analyze nested or repeated-measures data by estimating within-person and between-person variance using multilevel/mixed-effects models, including ICC to decide whether clustering matters.

Core Features & Use Cases

  • Random intercepts and slopes for hierarchical data: Fit models where units (e.g., observations) are nested within persons or groups, and allow predictors to have person-specific effects.
  • ICC and variance decomposition: Compute intraclass correlation to quantify how much outcome variability is attributable to between-group differences.
  • ESM-friendly within-person centering: Separate within-person deviations from between-person differences for experience sampling or diary designs, reducing confounding.
  • Model comparison and inference workflows: Perform likelihood ratio tests, use Satterthwaite-style df via lmerTest, and support common contrast workflows through emmeans.
  • Three-level extensions: Handle structures like observations within days within persons for intensive longitudinal data.

Quick Start

Use the multilevel-modeling skill to fit a random-intercept model, compute ICC, apply within-person centering for ESM predictors, and compare candidate random-effect structures for your outcome.

Frequently Asked Questions about multilevel-modeling

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I compute ICC to decide whether multilevel modeling is needed for my nested data?

Intraclass correlation (ICC) quantifies the proportion of outcome variability attributable to between-group differences. This Skill estimates ICC to determine if clustering in your nested data warrants a mixed-effects model over standard regression.

How do I apply within-person centering for experience sampling method (ESM) data?

Within-person centering for ESM data separates within-person deviations from between-person differences, reducing confounding in diary designs. This Skill applies centering to separate contextual effects before fitting the mixed-effects model.

Do I need R and lme4 installed to run mixed-effects models with pymer4?

Yes, fitting mixed-effects models requires pymer4 with an R lme4 toolchain installed. The Skill uses this dependency to support random intercepts, random slopes, and Satterthwaite-style degrees of freedom via lmerTest.

Can I fit a three-level model for observations nested within days within persons?

Yes, this Skill handles three-level extensions for intensive longitudinal data. You can model structures like observations within days within persons to fit complex repeated measures and ESM designs accurately.

How do I compare random intercept and random slope structures using likelihood ratio tests?

Likelihood ratio tests compare candidate random-effect structures to determine the best fit. This Skill performs model comparisons alongside ICC-driven selection to validate whether random slopes significantly improve model fit over random intercepts.

What is the difference between random intercept and random slope models for repeated measures?

Random intercept models allow baseline differences across persons, while random slope models allow predictor effects to vary person-specifically. This Skill fits both structures to separate within-person and between-person variance in hierarchical data.