Thursday, May 29, 2014

F-Test in 6 Steps in Excel 2010 and Excel 2013

This is one of the following three articles on F Tests in Excel in Excel

F-Test in 6 Steps in Excel 2010 and Excel 2013

Normality Testing For F Test In Excel 2010 and Excel 2013

Levene’s and Brown- Forsythe Tests: F-Test Alternatives in Excel

 

F-Test in 6 Steps in Excel

2010 and Excel 2013

The variances of two normally-distributed populations can be compared for equality using the F-Test. The F-Test is a two-sample, two-tailed population variance test. This is a hypothesis test with a Null Hypothesis stating that the variances of both populations are the same. The Null Hypothesis is shown as follows:

H0: σ1 = σ2 = σ

Note that population variance = σ2

The F Test is always performed as a one-tailed test in the right tail with the Alternative Hypothesis constructed as follows:

H0: σ1 > σ2

The F Test is performed as a one-tailed test in the right tail because the sample with the larger standard deviation of the two samples is designated as sample 1. The population from which that sample was taken is designated as population 1. The two parameters associated with sample 1 and population 1 are s1 (sample 1 standard deviation) and σ1 (population 1 standard deviation).

The F distribution describes the distribution of the F statistic, also called the f value. An F statistic can be calculated if two independent random samples are taken from two normally-distributed populations. The following parameters associated with the two samples and populations that must be determined are the following:

n1 = size of sample 1

n2 = size of sample 2

df1 = degrees of freedom 1 = n1 – 1

df2 = degrees of freedom 2 = n2 - 1

s1 = standard deviation of sample 1

σ1 = standard deviation of population 1

Χ21 = Chi-Square statistic from population 1 = df1 * s12 / σ12

s2 = standard deviation of sample 2

σ2 = standard deviation of population 2

Χ22 = Chi-Square statistic from population 2 = df2 * s22 / σ22

The F statistic can then be calculated in any of the following four equivalent ways:

f = [ s1212 ] / [ s2222 ]

f = [ s12 * σ22 ] / [ s22 * σ12 ]

f = [ Χ21 / df1 ] / [ Χ22 / df2 ]

f = [ Χ21 * df2 ] / [ Χ22 * df1 ]

The numerator of the F statistic should be the parameters associated with the larger s.

The distribution of all possible values of the f statistic is called the F distribution, with v1 and v2 degrees of freedom.

Since the F distribution has the chi-square distribution as a component, many of the chi-square distribution properties are also properties of the F distribution such as the following:

1) The distribution is non-symmetric.

2) The mean is approximately 1.

3) The F-values are all non-negative.

4) There are two independent degrees of freedom, one for the numerator, and one for the denominator.

5) Each different F distribution has a unique pair of degrees of freedom.

The F Test is a hypothesis test determines if the variances of two normally-distributed populations are significantly different based upon the standard deviations of samples taken from each population.

The F Test is performed by comparing the calculated F statistic to an F Critical Value, Fα(df1,df2). Alpha, α, is the specified level of significance for the hypothesis test. The Null Hypothesis that the two variances are the same is rejected if the F statistic is greater than F Critical. Equivalently, the Null Hypothesis is also rejected of the p Value (the area in the right tail of the F distribution curve that is beyond the F statistic) is smaller than alpha.

It should be noted that the F Test is extremely sensitive to non-normality. It is very important to verify normality of both samples or both populations prior to performing an F Test.

F Test Example in Excel

Determine with 95 percent certainty whether the variances of battery lifetime of Brand A and brand B are significantly different from each other.

f test,f-test,statistics,excel,excel 2010,excel 2013,f statistic,variance
(Click On Image To See Larger Version)

 

F Test Step 1 – Run Descriptive Statistics on the Data Samples

Descriptive statistics run on the above data samples produces the following result:

f test,f-test,statistics,excel,excel 2010,excel 2013,f statistic,variance (Click On Image To See Larger Version)

Example Data

s12 = 286.13 (This sample is designated sample 1 because its variance is larger)

s22 = 232.39

n1 = 16

n2 = 17

df1 = n1 – 1 = 15

df2 = n2 – 1 = 16

 

F Test Step 2 – Verify Normality of Both Populations

The F Test is extremely sensitive to non-normality and will produce an incorrect result if either population is not normally distributed. It is therefore very important to verify the normality of both populations prior to performing the F Test.

If the normality of both populations cannot be confirmed, the normality of both samples must be confirmed. Large sample size (n > 30) does not waive the normality requirement as occurs with t Tests.

An Excel histogram is the quickest way to attain a rough assessment of the normality of a data sample. Histograms of both data samples are shown as follows. The histogram indicates that the sample data is normally distributed. The normal distribution of the sample data infers that the populations from which the sample came are also normally distributed as required by the F Test.

An in-depth analysis of the normality of the sample data will be performed at the end of this section. For brevity, this F Test’s requirement of population normality will be considered satisfied by the following bell-shaped Excel histograms of the data from each of the two samples. Excel histograms of both sample groups are as follows:

f test,f-test,statistics,excel,excel 2010,excel 2013,f statistic,variance (Click On Image To See Larger Version)

To create this histogram in Excel, fill in the Excel Histogram dialogue box as follows:

