모든 종류의 t-검정을 수행하세요: 단일 표본, 두 표본 및 쌍체 t-검정. 이 계산기를 사용하면 평균에 대한 통계적 가설 검정을 수행할 수 있으며, 데이터 분석 및 결과 해석에 도움을 줍니다.
t-검정은 그룹의 평균 간에 유의미한 차이가 있는지를 결정하는 데 사용되는 기본적인 통계 도구입니다. 이는 심리학, 의학, 비즈니스 등 다양한 분야에서 가설 검정에 널리 적용됩니다. 이 계산기를 사용하면 모든 종류의 t-검정을 수행할 수 있습니다:
t-검정 유형 선택:
필요한 입력값 입력:
단일 샘플 t-검정의 경우:
두 샘플 t-검정의 경우:
쌍체 t-검정의 경우:
유의 수준 () 설정:
검정 방향 선택:
"계산" 버튼 클릭:
계산기는 다음을 표시합니다:
t-검정을 사용하기 전에 다음 가정이 충족되는지 확인하십시오:
t-통계량은 다음과 같이 계산됩니다:
풀린 표준 편차 ():
계산기는 다음 단계를 수행합니다:
t-검정은 강력하지만 항상 충족되지 않을 수 있는 가정이 있습니다. 대안으로는 다음이 있습니다:
t-검정은 William Sealy Gosset이 1908년에 개발하였으며, 그는 더블린의 기네스 양조장에서 일하면서 **"Student"**라는 필명으로 발표하였습니다. 이 검정은 샘플 배치가 양조장의 기준과 일치하는지 확인하기 위해 설계되었습니다. 비밀 유지 계약 때문에 Gosset은 "Student"라는 필명을 사용하게 되었고, 이로 인해 **"Student's t-test"**라는 용어가 생겨났습니다.
시간이 지나면서 t-검정은 통계 분석의 초석이 되었으며, 다양한 과학 분야에서 널리 교육되고 적용되고 있습니다. 이는 더 복잡한 통계 방법의 발전을 위한 기초를 마련하였으며, 추론 통계 분야에서 기본적인 역할을 합니다.
다음은 다양한 프로그래밍 언어에서 단일 샘플 t-검정을 수행하는 코드 예제입니다:
1' Excel VBA에서 단일 샘플 t-검정
2Sub OneSampleTTest()
3 Dim sampleData As Range
4 Set sampleData = Range("A1:A9") ' 데이터 범위로 교체
5 Dim hypothesizedMean As Double
6 hypothesizedMean = 50 ' 가설 평균으로 교체
7
8 Dim sampleMean As Double
9 Dim sampleStdDev As Double
10 Dim sampleSize As Integer
11 Dim tStat As Double
12
13 sampleMean = Application.WorksheetFunction.Average(sampleData)
14 sampleStdDev = Application.WorksheetFunction.StDev_S(sampleData)
15 sampleSize = sampleData.Count
16
17 tStat = (sampleMean - hypothesizedMean) / (sampleStdDev / Sqr(sampleSize))
18
19 MsgBox "t-통계량: " & Format(tStat, "0.00")
20End Sub
21
1## R에서 단일 샘플 t-검정
2sample_data <- c(51, 49, 52, 48, 50, 47, 53, 49, 51)
3t_test_result <- t.test(sample_data, mu = 50)
4print(t_test_result)
5
1import numpy as np
2from scipy import stats
3
4## Python에서 단일 샘플 t-검정
5sample_data = [51, 49, 52, 48, 50, 47, 53, 49, 51]
6t_statistic, p_value = stats.ttest_1samp(sample_data, 50)
7print(f"t-통계량: {t_statistic:.2f}, p-값: {p_value:.4f}")
8
1// JavaScript에서 단일 샘플 t-검정
2function oneSampleTTest(sample, mu0) {
3 const n = sample.length;
4 const mean = sample.reduce((a, b) => a + b) / n;
5 const sd = Math.sqrt(sample.map(x => (x - mean) ** 2).reduce((a, b) => a + b) / (n - 1));
6 const t = (mean - mu0) / (sd / Math.sqrt(n));
7 return t;
8}
9
10// 사용 예시:
11const sampleData = [51, 49, 52, 48, 50, 47, 53, 49, 51];
12const tStatistic = oneSampleTTest(sampleData, 50);
13console.log(`t-통계량: ${tStatistic.toFixed(2)}`);
14
1% MATLAB에서 단일 샘플 t-검정
2sampleData = [51, 49, 52, 48, 50, 47, 53, 49, 51];
3[h, p, ci, stats] = ttest(sampleData, 50);
4disp(['t-통계량: ', num2str(stats.tstat)]);
5disp(['p-값: ', num2str(p)]);
6
1import org.apache.commons.math3.stat.inference.TTest;
2
3public class OneSampleTTest {
4 public static void main(String[] args) {
5 double[] sampleData = {51, 49, 52, 48, 50, 47, 53, 49, 51};
6 TTest tTest = new TTest();
7 double mu = 50;
8 double tStatistic = tTest.t(mu, sampleData);
9 double pValue = tTest.tTest(mu, sampleData);
10 System.out.printf("t-통계량: %.2f%n", tStatistic);
11 System.out.printf("p-값: %.4f%n", pValue);
12 }
13}
14
1using System;
2using MathNet.Numerics.Statistics;
3
4class OneSampleTTest
5{
6 static void Main()
7 {
8 double[] sampleData = {51, 49, 52, 48, 50, 47, 53, 49, 51};
9 double mu0 = 50;
10 int n = sampleData.Length;
11 double mean = Statistics.Mean(sampleData);
12 double stdDev = Statistics.StandardDeviation(sampleData);
13 double tStatistic = (mean - mu0) / (stdDev / Math.Sqrt(n));
14 Console.WriteLine($"t-통계량: {tStatistic:F2}");
15 }
16}
17
1package main
2
3import (
4 "fmt"
5 "math"
6)
7
8func oneSampleTTest(sample []float64, mu0 float64) float64 {
9 n := float64(len(sample))
10 var sum, mean, sd float64
11
12 for _, v := range sample {
13 sum += v
14 }
15 mean = sum / n
16
17 for _, v := range sample {
18 sd += math.Pow(v - mean, 2)
19 }
20 sd = math.Sqrt(sd / (n - 1))
21
22 t := (mean - mu0) / (sd / math.Sqrt(n))
23 return t
24}
25
26func main() {
27 sampleData := []float64{51, 49, 52, 48, 50, 47, 53, 49, 51}
28 tStatistic := oneSampleTTest(sampleData, 50)
29 fmt.Printf("t-통계량: %.2f\n", tStatistic)
30}
31
1import Foundation
2
3func oneSampleTTest(sample: [Double], mu0: Double) -> Double {
4 let n = Double(sample.count)
5 let mean = sample.reduce(0, +) / n
6 let sd = sqrt(sample.map { pow($0 - mean, 2) }.reduce(0, +) / (n - 1))
7 let t = (mean - mu0) / (sd / sqrt(n))
8 return t
9}
10
11let sampleData = [51, 49, 52, 48, 50, 47, 53, 49, 51]
12let tStatistic = oneSampleTTest(sample: sampleData, mu0: 50)
13print(String(format: "t-통계량: %.2f", tStatistic))
14
1<?php
2function oneSampleTTest($sample, $mu0) {
3 $n = count($sample);
4 $mean = array_sum($sample) / $n;
5 $sd = sqrt(array_sum(array_map(function($x) use ($mean) {
6 return pow($x - $mean, 2);
7 }, $sample)) / ($n - 1));
8 $t = ($mean - $mu0) / ($sd / sqrt($n));
9 return $t;
10}
11
12$sampleData = [51, 49, 52, 48, 50, 47, 53, 49, 51];
13$tStatistic = oneSampleTTest($sampleData, 50);
14echo "t-통계량: " . number_format($tStatistic, 2);
15?>
16
1## Ruby에서 단일 샘플 t-검정
2def one_sample_t_test(sample, mu0)
3 n = sample.size
4 mean = sample.sum(0.0) / n
5 sd = Math.sqrt(sample.map { |x| (x - mean)**2 }.sum / (n - 1))
6 t = (mean - mu0) / (sd / Math.sqrt(n))
7 t
8end
9
10sample_data = [51, 49, 52, 48, 50, 47, 53, 49, 51]
11t_statistic = one_sample_t_test(sample_data, 50)
12puts format("t-통계량: %.2f", t_statistic)
13
1// Rust에서 단일 샘플 t-검정
2fn one_sample_t_test(sample: &Vec<f64>, mu0: f64) -> f64 {
3 let n = sample.len() as f64;
4 let mean: f64 = sample.iter().sum::<f64>() / n;
5 let sd = (sample.iter().map(|x| (x - mean).powi(2)).sum::<f64>() / (n - 1.0)).sqrt();
6 let t = (mean - mu0) / (sd / n.sqrt());
7 t
8}
9
10fn main() {
11 let sample_data = vec![51.0, 49.0, 52.0, 48.0, 50.0, 47.0, 53.0, 49.0, 51.0];
12 let t_statistic = one_sample_t_test(&sample_data, 50.0);
13 println!("t-통계량: {:.2}", t_statistic);
14}
15
문제: 한 제조업체가 배터리의 평균 수명이 50시간이라고 주장합니다. 소비자 그룹이 9개의 배터리를 테스트하고 다음과 같은 수명을 기록했습니다 (시간 단위):
평균 배터리 수명이 50시간과 다르다는 증거가 0.05 유의 수준에서 존재합니까?
해결:
가설 설정:
샘플 평균 () 계산:
샘플 표준 편차 () 계산:
t-통계량 계산:
자유도 결정:
p-값 결정:
결론:
귀하의 워크플로에 유용할 수 있는 더 많은 도구를 발견하세요.