Skip to main content
Glama

sa_analyze

Analyze saved simulation variable results from sensitivity analysis designs. Computes Sobol indices or elementary effects and returns fit quality and factor effect tables.

Instructions

Analyse the design results for one saved variable with LSD's R package LSDsensitivity. metamodel 'kriging' (default for lhs, random and nolh designs) or 'polynomial' fits a meta-model and computes its Sobol decomposition: returns the fit quality (Q2 for kriging, R2 for polynomial) and a table with direct effects and interactions per factor. For a design made with method 'ee' the analysis is elementary effects (metamodel 'ee', chosen automatically): returns per factor mu, mu_star, sigma, se and p_value (parameters scaled to [0, 1]; mu_star is the overall effect, sigma non-linear or interaction effects, p_value tests mu_star = 0), sorted by mu_star. Kriging or polynomial on an ee design, or ee on another design, is an error. For an ee design made in LSD's own interface (no design file) pass metamodel='ee' with its levels and jump. ini_drop drops initial time steps, n_keep keeps that many (-1 = all). The response is the mean of the variable over the kept steps, averaged over runs. Variables whose name starts with '_' work; with several instances only the first instance is analysed. ini_drop must be below MAX_STEP and ini_drop + n_keep at most MAX_STEP. r_seed seeds R's random numbers, so identical calls give identical results. A warning is added when a meta-model fit is below 0.5. The polynomial meta-model fails when a design point has a negative mean response (LSD weights points by mean/SD) and needs at least two factors; use kriging then. Kriging can fail numerically when design points nearly coincide (the message says so; try polynomial). Needs Rscript and LSDsensitivity; says so if they are missing.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
jumpNo
modelYes
configYes
levelsNo
n_keepNo
r_seedNo
ini_dropNo
variableYes
metamodelNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.6/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and does so richly: it discloses determinism via r_seed, dependency failures (Rscript/LSDsensitivity), a sub-0.5 fit warning, polynomial failure on negative-mean responses, kriging numerical failure on coincident points, and edge behavior for '_'-prefixed variables and multiple instances.

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?

Front-loaded with the core verb and the two metamodel branches before constraints, which is the right ordering. The prose is dense and run-on in places, but nearly every clause carries a behavioral fact an agent needs, so the length is largely earned for a 9-parameter tool.

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

Completeness5/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 supplies the return shapes (Q2/R2, effects/interactions table, mu/mu_star/sigma/se/p_value), the scaling and sorting of ee output, and the operational preconditions. Nothing essential to invoking or interpreting it is missing.

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?

At 0% schema coverage the description must compensate, and it explains metamodel, ini_drop, n_keep, r_seed, levels and jump with real meaning, including the MAX_STEP constraint and -1 sentinel. It leaves model, config and variable essentially defined only by surrounding prose, so one or two parameters remain under-specified.

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: 'Analyse the design results for one saved variable with LSD's R package LSDsensitivity.' It clearly delineates this as the analysis step, distinct from the design/run siblings (sa_create_design, sa_run_design), so an agent can place it without opening any 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?

Gives strong conditional guidance: kriging/polynomial for lhs/random/nolh, 'ee' chosen automatically for an ee design, and that mixing metamodels with the wrong design is an error. It also routes around failures ('use kriging then', 'try polynomial'). It stops short of explicitly naming sibling tools or stating the prerequisite ordering relative to sa_run_design.

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