f test,f-test,statistics,excel,excel 2010,excel 2013,f statistic,variance (Click On Image To See Larger Version)

f test,f-test,statistics,excel,excel 2010,excel 2013,f statistic,variance (Click On Image To See Larger Version)

To create this histogram in Excel, fill in the Excel Histogram dialogue box as follows:

f test,f-test,statistics,excel,excel 2010,excel 2013,f statistic,variance (Click On Image To See Larger Version)

Both sample groups appear to be distributed reasonably closely to the bell-shaped normal distribution. It should be noted that bin size in an Excel histogram is manually set by the user. This arbitrary setting of the bin sizes can has a significant influence on the shape of the histogram’s output. Different bin sizes could result in an output that would not appear bell-shaped at all. What is actually set by the user in an Excel histogram is the upper boundary of each bin.

 

In-Depth Analysis of Sample Normality

The F Test is extremely sensitive to non-normality of either population from which the samples were taken. A population’s normality is confirmed when a sample taken from that population is shown to be normally distributed. The preceding F test was performed on the basis of bell-shaped histograms of each of the two samples’ data. Other methods of confirming sample normality are listed as follows:

 

Evaluating the Normality of the Sample Data

The following five normality tests will be performed on the sample data in a blog article following this one:

An Excel histogram of the sample data will be created.

A normal probability plot of the sample data will be created in Excel.

The Kolmogorov-Smirnov test for normality of the sample data will be performed in Excel.

The Anderson-Darling test for normality of the sample data will be performed in Excel.

The Shapiro-Wilk test for normality of the sample data will be performed in Excel.

All of these normality tests listed above are performed in Excel in the next article in this blog.

Having confirmed the F Test’s requirement of normality of both populations, the F Test can be conducted as follows:

 

F Test Step 3 – Create the Null and Alternative Hypotheses

H0: σ1 = σ2

H1: σ1 > σ2 – indicates that this is a one-tailed test in the right tail

 

F Test Step 4 – Calculate the F Statistic

f = [ s1212 ] / [ s2222 ]

s1 is larger than s2 and should therefore go in the numerator. Since the Null Hypothesis states that the population variances, σ1 and σ2, are equal, the F statistic can be reduced to the following:

F Statistic = f = s12 / s22

f = 286.13 / 232.39 = 1.226

 

F Test Step 5 – Calculate F Critical

F Critical = Fα(df1, df2) = Fα=0.05(df1 = 15, df2 = 16)

F Critical = Fα(df1, df2) = F.INV.RT(α, df1, df2) = F.INV.RT(0.05,15,16) = 2.352

 

F Test Step 6 – Compare the F Statistic to F Critical

F Statistic (f = 1.226) is smaller than F Critical (2.352) so the Null Hypothesis is not rejected. There is not sufficient evidence at α = 0.05 to state that the variances of the two populations (the battery lifetimes of brand A and brand B) are significantly different.

Equivalently, the p value can be compared to alpha as follows:

p Value = F.DIST.RT(F statistic, df1, df2) = F.DIST.RT(1.226,15,16) = 0.345

The p Value (0.345) is larger than alpha (0.05) so the Null Hypothesis is not rejected.

This result shown on this Excel-generated graph of the F distribution with df1=15 and df2=16 is as follows:

f test,f-test,statistics,excel,excel 2010,excel 2013,f statistic,variance (Click On Image To See Larger Version)

The Null Hypothesis of an F Test states that the variances of the two groups are the same. The p Value shown in the Excel F Test output equals 0.345. This is much larger than the Alpha (0.05) that is typically used for an F Test so the Null Hypothesis cannot be rejected. A p value of 0.345 indicates that there is a 34.5 percent probability of a Type I error, i.e. a false positive. This means that there is a 34.5 percent probability that the difference in the variances shown by the test do not exist and are merely the chance result of random sampling from each population.

The p value needs to be no larger than 0.05 to be at least 95 percent certain that the test’s indication of a difference between the population variances is a true result. A p Value of 0.345 indicates that only 65.5 percent certainty exists that the a difference between the population variances really exists.

 

Performing the F Test With the Data Analysis F Test Tool

The F Test can be performed in one step by using the Excel Data Analysis F Test tool. this tool can be accessed under the Data tab as follows:

Data tab / Data Analysis / F Test Two Sample for Variances

The F Test dialogue box then appears and should be completed as follows:

f test,f-test,statistics,excel,excel 2010,excel 2013,f statistic,variance (Click On Image To See Larger Version)

Hitting the OK button will produce the following output. Directly below the output are the calculations that duplicate the output created by this tool.

f test,f-test,statistics,excel,excel 2010,excel 2013,f statistic,variance (Click On Image To See Larger Version)

 

F Test Alternatives That Are Less Sensitive To Data Non-Normality Than the F Test

The F Test is extremely sensitive to non-normality of data.  In many cases it is better to apply variance-comparison tests that are less sensitive to non-normality than the F Test. The two most widely-used tests to compare sample group variance are Levene’s Test and the Brown-Forsythe sample variance test. Levene’s Test and the Brown-Forsythe sample variance test will be performed on this sample data in an article that is two articles later in this blog. 

 

Excel Master Series Blog Directory

Statistical Topics and Articles In Each Topic

 

No comments:

Post a Comment