Skip to main content
Glama
seanshin0214

Dr. QuantMaster MCP Server

by seanshin0214

calc_sample_size

Calculate required sample sizes for statistical tests including t-tests, ANOVA, regression, and proportion analysis to ensure adequate study power.

Instructions

필요 표본크기 계산 (t-test, ANOVA, regression, proportion)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
test_typeYes검정 유형
effect_sizeYes효과크기 (Cohen's d, f, f²)
alphaNo유의수준 (기본: 0.05)
powerNo검정력 (기본: 0.80)
groupsNo집단 수 (ANOVA)
predictorsNo예측변수 수 (회귀)

Implementation Reference

  • The handler function executing the core logic for calc_sample_size tool. Computes required sample size for various tests (t-test, ANOVA, regression, etc.) using approximate formulas based on effect size, alpha, and power.
    function handleCalcSampleSize(args: Record<string, unknown>) {
      const testType = args.test_type as string;
      const effectSize = args.effect_size as number;
      const alpha = (args.alpha as number) || 0.05;
      const power = (args.power as number) || 0.80;
    
      // Simplified sample size formulas
      const zAlpha = alpha === 0.05 ? 1.96 : (alpha === 0.01 ? 2.576 : 1.645);
      const zBeta = power === 0.80 ? 0.84 : (power === 0.90 ? 1.28 : 0.52);
    
      let n: number;
      let formula: string;
    
      switch (testType) {
        case "t_test_two":
          n = Math.ceil(2 * ((zAlpha + zBeta) / effectSize) ** 2);
          formula = "n per group = 2 × ((z_α + z_β) / d)²";
          break;
        case "t_test_paired":
          n = Math.ceil(((zAlpha + zBeta) / effectSize) ** 2);
          formula = "n = ((z_α + z_β) / d)²";
          break;
        case "anova":
          const groups = (args.groups as number) || 3;
          n = Math.ceil((groups * (zAlpha + zBeta) ** 2) / (effectSize ** 2));
          formula = "n per group = k × (z_α + z_β)² / f²";
          break;
        case "regression":
          const predictors = (args.predictors as number) || 5;
          n = Math.ceil((8 / (effectSize ** 2)) + predictors);
          formula = "n ≈ 8/f² + k (Green, 1991 rule)";
          break;
        default:
          n = Math.ceil(2 * ((zAlpha + zBeta) / effectSize) ** 2);
          formula = "Generic formula used";
      }
    
      return {
        test_type: testType,
        effect_size: effectSize,
        alpha,
        power,
        required_n: n,
        formula,
        interpretation: `${power * 100}% 검정력으로 효과크기 ${effectSize} 탐지에 필요한 최소 표본: ${n}`,
        note: "실제 계산은 G*Power 또는 pwr 패키지 사용 권장"
      };
    }
  • Tool registration entry in the exported tools array, defining the name, description, and input schema for validation.
      name: "calc_sample_size",
      description: "필요 표본크기 계산 (t-test, ANOVA, regression, proportion)",
      inputSchema: {
        type: "object",
        properties: {
          test_type: {
            type: "string",
            enum: ["t_test_two", "t_test_paired", "anova", "regression", "proportion", "chi_square"],
            description: "검정 유형"
          },
          effect_size: { type: "number", description: "효과크기 (Cohen's d, f, f²)" },
          alpha: { type: "number", description: "유의수준 (기본: 0.05)" },
          power: { type: "number", description: "검정력 (기본: 0.80)" },
          groups: { type: "number", description: "집단 수 (ANOVA)" },
          predictors: { type: "number", description: "예측변수 수 (회귀)" },
        },
        required: ["test_type", "effect_size"],
      },
    },
  • Registration in the handleToolCall switch statement, dispatching calls to the specific handler function.
      return handleCalcSampleSize(args);
    case "calc_power":
  • Input schema definition for the calc_sample_size tool, specifying parameters like test_type, effect_size, alpha, power with types, enums, and required fields.
    inputSchema: {
      type: "object",
      properties: {
        test_type: {
          type: "string",
          enum: ["t_test_two", "t_test_paired", "anova", "regression", "proportion", "chi_square"],
          description: "검정 유형"
        },
        effect_size: { type: "number", description: "효과크기 (Cohen's d, f, f²)" },
        alpha: { type: "number", description: "유의수준 (기본: 0.05)" },
        power: { type: "number", description: "검정력 (기본: 0.80)" },
        groups: { type: "number", description: "집단 수 (ANOVA)" },
        predictors: { type: "number", description: "예측변수 수 (회귀)" },
      },
      required: ["test_type", "effect_size"],
    },
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. While it indicates this is a calculation tool (implied read-only), it doesn't specify whether this is a statistical simulation, formula-based calculation, or what format the output takes. There's no mention of computational requirements, accuracy limitations, or what happens with invalid parameter combinations. For a statistical calculation tool with zero annotation coverage, this represents significant behavioral transparency gaps.

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 extremely concise - a single phrase listing the tool's purpose and supported test types. While efficient, it might be too brief given the tool's complexity (6 parameters, statistical calculations). However, every word earns its place by communicating essential information without redundancy.

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

Completeness2/5

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

For a statistical calculation tool with 6 parameters, no annotations, and no output schema, the description is insufficiently complete. It doesn't explain what the tool returns (sample size number? confidence intervals? formula details?), doesn't provide usage examples or context, and doesn't address common statistical assumptions or limitations. Given the complexity and lack of structured documentation elsewhere, the description should provide more contextual information.

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?

With 100% schema description coverage, the schema already documents all 6 parameters thoroughly. The description adds no parameter-specific information beyond what's in the schema - it doesn't explain parameter relationships, provide examples of effect size values for different test types, or clarify how parameters interact. The baseline score of 3 reflects adequate parameter documentation through the schema alone.

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

Purpose4/5

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

The description clearly states the tool's purpose as '필요 표본크기 계산' (calculate required sample size) and lists specific statistical tests it supports (t-test, ANOVA, regression, proportion). This provides a specific verb+resource combination, though it doesn't explicitly differentiate from sibling tools like 'calc_power' or 'mde_calculator' which might have related statistical calculation purposes.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. With multiple sibling tools for statistical calculations (calc_power, calc_effect_size, mde_calculator, etc.), there's no indication of when this sample size calculator is appropriate versus other statistical tools. The description simply lists what it does without contextual usage information.

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

Install Server

Other Tools

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/seanshin0214/quantmaster-mcp-server'

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