mde_calculator
Calculate Minimum Detectable Effect size for A/B tests and experiments using sample size, baseline, significance level, and power.
Instructions
최소탐지효과크기(MDE) 계산 - A/B 테스트, 실험설계
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| n_per_group | Yes | 그룹당 표본크기 | |
| baseline | Yes | 기준값 (비율 또는 평균) | |
| alpha | No | 유의수준 | |
| power | No | 검정력 | |
| test_type | No | 검정 유형 |
Implementation Reference
- src/tools/index.ts:1255-1282 (handler)Implements the core logic for mde_calculator tool: calculates Minimum Detectable Effect (MDE) for proportion or mean tests using standard normal approximations for alpha=0.05 and power=0.80.function handleMdeCalculator(args: Record<string, unknown>) { const nPerGroup = args.n_per_group as number; const baseline = args.baseline as number; const alpha = (args.alpha as number) || 0.05; const power = (args.power as number) || 0.80; const testType = (args.test_type as string) || "proportion"; const zAlpha = 1.96; const zBeta = 0.84; let mde: number; if (testType === "proportion") { const se = Math.sqrt(2 * baseline * (1 - baseline) / nPerGroup); mde = (zAlpha + zBeta) * se; } else { mde = (zAlpha + zBeta) / Math.sqrt(nPerGroup / 2); } return { n_per_group: nPerGroup, baseline, alpha, power, mde: mde.toFixed(4), mde_percentage: (mde / baseline * 100).toFixed(2) + "%", interpretation: `현재 표본으로 baseline 대비 ${(mde / baseline * 100).toFixed(1)}% 차이 탐지 가능` }; }
- src/tools/index.ts:157-170 (schema)Defines the input schema and metadata for the mde_calculator tool, including parameters for sample size per group, baseline value, significance level, power, and test type.{ name: "mde_calculator", description: "최소탐지효과크기(MDE) 계산 - A/B 테스트, 실험설계", inputSchema: { type: "object", properties: { n_per_group: { type: "number", description: "그룹당 표본크기" }, baseline: { type: "number", description: "기준값 (비율 또는 평균)" }, alpha: { type: "number", description: "유의수준" }, power: { type: "number", description: "검정력" }, test_type: { type: "string", enum: ["proportion", "mean"], description: "검정 유형" }, }, required: ["n_per_group", "baseline"], },
- src/tools/index.ts:9-170 (registration)Registers the mde_calculator tool in the exported tools array used by the MCP server.export const tools: Tool[] = [ // === CATEGORY 1: Knowledge Search (5 tools) === { name: "search_stats_knowledge", description: "통계/계량경제학 지식베이스 RAG 검색. 방법론, 가정, 해석 가이드 제공", inputSchema: { type: "object", properties: { query: { type: "string", description: "검색 쿼리" }, category: { type: "string", enum: ["foundations", "regression", "econometrics", "advanced", "meta", "all"], description: "검색 카테고리" }, n_results: { type: "number", description: "결과 수 (기본: 5)" }, }, required: ["query"], }, }, { name: "get_method_guide", description: "특정 통계 방법의 상세 가이드 (가정, 절차, 해석, 보고)", inputSchema: { type: "object", properties: { method: { type: "string", description: "방법론 (예: ols, panel_fe, did, sem, meta)" }, aspect: { type: "string", enum: ["assumptions", "procedure", "interpretation", "reporting", "all"], description: "가이드 측면" }, }, required: ["method"], }, }, { name: "suggest_method", description: "연구질문과 데이터 특성에 맞는 통계 방법 추천", inputSchema: { type: "object", properties: { research_question: { type: "string", description: "연구 질문" }, dv_type: { type: "string", enum: ["continuous", "binary", "ordinal", "count", "time_to_event", "proportion"], description: "종속변수 유형" }, data_structure: { type: "string", enum: ["cross_sectional", "panel", "time_series", "clustered", "multilevel"], description: "데이터 구조" }, causal_design: { type: "string", enum: ["none", "experimental", "quasi_experimental", "observational"], description: "인과추론 설계" }, }, required: ["research_question", "dv_type"], }, }, { name: "compare_methods", description: "여러 통계 방법 비교 (장단점, 적용조건)", inputSchema: { type: "object", properties: { methods: { type: "array", items: { type: "string" }, description: "비교할 방법들" }, criteria: { type: "array", items: { type: "string" }, description: "비교 기준 (예: assumptions, efficiency, robustness)" }, }, required: ["methods"], }, }, { name: "get_formula", description: "통계 수식 및 LaTeX 표기법 제공", inputSchema: { type: "object", properties: { concept: { type: "string", description: "개념 (예: ols_estimator, did_att, hausman_test)" }, format: { type: "string", enum: ["latex", "text", "both"], description: "출력 형식" }, }, required: ["concept"], }, }, // === CATEGORY 2: Sample Size & Power (5 tools) === { 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"], }, }, { 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"], }, }, { name: "calc_effect_size", description: "효과크기 계산 및 해석 (Cohen's d, η², f², OR, RR)", inputSchema: { type: "object", properties: { type: { type: "string", enum: ["cohens_d", "eta_squared", "f_squared", "odds_ratio", "correlation"], description: "효과크기 유형" }, values: { type: "object", description: "계산에 필요한 값들" }, }, required: ["type", "values"], }, }, { name: "mde_calculator", description: "최소탐지효과크기(MDE) 계산 - A/B 테스트, 실험설계", inputSchema: { type: "object", properties: { n_per_group: { type: "number", description: "그룹당 표본크기" }, baseline: { type: "number", description: "기준값 (비율 또는 평균)" }, alpha: { type: "number", description: "유의수준" }, power: { type: "number", description: "검정력" }, test_type: { type: "string", enum: ["proportion", "mean"], description: "검정 유형" }, }, required: ["n_per_group", "baseline"], },
- src/tools/index.ts:800-801 (registration)Registers the handler function in the main tool dispatcher switch statement.case "mde_calculator": return handleMdeCalculator(args);