Skip to main content
Glama

power_curve

Generate power curve data for statistical tests to visualize how sample size and effect size impact detection probability, enabling researchers to design studies with adequate statistical power.

Instructions

검정력 곡선 데이터 생성 (시각화용)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
test_typeYes검정 유형
n_rangeYes[최소, 최대] 표본크기
effect_sizesYes효과크기 배열
alphaNo유의수준

Implementation Reference

  • Main handler function for 'power_curve' tool. Generates power curve data points for visualization by computing power across a range of sample sizes and effect sizes using the calculatePower helper function.
    function handlePowerCurve(args: Record<string, unknown>) { const nRange = args.n_range as number[]; const effectSizes = args.effect_sizes as number[]; const alpha = (args.alpha as number) || 0.05; const curveData: any[] = []; const nMin = nRange[0]; const nMax = nRange[1]; const step = Math.ceil((nMax - nMin) / 20); for (let n = nMin; n <= nMax; n += step) { for (const d of effectSizes) { const power = calculatePower(n, d, alpha); curveData.push({ n, effect_size: d, power: Math.min(power, 0.999).toFixed(3) }); } } return { alpha, n_range: nRange, effect_sizes: effectSizes, curve_data: curveData, r_code: `library(pwr)\npower_curve <- pwr.t.test(n = seq(${nMin}, ${nMax}, by=${step}), d = c(${effectSizes.join(", ")}), sig.level = ${alpha}, type = "two.sample")` }; }
  • Input schema definition for the 'power_curve' tool, specifying parameters such as test_type, n_range, effect_sizes, and alpha.
    inputSchema: { type: "object", properties: { test_type: { type: "string", description: "검정 유형" }, n_range: { type: "array", items: { type: "number" }, description: "[최소, 최대] 표본크기" }, effect_sizes: { type: "array", items: { type: "number" }, description: "효과크기 배열" }, alpha: { type: "number", description: "유의수준" }, }, required: ["test_type", "n_range", "effect_sizes"], },
  • Tool definition object in the exported tools array, registering 'power_curve' with its name, description, and input schema.
    name: "power_curve", description: "검정력 곡선 데이터 생성 (시각화용)", inputSchema: { type: "object", properties: { test_type: { type: "string", description: "검정 유형" }, n_range: { type: "array", items: { type: "number" }, description: "[최소, 최대] 표본크기" }, effect_sizes: { type: "array", items: { type: "number" }, description: "효과크기 배열" }, alpha: { type: "number", description: "유의수준" }, }, required: ["test_type", "n_range", "effect_sizes"], }, },
  • Switch case in handleToolCall function that maps the 'power_curve' tool call to its handler function.
    case "power_curve": return handlePowerCurve(args);
  • Helper function to compute statistical power for a two-sample t-test, used by the power_curve handler to generate curve data points.
    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); }

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