Skip to main content
Glama
Ian3738
by Ian3738

survey_regression

Runs weighted regression on complex survey data, combining plausible values and replicate-weight standard errors for accurate TIMSS/PISA-style achievement analysis.

Instructions

Weighted regression for complex survey data, with replicate-weight standard errors and plausible-value pooling (Rubin's rules, Barnard-Rubin degrees of freedom). Use this instead of regression for TIMSS/PISA-style data: passing a single plausible value to an ordinary regression ignores measurement uncertainty, which is often 10-20% of the total.

For achievement scores use plausible values, never a single score: pv_prefix='BSMMAT' expands to BSMMAT01..05 (TIMSS style), or pv_pattern='PV{i}MATH' expands to PV1MATH.. (PISA style). The output reports how much of the standard error comes from sampling versus measurement.

Give the design one of two ways: replicate_weights (existing columns — either a list of names or a prefix such as 'W_FSTURWT' that matches W_FSTURWT1..80), or jkzone + jkrep so JK2 replicates are built for you (TIMSS/PIRLS ship JKZONE and JKREP). method defaults to JK2 for constructed replicates and Fay for 60+ supplied columns, which is what PISA needs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dvNoObserved outcome column. Omit when using plausible values.
fayNoFay factor when method='fay'.
dataYesDataset name in the session.
jkrepNoJackknife replicate indicator column (TIMSS: JKREP).
digitsNoDecimal places.
jkzoneNoJackknife zone column (TIMSS: JKZONE).
methodNoReplication method: auto, jk2, jk1, brr or fay.auto
weightYesFinal sampling weight column.
formulaNoRight-hand side as a formula, e.g. '~ age + sex + age:sex'. Overrides `predictors`.
pv_countNoHow many plausible values.
pv_prefixNoPlausible-value prefix for the outcome, e.g. 'BSMMAT'.
predictorsNoPredictor columns. Interactions can be written as 'a:b'.
pv_patternNoPlausible-value pattern with {i}, e.g. 'PV{i}MATH'.
replicate_weightsNoReplicate weight columns, or a prefix matching them.

Schema Changelog

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

  1. First observedv0.1.0

TDQS

A4.7/5.0
Behavior4/5

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

No annotations are provided, so the description carries the full burden. It richly discloses statistical behavior: Rubin's rules, Barnard-Rubin degrees of freedom, sampling versus measurement standard-error decomposition, and default method selection (JK2 vs Fay). It does not explicitly state whether the function mutates session state or the exact return object, which is a minor gap without annotation support.

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

Conciseness5/5

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

The description is about 170 words in three focused paragraphs: what it does, when to use it, and how to specify the design. Every sentence carries signal, and the most important purpose and sibling contrast are front-loaded.

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 14-parameter tool with no output schema and no annotations, the description covers the hard parts: plausible-value expansion, replicate-weight alternatives, default methods, and the sampling-vs-measurement SE reporting. The main remaining gap is the lack of an explicit return contract, such as what result columns an agent should expect, since no output schema exists to supply that.

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

Parameters5/5

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

Although the schema has 100% coverage, the description adds meaning beyond it: `pv_prefix='BSMMAT'` expands to BSMMAT01..05, `pv_pattern='PV{i}MATH'` expands to PV1MATH.., `replicate_weights` can be a prefix matching W_FSTURWT1..80, and `method` defaults differ by design. These details materially improve correct parameter usage.

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?

States a specific verb and resource: 'Weighted regression for complex survey data' with replicate-weight standard errors and plausible-value pooling. It explicitly contrasts with sibling `regression` ('Use this instead of regression for TIMSS/PISA-style data'), so an agent can distinguish it without opening either schema.

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

Usage Guidelines5/5

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

Provides explicit when-to-use guidance: use instead of `regression` for TIMSS/PISA-style data with plausible values, and warns never to pass a single score. It also details two mutually exclusive design-specification routes (`replicate_weights` vs `jkzone`+`jkrep`) and names the specific data formats, leaving little to inference.

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