Skip to main content
Glama
seanshin0214

Dr. QuantMaster MCP Server

by seanshin0214

calc_power

Calculate statistical power for hypothesis tests given sample size, effect size, and significance level to determine if a study can detect meaningful effects.

Instructions

주어진 표본크기에서 검정력 계산

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
test_typeYes검정 유형
nYes표본크기
effect_sizeYes효과크기
alphaNo유의수준

Implementation Reference

  • Primary handler for 'calc_power' tool: extracts n, effectSize, alpha; computes power via helper; returns formatted result with interpretation and R code.
    function handleCalcPower(args: Record<string, unknown>) {
      const n = args.n as number;
      const effectSize = args.effect_size as number;
      const alpha = (args.alpha as number) || 0.05;
    
      // Simplified power calculation using helper function
      const power = calculatePower(n, effectSize, alpha);
    
      return {
        n,
        effect_size: effectSize,
        alpha,
        estimated_power: Math.min(power, 0.999).toFixed(3),
        interpretation: power >= 0.80 ? "적절한 검정력 (≥80%)" : "낮은 검정력 - 표본 증가 권장",
        r_code: `pwr.t.test(n = ${n}, d = ${effectSize}, sig.level = ${alpha}, type = "two.sample")`
      };
    }
  • Core power calculation using normal approximation for two-sample t-test (non-centrality parameter, CDF). Uses normalQuantile and normalCDF.
    export function calculatePower(
      n: number,
      effectSize: number,
      alpha: number = 0.05
    ): number {
      const zAlpha = normalQuantile(1 - alpha / 2);
      const ncp = effectSize * Math.sqrt(n / 2);
      const power = 1 - normalCDF(zAlpha - ncp);
      return Math.min(Math.max(power, 0), 1);
    }
  • Tool registration in exported tools array: defines name, description, input schema (note: test_type required but unused in handler).
    {
      name: "calc_power",
      description: "주어진 표본크기에서 검정력 계산",
      inputSchema: {
        type: "object",
        properties: {
          test_type: { type: "string", description: "검정 유형" },
          n: { type: "number", description: "표본크기" },
          effect_size: { type: "number", description: "효과크기" },
          alpha: { type: "number", description: "유의수준" },
        },
        required: ["test_type", "n", "effect_size"],
      },
    },
  • Dispatch registration in handleToolCall switch statement.
    case "calc_power":
      return handleCalcPower(args);

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