Skip to main content
Glama
Ian3738
by Ian3738

regression

Fit linear, logistic, Poisson, ordinal, multinomial, mixed, or GAM models and report coefficients, confidence intervals, fit statistics, and diagnostics.

Instructions

Fit a regression model and report coefficients with confidence intervals, model fit and diagnostics. Supported type values:

  • linear: OLS, with optional standardised betas and robust (HC3) standard errors

  • logistic: binary outcome, reported with odds ratios and a classification table

  • poisson / negbin: count outcomes, reported with incidence rate ratios

  • ordinal: ordered outcome (proportional odds); order the levels with data_transform first

  • multinomial: unordered outcome with more than two categories

  • mixed / mixed_logistic: multilevel models; give the random part in random, e.g. random='(1 | school)'

  • gam: smooth terms, written in the formula as s(x)

Specify the model either as formula ('y ~ x1 + x2 + x1:x2') or as dv plus predictors. The fit is saved in the session for model_diagnostics, model_compare and model_predict.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dvNoOutcome column, as an alternative to `formula`.
dataYesDataset name in the session.
linkNoLink function, e.g. 'logit', 'probit', 'log'.
typeNolinear, glm, logistic, poisson, negbin, ordinal, multinomial, mixed, mixed_logistic or gam.linear
plotsNoInclude residual diagnostic plots.
digitsNoDecimal places.
familyNoFamily for type='glm' or 'gam', e.g. 'binomial', 'Gamma'.
randomNoRandom-effects term for mixed models, e.g. '(1 | school)' or '(1 + time | id)'.
robustNoAdd heteroscedasticity-robust (HC3) standard errors.
formulaNoR formula, e.g. 'score ~ age + sex + age:sex' or 'y ~ s(x) + z' for a GAM.
save_asNoName for the fitted model in the session.
weightsNoColumn of case weights.
conf_levelNoConfidence level for coefficients.
predictorsNoPredictor columns, used with `dv`.
standardizeNoAdd standardised beta coefficients (linear models).

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. First observedv0.1.0

TDQS

A4.3/5.0
Behavior4/5

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

With no annotations provided, the description carries the full behavioral burden, and it does disclose a key side effect: 'The fit is saved in the session for model_diagnostics, model_compare and model_predict.' It does not detail behavior around error handling or unsupported combinations, but for a statistical fitter the essential stateful behavior is revealed.

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 description is long but every sentence earns its place for a 15-parameter tool. The core purpose is front-loaded, then the type catalog, then specification methods, then the session-save side effect. The only mild redundancy is explaining type meanings that partly overlap with the schema's 'type' description, but the added detail justifies the length.

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?

For a complex tool with no output schema and no annotations, the description covers the type system, both specification alternatives, the save behavior, and parameter syntax examples. It doesn't describe the return format in detail beyond 'coefficients with confidence intervals, model fit and diagnostics,' but combined with the 100%-covered schema this is adequate for an agent to call it correctly.

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

Parameters4/5

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

Schema coverage is 100%, but the description genuinely adds meaning beyond the schema: it explains each type value where the schema only lists names, gives the formula syntax for GAM terms (s(x)), demonstrates the random-effects syntax, and clarifies formula vs dv+predictors as mutually alternative paths. This goes beyond the schema's per-field descriptions.

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 opens with a specific verb-resource statement: 'Fit a regression model and report coefficients with confidence intervals, model fit and diagnostics.' This clearly differentiates it from siblings like correlation, check_assumptions, and test_ttest, and the enumerated type list further scopes what counts as a 'regression model'.

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 description gives strong within-tool guidance: each supported type is explained (e.g., 'ordinal: ordered outcome... order the levels with data_transform first', 'mixed: give the random part in random'), and it clarifies the two specification paths (formula vs dv+predictors). However, it never routes the agent away from alternative modeling siblings such as survey_regression, mediation, or survival_analysis, so situational exclusion guidance is missing.

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

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Ian3738/r-stats-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server