# Statistical Background on DOE

 Chapter 2: Statistical Background on DOE

Variations occur in nature, be it the tensile strength of a particular grade of steel, caffeine content in your energy drink or the distance traveled by your vehicle in a day. Variations are also seen in the observations recorded during multiple executions of a process, even when all factors are strictly maintained at their respective levels and all the executions are run as identically as possible. The natural variations that occur in a process, even when all conditions are maintained at the same level, are often called noise. When the effect of a particular factor on a process is studied, it becomes extremely important to distinguish the changes in the process caused by the factor from noise. A number of statistical methods are available to achieve this. This chapter covers basic statistical concepts that are useful in understanding the statistical analysis of data obtained from designed experiments. The initial sections of this chapter discuss the normal distribution and related concepts. The assumption of the normal distribution is widely used in the analysis of designed experiments. The subsequent sections introduce the standard normal, chi-squared, ${t}\,\!$ and ${F}\,\!$ distributions that are widely used in calculations related to hypothesis testing and confidence bounds. This chapter also covers hypothesis testing. It is important to gain a clear understanding of hypothesis testing because this concept finds direct application in the analysis of designed experiments to determine whether or not a particular factor is significant [Wu, 2000].

# Basic Concepts

## Random Variables and the Normal Distribution

If you record the distance traveled by your car everyday, you'll notice that these values show some variation because your car does not travel the exact same distance every day. If a variable ${X}\,\!$ is used to denote these values then ${X}\,\!$ is considered a random variable (because of the diverse and unpredicted values ${X}\,\!$ can have). Random variables are denoted by uppercase letters, while a measured value of the random variable is denoted by the corresponding lowercase letter. For example, if the distance traveled by your car on January 1 was 10.7 miles, then:

$x=10.7\text{ miles}\,\!$

A commonly used distribution to describe the behavior of random variables is the normal distribution. When you calculate the mean and standard deviation for a given data set, a common assumption used is that the data follows a normal distribution. A normal distribution (also referred to as the Gaussian distribution) is a bell-shaped curved (see figure below). The mean and standard deviation are the two parameters of this distribution. The mean determines the location of the distribution on the x-axis and is also called the location parameter. The standard deviation determines the spread of the distribution (how narrow or wide) and is thus called the scale parameter. The standard deviation, or its square called variance, gives an indication of the variability or spread of data. A large value of the standard deviation (or variance) implies that a large amount of variability exists in the data.

Any curve in the image below is also referred to as the probability density function, or pdf of the normal distribution, as the area under the curve gives the probability of occurrence of $X\,\!$ for a particular interval. For instance, if you obtained the mean and standard deviation for the distance data of your car as 15 miles and 2.5 miles respectively, then the probability that your car travels a distance between 7 miles and 14 miles is given by the area under the curve covered between these two values, which is calculated to be 34.4% (see figure below). This means that on 34.4 days out of every 100 days your car travels, your car can be expected to cover a distance in the range of 7 to 14 miles.

On a normal probability density function, the area under the curve between the values of $Mean-(3\times Standard Deviation)\,\!$ and $Mean+(3\times Standard Deviation)\,\!$ is approximately 99.7% of the total area under the curve. This implies that almost all the time (or 99.7% of the time) the distance traveled will fall in the range of 7.5 miles $(15-3\times 2.5)\,\!$ and 22.5 miles $(15+3\times 2.5)\,\!$. Similarly, $Mean\pm (2\times Standard Deviation)\,\!$ covers approximately 95% of the area under the curve and $Mean\pm (Standard Deviation)\,\!$ covers approximately 68% of the area under the curve.

## Population Mean, Sample Mean and Variance

If data for all of the population under investigation is known, then the mean and variance for this population can be calculated as follows:

Population Mean:

$\mu =\frac{\underset{i=1}{\overset{N}{\mathop{\sum }}}\,{{x}_{i}}}{N}\,\!$

Population Variance:

${{\sigma }^{2}}=\frac{\underset{i=1}{\overset{N}{\mathop{\sum }}}\,{{({{x}_{i}}-\mu )}^{2}}}{N}\,\!$

Here, $N\,\!$ is the size of the population.

The population standard deviation is the positive square root of the population variance.

Most of the time it is not possible to obtain data for the entire population. For example, it is impossible to measure the height of every male in a country to determine the average height and variance for males of a particular country. In such cases, results for the population have to be estimated using samples. This process is known as statistical inference. Mean and variance for a sample are calculated using the following relations:

Sample Mean:

$\bar{x}=\frac{\underset{i=1}{\overset{n}{\mathop{\sum }}}\,{{x}_{i}}}{n}\,\!$

Sample Variance:

${{s}^{2}}=\frac{\underset{i=1}{\overset{n}{\mathop{\sum }}}\,{{({{x}_{i}}-\bar{x})}^{2}}}{n-1}\,\!$

Here, $n\,\!$ is the sample size. The sample standard deviation is the positive square root of the sample variance. The sample mean and variance of a random sample can be used as estimators of the population mean and variance, respectively. The sample mean and variance are referred to as statistics. A statistic is any function of observations in a random sample. You may have noticed that the denominator in the calculation of sample variance, unlike the denominator in the calculation of population variance, is $(n-1)\,\!$ and not $n\,\!$. The reason for this difference is explained in Biased Estimators.

## Central Limit Theorem

The Central Limit Theorem states that for a large sample size, $n\,\!$:

• The sample means from a population are normally distributed with a mean value equal to the population mean, $\mu\,\!$, even if the population is not normally distributed.
What this means is that if random samples are drawn from any population and the sample mean, $\bar{x}\,\!$, calculated for each of these samples, then these sample means would follow the normal distribution with a mean (or location parameter) equal to the population mean, $\mu\,\!$. Thus, the distribution of the statistic, $\bar{x}\,\!$, would be a normal distribution with mean, $\mu\,\!$. The distribution of a statistic is called the sampling distribution.
• The variance, ${{s}^{2}}\,\!$, of the sample means would be $n\,\!$ times smaller than the variance of the population, ${{\sigma }^{2}}\,\!$.
This implies that the sampling distribution of the sample means would have a variance equal to ${{\sigma }^{2}}/n\,\!$ (or a scale parameter equal to $\sigma /\sqrt{n}\,\!$), where $\sigma\,\!$ is the population standard deviation. The standard deviation of the sampling distribution of an estimator is called the standard error of the estimator. Thus the standard error of sample mean $\bar{x}\,\!$ is $\sigma /\sqrt{n}\,\!$.

In short, the Central Limit Theorem states that the sampling distribution of the sample mean is a normal distribution with parameters $\mu\,\!$ and $\sigma /\sqrt{n}\,\!$ as shown in the figure below.

## Unbiased and Biased Estimators

If the mean value of an estimator equals the true value of the quantity it estimates, then the estimator is called an unbiased estimator (see figure below). For example, assume that the sample mean is being used to estimate the mean of a population. Using the Central Limit Theorem, the mean value of the sample mean equals the population mean. Therefore, the sample mean is an unbiased estimator of the population mean. If the mean value of an estimator is either less than or greater than the true value of the quantity it estimates, then the estimator is called a biased estimator. For example, suppose you decide to choose the smallest observation in a sample to be the estimator of the population mean. Such an estimator would be biased because the average of the values of this estimator would always be less than the true population mean. In other words, the mean of the sampling distribution of this estimator would be less than the true value of the population mean it is trying to estimate. Consequently, the estimator is a biased estimator.

A case of biased estimation is seen to occur when sample variance, ${{s}^{2}}\,\!$, is used to estimate the population variance, ${{\sigma }^{2}}\,\!$, if the following relation is used to calculate the sample variance:

${{s}^{2}}=\frac{\underset{i=1}{\overset{n}{\mathop{\sum }}}\,{{({{x}_{i}}-\bar{x})}^{2}}}{n}\,\!$

The sample variance calculated using this relation is always less than the true population variance. This is because deviations with respect to the sample mean, $\bar{x}\,\!$, are used to calculate the sample variance. Sample observations, ${{x}_{i}}\,\!$, tend to be closer to $\bar{x}\,\!$ than to $\mu\,\!$. Thus, the calculated deviations $({{x}_{i}}-\bar{x})\,\!$ are smaller. As a result, the sample variance obtained is smaller than the population variance. To compensate for this, $(n-1)\,\!$ is used as the denominator in place of $n\,\!$ in the calculation of sample variance. Thus, the correct formula to obtain the sample variance is:

${{s}^{2}}=\frac{\underset{i=1}{\overset{n}{\mathop{\sum }}}\,{{({{x}_{i}}-\bar{x})}^{2}}}{n-1}\,\!$

It is important to note that although using $(n-1)\,\!$ as the denominator makes the sample variance, ${{s}^{2}}\,\!$, an unbiased estimator of the population variance, ${{\sigma }^{2}}\,\!$, the sample standard deviation, $s\,\!$, still remains a biased estimator of the population standard deviation, $\sigma\,\!$. For large sample sizes this bias is negligible.

## Degrees of Freedom (dof)

The number of degrees of freedom is the number of independent observations made in excess of the unknowns. If there are 3 unknowns and 7 independent observations are taken, then the number of degrees of freedom is 4 (7-3). As another example, two parameters are needed to specify a line. Therefore, there are 2 unknowns. If 10 points are available to fit the line, the number of degrees of freedom is 8 (10-2).

## Standard Normal Distribution

A normal distribution with mean $\mu =0\,\!$ and variance ${{\sigma }^{2}}=1\,\!$ is called the standard normal distribution (see figure below). Standard normal random variables are denoted by $Z\,\!\,\!$. If $X\,\!$ represents a normal random variable that follows the normal distribution with mean $\mu\,\!$ and variance ${{\sigma }^{2}}\,\!$, then the corresponding standard normal random variable is:

$Z=(X-\mu )/\sigma\,\!$

$Z\,\!$ represents the distance of $X\,\!$ from the mean $\mu\,\!$ in terms of the standard deviation $\sigma\,\!$.

## Chi-Squared Distribution

If $Z\,\!$ is a standard normal random variable, then the distribution of ${{Z}^{2}}\,\!$ is a chi-squared distribution (see figure below).

A chi-squared random variable is represented by ${{\chi }^{2}}\,\!$. Thus:

${{\chi }^{2}}={{Z}^{2}}\,\!$

The distribution of the variable ${{\chi }^{2}}\,\!$ mentioned in the previous equation is also referred to as centrally distributed chi-squared with one degree of freedom. The degree of freedom is 1 here because the chi-squared random variable is obtained from a single standard normal random variable $Z\,\!$. The previous equation may also be represented by including the degree of freedom in the equation as:

$\chi _{1}^{2}={{Z}^{2}}\,\!$

If ${{Z}_{1}}\,\!$, ${{Z}_{2}}\,\!$, ${{Z}_{3}}\,\!$... ${{Z}_{m}}\,\!$ are $m\,\!$ independent standard normal random variables, then:

$\chi _{m}^{2}=Z_{1}^{2}+Z_{2}^{2}+Z_{3}^{2}...+Z_{m}^{2}\,\!$

is also a chi-squared random variable. The distribution of $\chi _{m}^{2}\,\!$ is said to be centrally distributed chi-squared with $m\,\!$ degrees of freedom, as the chi-squared random variable is obtained from $m\,\!$ independent standard normal random variables. If $X\,\!$ is a normal random variable, then the distribution of ${{X}^{2}}\,\!$ is said to be non-centrally distributed chi-squared with one degree of freedom. Therefore, ${{X}^{2}}\,\!$ is a chi-squared random variable and can be represented as:

$\chi _{1}^{2}={{X}^{2}}\,\!$

If ${{X}_{1}}\,\!$, ${{X}_{2}}\,\!$, ${{X}_{3}}\,\!$... ${{X}_{m}}\,\!$ are $m\,\!$ independent normal random variables then:

$\chi _{m}^{2}=X_{1}^{2}+X_{2}^{2}+X_{3}^{2}...+X_{m}^{2}\,\!$

is a non-centrally distributed chi-squared random variable with $m\,\!$ degrees of freedom.

## Student's t Distribution (t Distribution)

If $Z\,\!$ is a standard normal random variable, $\chi _{k}^{2}\,\!$ is a chi-squared random variable with $k\,\!$ degrees of freedom, and both of these random variables are independent, then the distribution of the random variable $T\,\!$ such that:

$T=\frac{Z}{\sqrt{\chi _{k}^{2}/k}}\,\!$

is said to follow the $t\,\!$ distribution with $k\,\!$ degrees of freedom.

The $t\,\!$ distribution is similar in appearance to the standard normal distribution (see figure below). Both of these distributions are symmetric, reaching a maximum at the mean value of zero. However, the $t\,\!$ distribution has heavier tails than the standard normal distribution, implying that it has more probability in the tails. As the degrees of freedom, $k\,\!$, of the $t\,\!$ distribution approach infinity, the distribution approaches the standard normal distribution.

## F Distribution

If $\chi _{u}^{2}\,\!$ and $\chi _{v}^{2}\,\!$ are two independent chi-squared random variables with $u\,\!$ and $v\,\!$ degrees of freedom, respectively, then the distribution of the random variable $F\,\!$ such that:

$F=\frac{\chi _{u}^{2}/u}{\chi _{v}^{2}/v}\,\!$

is said to follow the $F\,\!$ distribution with $u\,\!$ degrees of freedom in the numerator and $v\,\!$ degrees of freedom in the denominator. The $F\,\!$ distribution resembles the chi-squared distribution (see the following figure). This is because the $F\,\!$ random variable, like the chi-squared random variable, is non-negative and the distribution is skewed to the right (a right skew means that the distribution is unsymmetrical and has a right tail). The $F\,\!$ random variable is usually abbreviated by including the degrees of freedom as ${{F}_{u,v}}\,\!$.

# Hypothesis Testing

A statistical hypothesis is a statement about the population under study or about the distribution of a quantity under consideration. The null hypothesis, ${{H}_{0}}\,\!$, is the hypothesis to be tested. It is a statement about a theory that is believed to be true but has not been proven. For instance, if a new product design is thought to perform consistently, regardless of the region of operation, then the null hypothesis may be stated as

${{H}_{0}}\text{ : New product design performance is not affected by region}\,\!$

Statements in ${{H}_{0}}\,\!$ always include exact values of parameters under consideration. For example:

${{H}_{0}}\text{ : The population mean is 100}\,\!$

Or simply:

${{H}_{0}}:\mu =100\,\!$

Rejection of the null hypothesis, ${{H}_{0}}\,\!$, leads to the possibility that the alternative hypothesis, ${{H}_{1}}\,\!$, may be true. Given the previous null hypothesis, the alternate hypothesis may be:

${{H}_{1}}\text{ : New product design performance is affected by region}\,\!$

In the case of the example regarding inference on the population mean, the alternative hypothesis may be stated as:

${{H}_{1}}\text{ : The population mean is not 100}\,\!$

Or simply:

${{H}_{1}}:\mu \ne 100\,\!$

Hypothesis testing involves the calculation of a test statistic based on a random sample drawn from the population. The test statistic is then compared to the critical value(s) and used to make a decision about the null hypothesis. The critical values are set by the analyst.

The outcome of a hypothesis test is that we either reject ${{H}_{0}}\,\!$ or we fail to reject ${{H}_{0}}\,\!$. Failing to reject ${{H}_{0}}\,\!$ implies that we did not find sufficient evidence to reject ${{H}_{0}}\,\!$. It does not necessarily mean that there is a high probability that ${{H}_{0}}\,\!$ is true. As such, the terminology accept ${{H}_{0}}\,\!$ is not preferred.

For example, assume that an analyst wants to know if the mean of a certain population is 100 or not. The statements for this hypothesis can be stated as follows:

\begin{align} & {{H}_{0}}: & \mu =100 \\ & {{H}_{1}}: & \mu \ne 100 \end{align}\,\!

The analyst decides to use the sample mean as the test statistic for this test. The analyst further decides that if the sample mean lies between 98 and 102 it can be concluded that the population mean is 100. Thus, the critical values set for this test by the analyst are 98 and 102. It is also decided to draw out a random sample of size 25 from the population.

Now assume that the true population mean is $\mu =100\,\!$ and the true population standard deviation is $\sigma =5\,\!$. This information is not known to the analyst. Using the Central Limit Theorem, the test statistic (sample mean) will follow a normal distribution with a mean equal to the population mean, $\mu\,\!$, and a standard deviation of $\sigma /\sqrt{n}\,\!$, where $n\,\!$ is the sample size. Therefore, the distribution of the test statistic has a mean of 100 and a standard deviation of $5/\sqrt{25}=1\,\!$. This distribution is shown in the figure below.

The unshaded area in the figure bound by the critical values of 98 and 102 is called the acceptance region. The acceptance region gives the probability that a random sample drawn from the population would have a sample mean that lies between 98 and 102. Therefore, this is the region that will lead to the "acceptance" of ${{H}_{0}}\,\!$. On the other hand, the shaded area gives the probability that the sample mean obtained from the random sample lies outside of the critical values. In other words, it gives the probability of rejection of the null hypothesis when the true mean is 100. The shaded area is referred to as the critical region or the rejection region. Rejection of the null hypothesis ${{H}_{0}}\,\!$ when it is true is referred to as type I error. Thus, there is a 4.56% chance of making a type I error in this hypothesis test. This percentage is called the significance level of the test and is denoted by $\alpha\,\!$. Here $\alpha =0.0456\,\!$ or $4.56%\,\!$ (area of the shaded region in the figure). The value of $\alpha\,\!$ is set by the analyst when he/she chooses the critical values.

A type II error is also defined in hypothesis testing. This error occurs when the analyst fails to reject the null hypothesis when it is actually false. Such an error would occur if the value of the sample mean obtained is in the acceptance region bounded by 98 and 102 even though the true population mean is not 100. The probability of occurrence of type II error is denoted by $\beta\,\!$.

### Two-sided and One-sided Hypotheses

As seen in the previous section, the critical region for the hypothesis test is split into two parts, with equal areas in each tail of the distribution of the test statistic. Such a hypothesis, in which the values for which we can reject ${{H}_{0}}\,\!$ are in both tails of the probability distribution, is called a two-sided hypothesis. The hypothesis for which the critical region lies only in one tail of the probability distribution is called a one-sided hypothesis. For instance, consider the following hypothesis test:

\begin{align} & {{H}_{0}}: & \mu =100 \\ & {{H}_{1}}: & \mu \gt 100 \end{align}\,\!

This is an example of a one-sided hypothesis. Here the critical region lies entirely in the right tail of the distribution.

The hypothesis test may also be set up as follows:

\begin{align} & {{H}_{0}}: & \mu =100 \\ & {{H}_{1}}: & \mu \lt 100 \end{align}\,\!

This is also a one-sided hypothesis. Here the critical region lies entirely in the left tail of the distribution.

# Statistical Inference for a Single Sample

Hypothesis testing forms an important part of statistical inference. As stated previously, statistical inference refers to the process of estimating results for the population based on measurements from a sample. In the next sections, statistical inference for a single sample is discussed briefly.

### Inference on the Mean of a Population When the Variance Is Known

The test statistic used in this case is based on the standard normal distribution. If $\bar{X}\,\!$ is the calculated sample mean, then the standard normal test statistic is:

${{Z}_{0}}=\frac{\bar{X}-{{\mu }_{0}}}{\sigma /\sqrt{n}}\,\!$

where ${{\mu }_{0}}\,\!$ is the hypothesized population mean, $\sigma\,\!$ is the population standard deviation and $n\,\!$ is the sample size.

For example, assume that an analyst wants to know if the mean of a population, $\mu\,\!$, is 100. The population variance, ${{\sigma }^{2}}\,\!$, is known to be 25. The hypothesis test may be conducted as follows:

1) The statements for this hypothesis test may be formulated as:

\begin{align} & {{H}_{0}}: & \mu =100 \\ & {{H}_{1}}: & \mu \ne 100 \end{align}\,\!

It is a clear that this is a two-sided hypothesis. Thus the critical region will lie in both of the tails of the probability distribution.

2) Assume that the analyst chooses a significance level of 0.05. Thus $\alpha =0.05\,\!$. The significance level determines the critical values of the test statistic. Here the test statistic is based on the standard normal distribution. For the two-sided hypothesis these values are obtained as:

${{z}_{\alpha /2}}={{z}_{0.025}}=1.96\,\!$

and

$-{{z}_{\alpha /2}}=-{{z}_{0.025}}=-1.96\,\!$

These values and the critical regions are shown in figure below. The analyst would fail to reject ${{H}_{0}}\,\!$ if the test statistic, ${{Z}_{0}}\,\!$, is such that:

$-{{z}_{\alpha /2}}\le {{Z}_{0}}\le {{z}_{\alpha /2}}\,\!$

or

$-1.96\le {{Z}_{0}}\le 1.96\,\!$

3) Next the analyst draws a random sample from the population. Assume that the sample size, $n\,\!$, is 25 and the sample mean is obtained as $\bar{x}=103\,\!$.

4) The value of the test statistic corresponding to the sample mean value of 103 is:

\begin{align} {{z}_{0}}&=& \frac{\bar{x}-{{\mu }_{0}}}{\sigma /\sqrt{n}} \\ &=& \frac{103-100}{5/\sqrt{25}} \\ &=& 3 \end{align}\,\!

Since this value does not lie in the acceptance region $-1.96\le {{Z}_{0}}\le 1.96\,\!$, we reject ${{H}_{0}}:\mu =100\,\!$ at a significance level of 0.05.

### P Value

In the previous example the null hypothesis was rejected at a significance level of 0.05. This statement does not provide information as to how far out the test statistic was into the critical region. At times it is necessary to know if the test statistic was just into the critical region or was far out into the region. This information can be provided by using the $p\,\!$ value.

The $p\,\!$ value is the probability of occurrence of the values of the test statistic that are either equal to the one obtained from the sample or more unfavorable to ${{H}_{0}}\,\!$ than the one obtained from the sample. It is the lowest significance level that would lead to the rejection of the null hypothesis, ${{H}_{0}}\,\!$, at the given value of the test statistic. The value of the test statistic is referred to as significant when ${{H}_{0}}\,\!$ is rejected. The $p\,\!$ value is the smallest $\alpha\,\!$ at which the statistic is significant and ${{H}_{0}}\,\!$ is rejected.

For instance, in the previous example the test statistic was obtained as ${{z}_{0}}=3\,\!$. Values that are more unfavorable to ${{H}_{0}}\,\!$ in this case are values greater than 3. Then the required probability is the probability of getting a test statistic value either equal to or greater than 3 (this is abbreviated as $P(Z\ge 3)\,\!$). This probability is shown in figure below as the dark shaded area on the right tail of the distribution and is equal to 0.0013 or 0.13% (i.e., $P(Z\ge 3)=0.0013\,\!$). Since this is a two-sided test the $p\,\!$ value is:

$p\text{ }value=2\times 0.0013=0.0026\,\!$

Therefore, the smallest $\alpha\,\!$ (corresponding to the test static value of 3) that would lead to the rejection of ${{H}_{0}}\,\!$ is 0.0026.

### Inference on Mean of a Population When Variance Is Unknown

When the variance, ${{\sigma }^{2}}\,\!$, of a population (that can be assumed to be normally distributed) is unknown the sample variance, ${{S}^{2}}\,\!$, is used in its place in the calculation of the test statistic. The test statistic used in this case is based on the $t\,\!$ distribution and is obtained using the following relation:

${{T}_{0}}=\frac{\bar{X}-{{\mu }_{0}}}{S/\sqrt{n}}\,\!$

The test statistic follows the $t\,\!$ distribution with $n-1\,\!$ degrees of freedom.

For example, assume that an analyst wants to know if the mean of a population, $\mu\,\!$, is less than 50 at a significance level of 0.05. A random sample drawn from the population gives the sample mean, $\bar{x}\,\!$, as 47.7 and the sample standard deviation, $s\,\!$, as 5. The sample size, $n\,\!$, is 25. The hypothesis test may be conducted as follows:

1) The statements for this hypothesis test may be formulated as:

\begin{align} & {{H}_{0}}: & \mu =50 \\ & {{H}_{1}}: & \mu \lt 50 \end{align}\,\!

It is clear that this is a one-sided hypothesis. Here the critical region will lie in the left tail of the probability distribution.

2) Significance level, $\alpha =0.05\,\!$. Here, the test statistic is based on the $t\,\!$ distribution. Thus, for the one-sided hypothesis the critical value is obtained as:

$-{{t}_{\alpha ,dof}}=-{{t}_{0.05,n-1}}=-{{t}_{0.05,24}}=-1.7109\,\!$

This value and the critical regions are shown in the figure below. The analyst would fail to reject ${{H}_{0}}\,\!$ if the test statistic ${{T}_{0}}\,\!$ is such that:

${{T}_{0}}\gt -{{t}_{0.05,24}}\,\!$

3) The value of the test statistic, ${{T}_{0}}\,\!$, corresponding to the given sample data is:

\begin{align}{{t}_{0}}= & \frac{\bar{X}-{{\mu }_{0}}}{S/\sqrt{n}} \\ = & \frac{47.7-50}{5/\sqrt{25}} \\ = & -2.3 \end{align}\,\!

Since ${{T}_{0}}\,\!$ is less than the critical value of -1.7109, ${{H}_{0}}:\mu =50\,\!$ is rejected and it is concluded that at a significance level of 0.05 the population mean is less than 50.

4) $P\,\!$ value

In this case the $p\,\!$ value is the probability that the test statistic is either less than or equal to $-2.3\,\!$ (since values less than $-2.3\,\!$ are unfavorable to ${{H}_{0}}\,\!$). This probability is equal to 0.0152.

### Inference on Variance of a Normal Population

The test statistic used in this case is based on the chi-squared distribution. If ${{S}^{2}}\,\!$ is the calculated sample variance and $\sigma _{0}^{2}\,\!$ the hypothesized population variance then the Chi-Squared test statistic is:

$\chi _{0}^{2}=\frac{(n-1){{S}^{2}}}{\sigma _{0}^{2}}\,\!$

The test statistic follows the chi-squared distribution with $n-1\,\!$ degrees of freedom.

For example, assume that an analyst wants to know if the variance of a population exceeds 1 at a significance level of 0.05. A random sample drawn from the population gives the sample variance as 2. The sample size, $n\,\!$, is 20. The hypothesis test may be conducted as follows:

1) The statements for this hypothesis test may be formulated as:

\begin{align} & {{H}_{0}}: & {{\sigma }^{2}}=1 \\ & {{H}_{1}}: & {{\sigma }^{2}}\gt 1 \end{align}\,\!

This is a one-sided hypothesis. Here the critical region will lie in the right tail of the probability distribution.

2) Significance level, $\alpha =0.05\,\!$. Here, the test statistic is based on the chi-squared distribution. Thus for the one-sided hypothesis the critical value is obtained as:

$\chi _{\alpha ,n-1}^{2}=\chi _{0.05,19}^{2}=30.1435\,\!$

This value and the critical regions are shown in the figure below. The analyst would fail to reject ${{H}_{0}}\,\!$ if the test statistic $\chi _{0}^{2}\,\!$ is such that:

$\chi _{0}^{2}\lt \chi _{0.05,19}^{2}\,\!$

3) The value of the test statistic $\chi _{0}^{2}\,\!$ corresponding to the given sample data is:

\begin{align} \chi _{0}^{2} = & \frac{(n-1){{S}^{2}}}{\sigma _{0}^{2}} \\ = & \frac{(20-1)2}{1}=38 \end{align}\,\!

Since $\chi _{0}^{2}\,\!$ is greater than the critical value of 30.1435, ${{H}_{0}}:{{\sigma }^{2}}=1\,\!$ is rejected and it is concluded that at a significance level of 0.05 the population variance exceeds 1.

4) $P\,\!$ value

In this case the $p\,\!$ value is the probability that the test statistic is greater than or equal to 38 (since values greater than 38 are unfavorable to ${{H}_{0}}\,\!$). This probability is determined to be 0.0059.

# Statistical Inference for Two Samples

### Inference on the Difference in Population Means When Variances Are Known

The test statistic used here is based on the standard normal distribution. Let ${{\mu }_{1}}\,\!$ and ${{\mu }_{2}}\,\!$ represent the means of two populations, and $\sigma _{1}^{2}\,\!$ and $\sigma _{2}^{2}\,\!$ their variances, respectively. Let ${{\Delta }_{0}}\,\!$ be the hypothesized difference in the population means and ${{\bar{X}}_{1}}\,\!$ and ${{\bar{X}}_{2}}\,\!$ be the sample means obtained from two samples of sizes ${{n}_{1}}\,\!$ and ${{n}_{2}}\,\!$ drawn randomly from the two populations, respectively. The test statistic can be obtained as:

${{Z}_{0}}=\frac{{{{\bar{X}}}_{1}}-{{{\bar{X}}}_{2}}-{{\Delta }_{0}}}{\sqrt{\frac{\sigma _{1}^{2}}{{{n}_{1}}}+\frac{\sigma _{2}^{2}}{{{n}_{2}}}}}\,\!$

The statements for the hypothesis test are:

\begin{align} & {{H}_{0}}: & {{\mu }_{1}}-{{\mu }_{2}}={{\Delta }_{0}} \\ & {{H}_{1}}: & {{\mu }_{1}}-{{\mu }_{2}}\ne {{\Delta }_{0}} \end{align}\,\!

If ${{\Delta }_{0}}=0\,\!$, then the hypothesis will test for the equality of the two population means.

### Inference on the Difference in Population Means When Variances Are Unknown

If the population variances can be assumed to be equal then the following test statistic based on the $t\,\!$ distribution can be used. Let ${{\bar{X}}_{1}}\,\!$, ${{\bar{X}}_{2}}\,\!$, $S_{1}^{2}\,\!$ and $S_{2}^{2}\,\!$ be the sample means and variances obtained from randomly drawn samples of sizes ${{n}_{1}}\,\!$ and ${{n}_{2}}\,\!$ from the two populations, respectively. The weighted average, $S_{p}^{2}\,\!$, of the two sample variances is:

\begin{align}S_{p}^{2}=\frac{({{n}_{1}}-1)S_{1}^{2}+({{n}_{2}}-1)S_{2}^{2}}{{{n}_{1}}+{{n}_{2}}-2}\end{align}\,\!

$S_{p}^{2}\,\!$ has ( ${{n}_{1}}\,\!$ + ${{n}_{2}}\,\!$ -- 2) degrees of freedom. The test statistic can be calculated as:

\begin{align}{{T}_{0}}=\frac{{{{\bar{X}}}_{1}}-{{{\bar{X}}}_{2}}-{{\Delta }_{0}}}{{{S}_{p}}\sqrt{\frac{1}{{{n}_{1}}}+\frac{1}{{{n}_{2}}}}}\end{align}\,\!

${{T}_{0}}\,\!$ follows the $t\,\!$ distribution with (${{n}_{1}}\,\!$ + ${{n}_{2}}\,\!$ -- 2) degrees of freedom. This test is also referred to as the two-sample pooled $t\,\!$ test. If the population variances cannot be assumed to be equal then the following test statistic is used:

\begin{align}T_{0}^{*}=\frac{{{{\bar{X}}}_{1}}-{{{\bar{X}}}_{2}}-{{\Delta }_{0}}}{\sqrt{\frac{S_{1}^{2}}{{{n}_{1}}}+\frac{S_{2}^{2}}{{{n}_{2}}}}}\end{align}\,\!

$T_{0}^{*}\,\!$ follows the $t\,\!$ distribution with $\upsilon\,\!$ degrees of freedom. $\upsilon\,\!$ is defined as follows:

\begin{align}\upsilon =\frac{{{\left( \frac{S_{1}^{2}}{{{n}_{1}}}+\frac{S_{2}^{2}}{{{n}_{2}}} \right)}^{2}}}{\frac{{{\left( S_{1}^{2}/{{n}_{1}} \right)}^{2}}}{{{n}_{1}}+1}+\frac{{{\left( S_{2}^{2}/{{n}_{2}} \right)}^{2}}}{{{n}_{2}}+1}}-2\end{align}\,\!

### Inference on the Variances of Two Normal Populations

The test statistic used here is based on the $F\,\!$ distribution. If $S_{1}^{2}\,\!$ and $S_{2}^{2}\,\!$ are the sample variances drawn randomly from the two populations and ${{n}_{1}}\,\!$ and ${{n}_{2}}\,\!$ are the two sample sizes, respectively, then the test statistic that can be used to test the equality of the population variances is:

${{F}_{0}}=\frac{S_{1}^{2}}{S_{2}^{2}}\,\!$

The test statistic follows the $F\,\!$ distribution with (${{n}_{1}}\,\!$ -- 1) degrees of freedom in the numerator and (${{n}_{2}}\,\!$ -- 1) degrees of freedom in the denominator.

For example, assume that an analyst wants to know if the variances of two normal populations are equal at a significance level of 0.05. Random samples drawn from the two populations give the sample standard deviations as 1.84 and 2, respectively. Both the sample sizes are 20. The hypothesis test may be conducted as follows:

1) The statements for this hypothesis test may be formulated as:

\begin{align} & {{H}_{0}}: & \sigma _{1}^{2}=\sigma _{2}^{2} \\ & {{H}_{1}}: & \sigma _{1}^{2}\ne \sigma _{2}^{2} \end{align}\,\!

It is clear that this is a two-sided hypothesis and the critical region will be located on both sides of the probability distribution.

2) Significance level $\alpha =0.05\,\!$. Here the test statistic is based on the $F\,\!$ distribution. For the two-sided hypothesis the critical values are obtained as:

${{f}_{\alpha /2,{{n}_{1}}-1,{{n}_{2}}-1}}={{f}_{0.025,19,19}}=2.53\,\!$

and

${{f}_{1-\alpha /2,{{n}_{1}}-1,{{n}_{2}}-1}}={{f}_{0.975,19,19}}=0.40\,\!$

These values and the critical regions are shown in the figure below. The analyst would fail to reject ${{H}_{0}}\,\!$ if the test statistic ${{F}_{0}}\,\!$ is such that:

${{f}_{1-\alpha /2,{{n}_{1}}-1,{{n}_{2}}-1}}\le {{F}_{0}}\le {{f}_{\alpha /2,{{n}_{1}}-1,{{n}_{2}}-1}}\,\!$

or

$0.40\le {{F}_{0}}\le 2.53\,\!$

3) The value of the test statistic ${{F}_{0}}\,\!$ corresponding to the given data is:

\begin{align} {{F}_{0}}= & \frac{S_{1}^{2}}{S_{2}^{2}} \\ = & \frac{{{1.84}^{2}}}{{{2}^{2}}} \\ = & 0.8464 \end{align}\,\!

Since ${{F}_{0}}\,\!$ lies in the acceptance region, the analyst fails to reject ${{H}_{0}}:\sigma _{1}^{2}=\sigma _{2}^{2}\,\!$ at a significance level of 0.05.