## Monday, June 2, 2014

### Hypothesis Tests of Proportion Overview (Hypothesis Testing On Binomial Data)

This is one of the following four articles on Hypothesis Tests of Proportion in Excel

Hypothesis Tests of Proportion Overview (Hypothesis Testing On Binomial Data)

1-Sample Hypothesis Test of Proportion in 4 Steps in Excel 2010 and Excel 2013

2-Sample Pooled Hypothesis Test of Proportion in 4 Steps in Excel 2010 and Excel 2013

How To Build a Much More Useful Split-Tester in Excel Than Google's Website Optimizer

# Overview of Hypothesis Testing on Binomial Data

A hypothesis test evaluates whether a sample is different enough from a population to establish that the sample probably did not come from that population. If a sample is different enough from a hypothesized population, then the population from which the sample came is different than the hypothesized population.

## Null Hypothesis

A hypothesis test is based upon a Null Hypothesis which states that the sample did come from a hypothesized population. A hypothesis test compares a sample statistic such as a sample mean or sample proportion to a population parameter such as the population’s mean or proportion. The amount of difference between the sample statistic and the population parameter determines whether the Null Hypothesis can be rejected or not.

The Null Hypothesis states that the population from which the sample came has the same mean or proportion as a hypothesized population. The Null Hypothesis is always an equality stating that the means or proportions of two populations are the same.

An example of a basic Null Hypothesis for a Hypothesis Test of Mean would be the following:

H0: x_bar = Constant = 5

This Null Hypothesis would be used to state that the population from which the sample was taken has a mean equal to 5. The Constant (5) is the mean of the hypothesized population that the sample’s population is being compared to. The Null Hypothesis states that the sample’s population and the hypothesized population have the same means. The Alternative Hypothesis states that they are different.

An example of a basic Null Hypothesis for a Hypothesis Test of Proportion would be the following:

H0: p_bar = Constant = 0.3

This Null Hypothesis would be used to state that the population from which the sample was taken has a proportion equal to 0.3. The Constant (0.3) is the proportion of the hypothesized population that the sample’s population is being compared to. The Null Hypothesis states that the sample’s population and the hypothesized population have the same proportions. The Alternative Hypothesis states that they are different.

### Null Hypothesis is Either Rejected or Not Rejected But Is Never Accepted

A hypothesis test has only two possible outcomes: the Null Hypothesis is either rejected or is not rejected. It is never correct to state that the Null Hypothesis was accepted. A hypothesis test only determines whether there is or is not enough evidence to reject the Null Hypothesis. The Null Hypothesis is rejected only when the hypothesis test result indicates a Level of Certainty that the Null Hypothesis is not valid at least equals the specified Level of Certainty.

If the required Level of Certainty for a hypothesis test is specified to be 95 percent, the Null Hypothesis will be rejected only if the test result indicates that there is at least a 95 percent probability that the Null Hypothesis is invalid. In all other cases, the Null Hypothesis would not be rejected. This is not equivalent to stating that the Null Hypothesis was accepted. The Null Hypothesis is never accepted; it can only be rejected or not rejected.

## Alternative Hypothesis

The Alternative Hypothesis is always in inequality stating that the means or proportions of two populations are not the same. The Alternative Hypothesis can be non-directional if it states that the means or proportions of two populations are merely not equal to each other. The Alternative Hypothesis is directional if it states that the mean or proportion of one of the populations is less than or greater than the mean of proportion of the other population.

An example of a non-directional Alternative Hypothesis for a Hypothesis test of Mean would be the following:

H1: x_bar ≠ 5

This Alternative Hypothesis would be used to state that the population from which the sample was taken has a mean that is not equal to 5.

An example of a directional Alternative Hypothesis would be the following:

H1: x_bar > 5

or

H1: x_bar < 5

These Alternative Hypotheses would be used to state that the population from which the sample was taken has a mean that is either greater than or less than 5.

An example of a non-directional Alternative Hypothesis for a Hypothesis test of Proportion would be the following:

H1: p_bar ≠ 0.3

This Alternative Hypothesis would be used to state that the population from which the sample was taken has a proportion that is not equal to 0.3.

An example of a directional Alternative Hypothesis would be the following:

H1: p_bar > 0.3

or

H1: p_bar < 0.3

These Alternative Hypotheses would be used to state that the population from which the sample was taken has a proportion that is either greater than or less than 0.3.

## One-Tailed Test vs. a Two-Tailed Test

