Skip to main content
Glama

Linear mixed model (repeated measures) / 线性混合模型(纵向/重复测量,公式模式)

linear_mixed_model
Read-only

Linear mixed model (repeated measures) / 线性混合模型(纵向/重复测量,公式模式) | USE WHEN: same subject measured repeatedly (pre/post, multiple follow-ups): compare trajectories over time, group×time interaction; modern replacement for repeated-measures ANOVA (handles missing, no sphericity assumption) | ALIASES: 混合模型, 重复测量, 纵向数据, LMM, mixed model, 交互作用, 多次随访, 每人测多次, repeated measures | RETURNS: 固定效应系数/SE/Wald z/P/95%CI(按真实变量名,不是 X1/X2)、各项整体检验 omnibus、交互项检验、primary_test、ICC、方差成分、n_subjects/n_obs、组间例数、缺失与收敛告警

Input Schema

NameRequiredDescriptionDefault
dataYes长格式数据:每行一次观测 [{受试者ID, 分组, 时点, 结局}, ...];也接受列式 {列名: [值, ...]}。注意必须是**长表**(每行一次测量),不是每人一行多列
remlNo默认 true(REML)
formulaYesR 风格公式,如 '收缩压 ~ 分组 * 时点'(组×时间交互);左端=结局
subjectYes受试者/病案号列名(随机截距的分组依据)
referenceNo参照水平,如 {"分组": "对照组"} —— 报告表里「与对照组相比」必须是它
re_formulaNo随机效应,默认 '1'(随机截距);随机斜率用 '1 + 时点'
categoricalNo显式声明哪些列按分类处理(如 ["分组"]);数值编码的 0/1 分组必须声明,否则会被当连续变量
time_valuesNo把字符串时点映射成数值以估线性趋势,如 {"时点": {"基线":0,"4周":1,"12周":2}}

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.1/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already establish a safe read-only, closed-world computation, so the description's job is to add analytic behavior — and it does, enumerating fixed-effect coefficients/SE/Wald z/P/95%CI reported under real variable names, omnibus tests, interaction test, primary_test, ICC, variance components, n_subjects/n_obs, group counts, and warnings for missingness and convergence. It notably discloses that missing data are handled and flags convergence issues, which matters for interpreting results. It does not state assumptions beyond sphericity or describe failure modes/error behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The piped sections (USE WHEN / ALIASES / RETURNS) are front-loaded and scannable, with the highest-value routing information first. The bilingual duplication and the long ALIASES list are somewhat padded, but they serve retrieval matching rather than displacing substance.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With 8 parameters, nested objects, no enums, and no output schema, the description compensates by spelling out the return payload in detail, which is exactly what an agent needs to decide whether to call it and how to read results. Combined with rich schema descriptions for every parameter, only minor gaps remain (no explicit refusal/validation behavior, no note on minimum group sizes).

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100% and each of the 8 parameters already carries a substantive description (long-format requirement, formula syntax, reference levels, re_formula defaults, categorical declaration for 0/1-coded groups). The prose description adds essentially no parameter-level guidance beyond what the schema states, so baseline 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific method and analytic scope: a linear mixed model in formula mode for repeated measures/longitudinal data, with the explicit goal of comparing trajectories and group×time interaction. It also positions it against a named alternative class ('modern replacement for repeated-measures ANOVA'), so an agent can distinguish it from siblings like two_way_anova without opening the schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The 'USE WHEN' clause gives a clear triggering condition (same subject measured repeatedly: pre/post, multiple follow-ups) and the analytic goal (trajectory comparison, group×time interaction), plus the conditions favoring it over RM-ANOVA (missing data, no sphericity assumption). It stops short of naming concrete sibling tools (e.g., two_way_anova, dunn_posthoc) or stating when not to use it, so an agent still has to infer sibling routing.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources