டி-சோதனை கணக்கீட்டாளர்: புள்ளியியல் சோதனை கருவி
ஒன்றுக்கு மாதிரி, இரண்டு மாதிரி மற்றும் இணைக்கப்பட்ட டி-சோதனைகளை செய்யவும். இந்த கணக்கீட்டாளர், தரவுப் பகுப்பாய்வு மற்றும் முடிவுகளை விளக்குவதற்கான உதவியாக, சராசரி மதிப்புகளுக்கான புள்ளியியல் உத்திகள் சோதனை செய்ய அனுமதிக்கிறது.
டி-சோதனை கணக்கீட்டாளர்
ஆவணங்கள்
T-Test Calculator
Introduction
The t-test is a fundamental statistical tool used to determine if there is a significant difference between the means of groups. It is widely applied in various fields such as psychology, medicine, and business for hypothesis testing. This calculator allows you to perform all kinds of t-tests:
- One-Sample T-Test: Tests if the mean of a single group differs from a known value.
- Two-Sample T-Test (Independent Samples): Compares the means of two independent groups.
- Paired T-Test: Compares means from the same group at different times (e.g., before and after treatment).
Types of T-Tests
How to Use This Calculator
-
Select the Type of T-Test:
- One-Sample T-Test
- Two-Sample T-Test
- Paired T-Test
-
Enter the Required Inputs:
-
For One-Sample T-Test:
- Sample Mean ()
- Sample Standard Deviation ()
- Sample Size ()
- Population Mean ()
-
For Two-Sample T-Test:
- Mean of Sample 1 ()
- Standard Deviation of Sample 1 ()
- Sample Size of Sample 1 ()
- Mean of Sample 2 ()
- Standard Deviation of Sample 2 ()
- Sample Size of Sample 2 ()
- Variance Assumption: Select whether variances are assumed equal or unequal.
-
For Paired T-Test:
- Differences Data: Enter the pairwise differences.
- Alternatively, enter the Mean of Differences (), Standard Deviation of Differences (), and Sample Size ().
-
-
Set the Significance Level ():
- Common choices are 0.05 for a 95% confidence level or 0.01 for a 99% confidence level.
-
Choose the Test Direction:
- Two-Tailed Test: Tests for any difference.
- One-Tailed Test: Tests for a directional difference (specify if testing for greater than or less than).
-
Click the "Calculate" Button:
-
The calculator will display:
- T-Statistic
- Degrees of Freedom
- P-Value
- Conclusion: Whether to reject or fail to reject the null hypothesis.
-
Assumptions
Before using the t-test, ensure that the following assumptions are met:
- Normality: The data should be approximately normally distributed.
- Independence: Observations must be independent of each other.
- For Two-Sample T-Test, the two groups should be independent.
- For Paired T-Test, the differences should be independent.
- Equality of Variances:
- For Two-Sample T-Test with Equal Variances, the variances of the two populations should be equal (homoscedasticity).
- If this assumption is not met, use the Welch's T-Test (unequal variances).
Formula
One-Sample T-Test
The t-statistic is calculated as:
- : Sample mean
- : Population mean under the null hypothesis
- : Sample standard deviation
- : Sample size
Two-Sample T-Test (Independent Samples)
Equal Variances Assumed
Pooled standard deviation ():
Unequal Variances (Welch's T-Test)
Paired T-Test
- : Mean of the differences
- : Standard deviation of the differences
- : Number of pairs
Degrees of Freedom
One-Sample and Paired T-Test:
Two-Sample T-Test with Equal Variances:
Welch's T-Test:
Calculation
The calculator performs the following steps:
- Compute the T-Statistic using the appropriate formula based on the selected test.
- Determine the Degrees of Freedom (df).
- Calculate the P-Value corresponding to the t-statistic and df:
- Uses the t-distribution to find the probability.
- Compare the P-Value with the Significance Level ():
- If , reject the null hypothesis.
- If , fail to reject the null hypothesis.
- Interpret the Results:
- Provide a conclusion in the context of the test.
Use Cases
One-Sample T-Test
- Testing New Drug Efficacy:
- Determine if the average recovery time with a new drug differs from the known average recovery time.
- Quality Control:
- Check if the average length of manufactured parts deviates from the specified standard.
Two-Sample T-Test
- A/B Testing in Marketing:
- Compare conversion rates between two different web page designs.
- Educational Research:
- Assess if there is a difference in test scores between two teaching methods.
Paired T-Test
- Before and After Studies:
- Evaluate weight loss before and after a diet program.
- Matched Subjects:
- Compare blood pressure measurements before and after administering medication to the same subjects.
Alternatives
While t-tests are powerful, they have assumptions that might not always be met. Alternatives include:
- Mann-Whitney U Test:
- Non-parametric alternative to the two-sample t-test when data doesn't follow a normal distribution.
- Wilcoxon Signed-Rank Test:
- Non-parametric equivalent to the paired t-test.
- ANOVA (Analysis of Variance):
- Used when comparing means across more than two groups.
History
The t-test was developed by William Sealy Gosset in 1908, who published under the pseudonym "Student" while working at the Guinness Brewery in Dublin. The test was designed to monitor the quality of stout by determining if sample batches were consistent with the brewery's standards. Due to confidentiality agreements, Gosset used the pseudonym "Student," leading to the term "Student's t-test."
Over time, the t-test has become a cornerstone in statistical analysis, widely taught and applied in various scientific disciplines. It paved the way for the development of more complex statistical methods and is fundamental in the field of inferential statistics.
Examples
Here are code examples for performing a One-Sample T-Test in various programming languages:
Excel
1' One-Sample T-Test in Excel VBA
2Sub OneSampleTTest()
3 Dim sampleData As Range
4 Set sampleData = Range("A1:A9") ' Replace with your data range
5 Dim hypothesizedMean As Double
6 hypothesizedMean = 50 ' Replace with your hypothesized mean
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-Statistic: " & Format(tStat, "0.00")
20End Sub
21
R
1## One-Sample T-Test in R
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
Python
1import numpy as np
2from scipy import stats
3
4## One-Sample T-Test in Python
5sample_data = [51, 49, 52, 48, 50, 47, 53, 49, 51]
6t_statistic, p_value = stats.ttest_1samp(sample_data, 50)
7print(f"T-Statistic: {t_statistic:.2f}, P-Value: {p_value:.4f}")
8
JavaScript
1// One-Sample T-Test in JavaScript
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// Example usage:
11const sampleData = [51, 49, 52, 48, 50, 47, 53, 49, 51];
12const tStatistic = oneSampleTTest(sampleData, 50);
13console.log(`T-Statistic: ${tStatistic.toFixed(2)}`);
14
MATLAB
1% One-Sample T-Test in MATLAB
2sampleData = [51, 49, 52, 48, 50, 47, 53, 49, 51];
3[h, p, ci, stats] = ttest(sampleData, 50);
4disp(['T-Statistic: ', num2str(stats.tstat)]);
5disp(['P-Value: ', num2str(p)]);
6
Java
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-Statistic: %.2f%n", tStatistic);
11 System.out.printf("P-Value: %.4f%n", pValue);
12 }
13}
14
C#
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-Statistic: {tStatistic:F2}");
15 }
16}
17
Go
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-Statistic: %.2f\n", tStatistic)
30}
31
Swift
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-Statistic: %.2f", tStatistic))
14
PHP
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-Statistic: " . number_format($tStatistic, 2);
15?>
16
Ruby
1## One-Sample T-Test in Ruby
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-Statistic: %.2f", t_statistic)
13
Rust
1// One-Sample T-Test in Rust
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-Statistic: {:.2}", t_statistic);
14}
15
Numerical Example
Problem: A manufacturer claims that the average life of a battery is 50 hours. A consumer group tests 9 batteries and records the following lifespans (in hours):
Is there evidence at the 0.05 significance level to suggest that the average battery life differs from 50 hours?
Solution:
-
State the Hypotheses:
- Null Hypothesis ():
- Alternative Hypothesis ():
-
Calculate Sample Mean ():
-
Calculate Sample Standard Deviation ():
-
Calculate T-Statistic:
-
Degrees of Freedom:
-
Determine P-Value:
- For and , the p-value is 1.00.
-
Conclusion:
- Since p-value (1.00) > (0.05), we fail to reject the null hypothesis.
- Interpretation: There is not enough evidence to suggest that the average battery life differs from 50 hours.
References
- Gosset, W. S. (1908). "The Probable Error of a Mean". Biometrika, 6(1), 1–25. JSTOR.
- Student's t-test. Wikipedia. https://en.wikipedia.org/wiki/Student%27s_t-test
- GraphPad Statistics Guide: Understanding t-tests. Link
- Laerd Statistics: Independent t-test. Link
Additional Resources
- Assumption Checks:
- Use the Shapiro-Wilk Test for normality.
- Use Levene's Test for equality of variances.
- Software Tools:
- SPSS, SAS, Stata, and R for advanced statistical analysis.
- Further Reading:
- "Introduction to Statistical Learning" by Gareth James, Daniela Witten, Trevor Hastie, and Robert Tibshirani.
- "Statistical Methods" by George W. Snedecor and William G. Cochran.
பின்னூட்டம்
இந்த கருவி பற்றி பின்னூட்டம் அளிக்க தொடங்க பின்னூட்டத்தை கிளிக் செய்யவும்
சம்பந்தப்பட்ட கருவிகள்
உங்கள் வேலைப்பாட்டுக்கு பயனுள்ளதாக இருக்கக்கூடிய மேலும் கருவிகளை கண்டறியவும்