Dundas Chart for ASP.NET
T Test with Equal Variances Formula
See Also Send comments on this topic.
Formula Reference > Statistical Formulas > T Test with Equal Variances Formula



Glossary Item Box

Overview

Perform a T Test using Students distribution (T distribution) with equal variances.

Applying the Formula

All statistical formulas are calculated using the Statistics class, and the following table describes how to use its  TTestEqualVariances method to perform the t-test.

 

  Value/Description Example
Formula Name: T Test with Equal Variances Statistics.TTestEqualVariances (0.2,0.05,"Series1","Series2")
Parameters:
  1. hypothesizedMeanDifference: the hypothesized difference between the means of the data groups.
  2. probability: the alpha value (probability).
  3. firstInputSeriesName: The name of the Series object that stores the first group of data.
  4. secondInputSeriesName: The name of the Series object that stores the second group of data
Statistics.TTestEqualVariances(0.2, 0.05, "Series1", "Series2")
Return:

TTestResult object, which has the following members:

  • FirstSeriesMean
  • SecondSeriesMean
  • FirstSeriesVariance
  • SecondSeriesVariance
  • TValue
  • DegreeOfFreedom
  • ProbabilityTOneTail
  • TCriticalValueOneTail
  • ProbabilityTTwoTail
  • TCriticalValueTwoTail

-

 

Note
Make sure that all data points have their XValue property set, and that their series'  XValueIndexed property has been set to false.

Statistical Interpretation

Suppose that you have two different populations whose means you want to compare. Assume that the random variables  (mean , variance ) and  (mean , variance ) have approximately normal distributions. For sample sizes of  and , then the sample means  and  are normal random variables.

If we want to test hypotheses about the difference between the population means , our null hypothesis might be that the population means are equal:

 or .

If the population variances  and  are unknown, we will have to use T statistics (if variances are known we use Z Statistics). If the null hypothesis is true, and if we also know that  then   has a t distribution with  degrees of freedom where .

Calculation

  1. Calculate  and .
  2. Calculate the sample variances (version 2, with n-1 in the denominator) for both samples:  and .
  3. Calculate the pooled estimator : .
  4. Calculate the test statistic T: .
  5. If the null hypothesis is true, then T will have a t distribution with  degrees of freedom.

Example

This example demonstrates how to perform a t test with equal variances for two groups of data represented by Series1 and Series2. The results are returned in a TTestResult object.

Visual Basic Copy Code
Imports Dundas.Charting.WebControl
  ...
  
' Perform the test.
Dim result As TTestResult = Chart1.DataManipulator.Statistics.TTestEqualVariances(0.2,0.05,
"Series1","Series2")


C# Copy Code
using Dundas.Charting.WebControl;
  ...
  
// Perform the test.
TTestResult result = Chart1.DataManipulator.Statistics.TTestEqualVariances(0.2,0.05,
"Series1","Series2");


Example

This example demonstrates how to perform a t test with equal variances for two groups of data represented by Series1 and Series2. The results are returned in an TTestResult object. The object values are then added as titles to a separate chart. We assume series data was added at design-time. Further, we assume a "DundasBlue" template was applied for appearance purposes.

 

Figure 1: Two Charts; One containing Series data (left), and the other containing the TTestResult object (right).

 

Visual Basic Copy Code
Imports Dundas.Charting.WebControl
  ...
  
' Perform the test.
ttestresult = chart1.DataManipulator.Statistics.TTestEqualVariances(0.2, 0.05, 
"Series1", "Series2")

' Add Title to second chart.
chart2.Titles.Add("TTestResult Object")
chart2.Titles.Add("Hypothesized Mean Difference: 0.2 | Probability: 5%")

' Change Appearance properties of first title.
chart2.Titles(0).BackColor = Color.FromArgb(255, 65, 140, 240)
chart2.Titles(0).Font = New Font("Trebuchet", 12, FontStyle.Bold)
chart2.Titles(0).Color = Color.White
chart2.Titles(0).Style = TextStyle.Shadow

' Change Appearance properties of second title.
chart2.Titles(1).BackColor = Color.FromArgb(255, 224, 64, 10)
chart2.Titles(1).Font = New Font("Trebuchet", 8, FontStyle.Bold)
chart2.Titles(1).Color = Color.White

chart2.Titles.Add("Degree Of Freedom: " + ttestresult.DegreeOfFreedom.ToString())
chart2.Titles.Add("First Series Mean: " + ttestresult.FirstSeriesMean.ToString() + 
" | Second Series Mean: " + ttestresult.SecondSeriesMean.ToString())
chart2.Titles.Add("First Series Variance: " + ttestresult.FirstSeriesVariance.ToString() + 
" | Second Series Variance: " + ttestresult.SecondSeriesVariance.ToString())
chart2.Titles.Add("Probability T One Tail: " + ttestresult.ProbabilityTOneTail.ToString())
chart2.Titles.Add("Probability T Two Tail: " + ttestresult.ProbabilityTTwoTail.ToString())
chart2.Titles.Add("T Critical Value One Tail: " + ttestresult.TCriticalValueOneTail.ToString())
chart2.Titles.Add("T Critical Value Two Tail: " + ttestresult.TCriticalValueTwoTail.ToString())
chart2.Titles.Add("TValue: " + ttestresult.TValue.ToString())


C# Copy Code
using Dundas.Charting.WebControl;
  ...
  
// Perform the test.
ttestresult = chart1.DataManipulator.Statistics.TTestEqualVariances(0.2, 0.05, 
"Series1", "Series2");

// Add Title to second chart.
chart2.Titles.Add("TTestResult Object");
chart2.Titles.Add("Hypothesized Mean Difference: 0.2 | Probability: 5%");

// Change Appearance properties of first title.
chart2.Titles[0].BackColor = Color.FromArgb(255, 65, 140, 240);
chart2.Titles[0].Font = new Font("Trebuchet", 12, FontStyle.Bold);
chart2.Titles[0].Color = Color.White;
chart2.Titles[0].Style = TextStyle.Shadow;

// Change Appearance properties of second title.
chart2.Titles[1].BackColor = Color.FromArgb(255, 224, 64, 10);
chart2.Titles[1].Font = new Font("Trebuchet", 8, FontStyle.Bold);
chart2.Titles[1].Color = Color.White;
chart11.Titles[1].Style = TextStyle.Shadow;

chart2.Titles.Add("Degree Of Freedom: " + ttestresult.DegreeOfFreedom.ToString());
chart2.Titles.Add("First Series Mean: " + ttestresult.FirstSeriesMean.ToString() + 
" | Second Series Mean: " + ttestresult.SecondSeriesMean.ToString());
chart2.Titles.Add("First Series Variance: " + ttestresult.FirstSeriesVariance.ToString() + 
" | Second Series Variance: " + ttestresult.SecondSeriesVariance.ToString());
chart2.Titles.Add("Probability T One Tail: " + ttestresult.ProbabilityTOneTail.ToString());
chart2.Titles.Add("Probability T Two Tail: " + ttestresult.ProbabilityTTwoTail.ToString());
chart2.Titles.Add("T Critical Value One Tail: " + ttestresult.TCriticalValueOneTail.ToString());
chart2.Titles.Add("T Critical Value Two Tail: " + ttestresult.TCriticalValueTwoTail.ToString());
chart2.Titles.Add("TValue: " + ttestresult.TValue.ToString());


See Also

Formulas
Formulas Overview

Statistical Formulas
Using Statistical Formulas

Copyright © 2001 - 2009 Dundas Data Visualization, Inc. and others.