The number of tails in a hypothesis test depends on whether the test is directional or not. The operator of the Alternative Hypothesis indicates whether or not the hypothesis test is directional. A non-directional operator (a “not equal” sign) in the Alternative Hypothesis indicates that the hypothesis test is a two-tailed test. A directional operator (a “greater than” or “less than” sign) in the Alternative Hypothesis indicates that the hypothesis test is a one-tailed test.

The Region of Rejection (the alpha region) for a one-tailed test is entirely contained in the one of the outer tails. A “greater than” operator in the Alternative Hypothesis indicates that the test is a one-tailed test in the right tail. A “less than” operator in the Alternative Hypothesis indicates that the test is a one-tailed test in the left tail. If α = 0.05, then one of the outer tails will contain the entire 5-percent Region of Rejection.

The Region of Rejection (the alpha region) for a two-tailed test is split between both outer tails. Each outer tail will contain half of the total Region of Rejection (alpha/2). If α = 0.05, then each outer tail will contain a 2.5-percent Region of Rejection if the test is a two-tailed tailed.

## Level of Certainty

Each hypothesis test has Level of Certainty that is specified. The Null Hypothesis is rejected only when that Level of Certainty has been reached that the sample did not come from the population. A commonly specified Level of Certainty is 95 percent. The Null Hypothesis would only be rejected in this case if the sample statistic was different enough from the population parameter that at least 95 percent certainty was achieved that the sample did not come from that population.

## Level of Significance (Alpha)

The Level of Certainty for a hypothesis test is often indicated with a different term called the Level of Significance also known as α (alpha). The relationship between the Level of Certainty and α is the following:

α = 1 – Level of Certainty

An alpha that is set to 0.05 indicates that a hypothesis test requires a Level of Certainty of 95 percent that the sample came from a different population to be reached before the Null Hypothesis is rejected.

## Region of Acceptance

A Hypothesis Test of Mean or Proportion can be performed if the Test Statistic is distributed according to the normal distribution or the t distribution. The Test Statistic is derived directly from the sample statistic such as the sample mean. If the Test Statistic is distributed according to the normal or t distribution, then the sample statistic is also distributed according to normal or t distribution. This will be discussed is greater detail shortly.

A Hypothesis Test of Mean or Proportion can be understood much more intuitively by mapping the sample statistic (the sample mean or proportion) to its own unique normal or t distribution. The sample statistic is the distributed variable whose distribution is mapped according its own unique normal or t distribution.

The Region of Acceptance is the percentage of area under this normal or t distribution curve that equals the test’s specified Level of Certainty. If the hypothesis test requires 95 percent in order to reject the Null Hypothesis, the Region of Acceptance will include 95 percent of the total area under the distributed variable’s mapped normal or t distribution curve.

If the observed value of the sample statistic (the observed mean or proportion of the single sample taken) falls inside of the Region of Acceptance, the Null Hypothesis is not rejected. If the observed value of the sample statistic falls outside of the Region of Acceptance (into the Region of Rejection), the Null Hypothesis is rejected.

## Region of Rejection

The Region of Rejection is the percentage of area under this normal or t distribution curve that equals the test’s specified Level of Significance (alpha). It is important to remember the following relationship:

Level of Significance (alpha) = 1 – Level of Certainty.

If the required Level of Certainty to reject the Null Hypothesis is 95 percent, then the following are true:

Level of Certainty = 0.95

Level of Significance (alpha) = 0.05

The Region of Acceptance includes 95 percent of the total area under the normal or t distribution curve that maps the distributed variable, which is the sample statistic (the sample mean or proportion).

The Region of Rejection includes 5 percent of the total area under the normal or t distribution curve that maps the distributed variable, which is the sample statistic (the sample mean or proportion). The 5-percent alpha region is entirely contained in one of the tails if the test is a one-tailed test. The 5-percent alpha region is split between both of the outer tails if the test is a one-tailed test.

If the observed value of the sample statistic (the observed mean or proportion of the single sample taken) falls inside of the Region of Rejection (outside the Region of Acceptance), the Null Hypothesis is rejected. If the observed value of the sample statistic falls inside of the Region of Acceptance, the Null Hypothesis is not rejected.

## Critical Value(s)

Each hypothesis test has one or two Critical Values. A Critical Value is the location of boundary between the Region of Acceptance and the Region of Rejection. A one-tailed test has one critical value because the Region of rejection is entirely contained in one of the outer tails. A two-tailed test has two Critical Values because the Region of Rejection is split between the two outer tails.

The Null Hypothesis is rejected if the sample statistic (the observed sample mean or proportion) is farther from the curve’s mean than the Critical Value on that side. If the sample statistic is farther from the curve’s mean than the Critical value on that side, the sample statistic lies in the Region of Rejection. If the sample statistic is closer to the curve’s mean than the Critical value on that side, the sample statistic lies in the Region of Acceptance.

## Test Statistic

Each hypothesis test calculates a Test Statistic. The Test Statistic is the amount of difference between the observed sample statistic (the observed sample mean or proportion) and the hypothesized population parameter (the Constant on the right side of the Null Hypothesis) which will be located at the curve’s mean.

This difference is expressed in units of Standard Errors. The Test Statistic is the number of Standard Errors that are between the observed sample statistic and the hypothesized population parameter. The Null Hypothesis is rejected if that number of Standard Errors specified by the Test Statistic) is larger than a critical number of Standard Errors. The critical number of Standard Errors is determined by the required Level of Certainty.

The Test Statistic is either the z Score or the t Value depending on whether a z Test or t Test is being performed. This will be discussed in greater detail shortly.

## Critical t Value or Critical z Value

Each hypothesis test calculates Critical t or z Values. A Critical t Value is calculated for a t Test and a Critical z Value is calculated for a z Test. A Critical t or z Value is the amount of difference expressed in Standard Errors between the boundary of the Region of Rejection (the Critical Value) and hypothesized population parameter (the Constant on the right side of the Null Hypothesis) which will be located at the curve’s mean.

A one-tailed test has only one Critical t or z Value because the Region of Rejection is entirely contained in one outer tail A two-tailed test has two Critical z or t Values because the Region of Rejection is split between the two outer tails.

The Test Statistic (the t Value or z Score) are compared with the Critical t or z Value on that side of the mean.

If the Test Statistic is farther from the standardized mean of zero than the Critical t or z Value on that side, the Null Hypothesis is rejected. The Test Statistic is the number of Standard Errors that the sample statistic is from the curve’s mean. The Critical t or z Value on the same side is the number of Standard Errors that the Critical Value (the boundary of the Region of Rejection) is from the mean. If the Test Statistic is farther from the standardized mean of zero than the Critical t or z value, the sample statistic lies in the Region of Rejection.

## Relationship Between p Value and Alpha

Each hypothesis test calculates a p Value. The p Value is the area under the curve that is beyond the sample statistic (the observed sample mean or proportion). The p Value is the probability that a sample of size n with the observed sample mean or proportion could have occurred if the Null Hypothesis were true.

If, for example, the p Value of a Hypothesis Test of Mean or Proportion were calculated to be 0.0212, that would indicated that there is only a 2.12 percent chance that a sample of size n would have the observed sample mean or proportion if the Null Hypothesis were true. The Null Hypothesis states that the population from which the sample came has the same mean as the hypothesized population. This mean is the Constant on the right side of the Null Hypothesis.

The p Value is compared to alpha for a one-tailed test and to alpha/2 for a two-tailed test. The Null Hypothesis is rejected if p is smaller than α for a one-tailed test or if p is smaller than α/2 for a two-tailed test. If the p Value is smaller than α for a one-tailed test or smaller than α/2 for a two-tailed test, the sample statistic is in the Region of Rejection.

## The 3 Equivalent Reasons To Reject the Null Hypothesis

The Null Hypothesis of a Hypothesis Test of Mean or Proportion is rejected if any of the following equivalent conditions are shown to exist:

1) The sample statistic (the observed sample mean or proportion) is beyond the Critical Value. The sample statistic would therefore lie in the Region of Rejection because the Critical Value is the boundary of the Region of Rejection.

2) The Test Statistic (the t value or z Score) is farther from zero than the Critical t or z Value. The Test Statistic is the number of Standard Errors that the sample statistic is from the curve’s mean. The Critical t or z Value is the number of Standard Errors that the boundary of the Region of Rejection is from the curve’s mean. If the Test Statistic is farther from farther from the standardized mean of 0 than the Critical t or z Value, the sample statistic lies in the Region of Rejection.

3) The p value is smaller than α for a one-tailed test or α/2 for a two-tailed test. The p Value is the curve area beyond the sample statistic. α and α/2 equal the curve areas contained by the Region of Rejection on that side for a one-tailed test and a two-tailed test respectively. If the p value is smaller than α for a one-tailed test or α/2 for a two-tailed test, the sample statistic lies in the Region of Rejection.

## Type I and Type II Errors

A Type I Error is a false positive and a Type II Error is a false negative. A false positive occurs when a test incorrectly detects of a significant difference when one does not exist. A false negative occurs when a test incorrectly fails to detect a significant different when one exists.

α (the specified Level of Significance) = a test’s probability of a making a Type I Error.

β = a test’s probability of a making a Type II Error.

## Power of a Test

The Power of a test indicates the test’s sensitivity. The Power of a test is the probability that the test will detect a significant difference if one exists. The Power of a test is the probability of not making a Type II Error, which is failing to detect a difference when one exists. A test’s Power is therefore expressed by the following formula:

Power = 1 – β

## Effect Size

Effect size in a t-Test or z Test is a convention of expressing how large the difference between two groups is without taking into account the sample size and whether that difference is significant.

Effect size of Hypotheses Tests of Mean is usually expressed in measures of Cohen’s d. Cohen’s d is a standardized way of quantifying the size of the difference between the two groups. This standardization of the size of the difference (the effect size) enables classification of that difference in relative terms of “large,” “medium,” and “small.” A large effect would be a difference between two groups that is easily noticeable with the measuring equipment available. A small effect would be a difference between two groups that is not easily noticed.

## Hypothesis Test of Mean vs. Proportion

Hypothesis Test covered in this section will either be Hypothesis Tests of Mean or Hypothesis Test of Proportion. A data point of a sample taken for a Hypothesis Test of Mean can have a range of values. A data point of a sample taken for a Hypothesis Test of Proportion is binary; it can take only one of two values.

### Hypothesis Tests of Mean – Basic Definition

A Hypothesis Test of Mean compares an observed sample mean with a hypothesized population mean to determine if the sample was taken from the same population. An example would be to compare a sample of monthly sales of stores in one region to the national average to determine if mean sales from the region (the population from which the sample was taken) is different than the national average (the hypothesized population parameter). As stated, a sample taken for a Hypothesis Test of Mean can have a range of values. In this case, the sales of a sample sampled store can fall within a wide range of values.

Hypothesis Tests of mean are covered in detail separate sections on t Tests and z Tests.

t Tests are also summarized at the end of the section on the t distribution.

z Tests are also summarized at the end of the section on the normal distribution.

### Hypothesis Tests of Proportion – Basic Definition

A Hypothesis Test of Proportion compares an observed sample proportion with a hypothesized population proportion to determine if the sample was taken from the same population. An example would be to compare the proportion of defective units from a sample taken from one production line to the proportion of defective units from all production lines to determine if the proportion defective from the one production line (the population from which the sample was taken) is different than from the proportion defective of all production lines (the hypothesized population parameter). As stated, a sample taken for a Hypothesis Test of Proportion can only have one of two values. In this case, a sampled unit from a production line is either defective or it is not.

Data observations in the sample taken for a Hypothesis Test of Proportion are required to be distributed according to the binomial distribution. Data that are binomially distributed are independent of each other, binary (can assume only one of two states), and all have the same probability of assuming the positive state.

The binomial distribution can be approximated by the normal distribution under the following two conditions:

1) p (the probability of a positive outcome on each trial) and q (q = 1 – p) are not too close to 0 or 1.

2) np > 5 and nq > 5

A z Test can be performed on binomially-distributed data if the above conditions are met. Hypothesis Test of Proportion only use z Tests and not t Tests because the binomial distribution is approximated by the normal distribution, not the t distribution.

The Test Statistic for a z Test is a z Score.

## Overview of Steps of a Hypothesis Test of Proportion

A Hypothesis Test of Proportion is performed in a very similar manner to a Hypothesis Test of Mean. A general description of the major steps is as follows:

1) A sample of binary data is taken. The sample proportion is calculated. Examples of a sample proportion is the proportion of sampled people who are of one gender or the proportion of sampled production units that are defective.

2) A Null Hypothesis is created stating the population from which the sample was taken has the same proportion as a hypothesized population proportion. An Alternative Hypothesis is constructed stating that sample population’s proportion is not equal to, greater than, or less than the hypothesized population proportion depending on the wording of the problem.

3) The sample proportion is mapped to a normal curve that has a mean equal to the hypothesized population proportion and a Standard Error calculated based upon a formula specific to the type of Hypothesis Test of Proportion.

4) The Critical Values are calculated and the Regions of Acceptance and Rejection are mapped on the normal graph that maps the distributed variable.

5) Critical z Values, the Test Statistic (z Score) and p Value are calculated.

6) The Null Hypothesis is rejected if any of the following equivalent conditions are shown to exist:

a) The observed sample proportion, p_bar, is beyond the Critical Value.

b) The z Value (the Test Statistic) is farther from zero than the Critical z Value.

