Overview
This formula performs a two-sample F Test using F distribution, and is used to see if the samples have different variances.
Applying the Formula
All statistical formulas are calculated using the Statistics class, and the following table describes how to use its FTest method to perform an F Test.
|
Value/Description |
Example |
Formula Name: |
F Test |
Statistics.FTest (0.05,"Series1","Series2"). |
Parameters: |
- probability: the alpha value (probability).
- firstInputSeriesName: The name of the Series object that stores the first group of data.
- secondInputSeriesName: The name of the Series object that stores the second group of data.
|
Statistics.FTest(0.05,"Series1","Series2") |
Return: |
An FTestResult object, which has the following members:
- FirstSeriesMean
- SecondSeriesMean
- FirstSeriesVariance
- SecondSeriesVariance
- FValue
- ProbabilityFOneTail
- FCriticalValueOneTail
|
- |
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
The F test is used to compare the variances of two populations of data: , where is the variance of the first group and is the variance of the second group.
Calculation
- Calculate and .
- Calculate the F statistic: .
- Use the F Inverse distribution function to test the hypothesis.
Example
This example demonstrates how to perform an F Test, using Series1 and Series2 for the input series.
Visual Basic |
Copy Code |
Imports Dundas.Charting.WinControl
...
' Perform the F test.
Dim result As FTestResult = Chart1.DataManipulator.Statistics.FTest(0.05,"Series1","Series2")
|
C# |
Copy Code |
using Dundas.Charting.WinControl;
...
// Perform the F test.
FTestResult result = Chart1.DataManipulator.Statistics.FTest(0.05,"Series1","Series2");
|
Example
This example demonstrates how to perform an F Test, using Series1 and Series2 for the input series. The results are returned in an FTestResult 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 FTestResult object (right). |
Visual Basic |
Copy Code |
Imports Dundas.Charting.WinControl
...
' Perform the F test.
Dim result As FTestResult = chart1.DataManipulator.Statistics.FTest(0.05,"Series1","Series2")
' Add Title to second chart.
chart2.Titles.Add("FTestResult Object at 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
' Add All AnovaResult data to the title collection using the ToString() method.
chart2.Titles.Add("F Critical Value One Tail: " + ftestresult.FCriticalValueOneTail.ToString())
chart2.Titles.Add("First Series Mean: " + ftestresult.FirstSeriesMean.ToString())
chart2.Titles.Add("First Series Variance: " + ftestresult.FirstSeriesVariance.ToString())
chart2.Titles.Add("F Value: " + ftestresult.FValue.ToString())
chart2.Titles.Add("Probability F One Tail: " + ftestresult.ProbabilityFOneTail.ToString())
chart2.Titles.Add("Second Series Mean: " + ftestresult.SecondSeriesMean.ToString())
chart2.Titles.Add("Second Series Variance: " + ftestresult.SecondSeriesVariance.ToString())
|
C# |
Copy Code |
using Dundas.Charting.WinControl;
...
// Perform the F test.
FTestResult result = Chart1.DataManipulator.Statistics.FTest(0.05,"Series1","Series2");
// Add Title to second chart.
chart2.Titles.Add("FTestResult Object at 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;
// Add All AnovaResult data to the title collection using the ToString() method.
chart2.Titles.Add("F Critical Value One Tail: " + ftestresult.FCriticalValueOneTail.ToString());
chart2.Titles.Add("First Series Mean: " + ftestresult.FirstSeriesMean.ToString());
chart2.Titles.Add("First Series Variance: " + ftestresult.FirstSeriesVariance.ToString());
chart2.Titles.Add("F Value: " + ftestresult.FValue.ToString());
chart2.Titles.Add("Probability F One Tail: " + ftestresult.ProbabilityFOneTail.ToString());
chart2.Titles.Add("Second Series Mean: " + ftestresult.SecondSeriesMean.ToString());
chart2.Titles.Add("Second Series Variance: " + ftestresult.SecondSeriesVariance.ToString());
|
See Also