c) The p Value is smaller than α for a one-tailed test or α/2 for a two-tailed test.

The Null Hypothesis is not rejected in the output of the following Hypothesis Test of Proportion because none of the above equivalent conditions exist. This is evidenced in the following graph: (Click On Image To See a Larger Version)

This z-Test was a two-tailed test as evidenced by the yellow Region of Rejection split between the both outer tails. In this t-Test the alpha was set to 0.05. This 5-percent Region of Rejection is split between the two tails so that each tail contains a 2.5 percent Region of Rejection.

The mean of this non-standardized normal distribution curve is 0.30. This indicates that the Null Hypothesis is as follows:

H0: p_bar = 0.30

Since this is a two-tailed t-Test, the Alternative Hypothesis is as follows:

H1: p_bar ≠ 0.30

This one-sample z-Test is evaluating whether the population from which the sample was taken has a population proportion that is not equal to 0.30. This is a non-directional z-Test and is therefore two-tailed.

The sample statistic is the observed sample proportion of this single sample taken for this test. This observed sample proportion is calculated to be 0.42.

The boundaries of the Region of Rejection occur at 0.17 and 0.43. Everything beyond these two points is in the Region of Rejection. Everything inside of these two points is in the Region of Acceptance. These two Critical Values are 1.95 Standard Errors from the standardized mean of 0. This indicates that the Critical t Values are ±1.96.

The graph shows that the sample statistic (the sample proportion of 0.42) falls inside the right Critical Value of 0.43 and is therefore in the Region of Acceptance.

The sample statistic is 1.85 Standard Errors from the standardized mean of 0. This is closer to the standardized mean of 0 than the right Critical t value which is 1.96.

The curve area beyond the sample statistic consists of 3.2 percent of the area under the curve. This is larger than α/2 which is 2.5 percent of the total curve area because alpha was set to 0.05.

The Null Hypothesis is not rejected. As the graph shows, none of the three equivalent conditions have been met to reject the Null Hypothesis. It cannot be stated with at least 95 percent certainty that the proportion of the population from which the sample was taken does not equal the hypothesized population proportion of 0.30.

It should be noted that failure to reject the Null Hypothesis is not equivalent to accepting the Null Hypothesis. A hypothesis test can only reject or fail to reject the Null Hypothesis.

## Uses of Hypothesis Tests of Proportion

1) Comparing the proportion of a sample taken from one population with the another population’s proportion to determine if both populations have the different proportions. An example of this would be to compare the proportion of monthly purchases returned in a sample of retail stores from one region to the national mean monthly return rate to determine if the monthly proportion of sales returned in all stores in the one region is different than the national monthly return rate.

2) Comparing the proportion of a sample taken from one population to a fixed proportion to determine if that population’s proportion is different than the fixed proportion. An example of this might be to compare the proportion of a specified chemical measured in a sample of a number of units of a product to the company’s claims about that product specification to determine if the actual proportion of the chemical in all units of that company’s product is different than what the company claims it is.

3) Comparing the proportion of a sample from one population with the proportion of a sample from another population to determine if the two populations have different proportions. An example of this would be to compare the proportion of defective units of a sample of production runs by one crew with the proportion of defective units of a sample of production runs by another crew to determine if the two crews have consistently different proportions of defective units in all of their runs.

4) Comparing successive measurement pairs taken on the same group of objects to determine if anything has changed between measurements. An example of this would be to evaluate whether there is difference in the proportion of the same people passing a standardized test before and after a training program to determine if the training program makes a difference in the proportion of all people who take the standardized test before and after undergoing the training

5) Comparing the same measurements taken on pairs of related objects. An example of this would be to evaluate whether the proportion of total household income brought in by the husband and the wife is different in a sample of married couples to determine if there is a difference in the proportions of total household income brought in by husbands and wives in all married couples.

It is important to note that a hypothesis test is used to determine if two populations are different, The outcome of hypothesis test is to either reject or fail to reject the Null Hypothesis. It would be incorrect to state that a hypothesis test is used to determine if two populations are the same.

## Types of Hypothesis Tests of Proportion

The 3 types of Hypothesis tests of Proportion discussed here are the following:

One-Sample Hypothesis Test of Proportion An example of this type of hypothesis test will be performed in the following blog article.

Two-Independent-Sample, Pooled Hypothesis Test of Proportion An example of this type of hypothesis test will be performed in a blog article after this one.

Two-Independent-Sample, Unpooled Hypothesis Test of Proportion An example of this type of hypothesis test will be performed in a blog article after this one.

Excel Master Series Blog Directory