19 Basics of Testing of Hypothesis

I K Ravichandra Rao

epgp books

 

 

 

Module Structure

 

Objectives

Summary

 

1.      Introduction

1.1   Why Test Hypothesis?

1.2   Type of Hypothesis and Notation

1.3   Errors in Hypothesis and Testing

1.4   Empirical Test of Hypothesis

2.      Z-test: An Explanation

3.      Procedure Involved in Testing og Hypothesis

4.      Examples with Different Methods

5.      Use of p-Value

6.      Z-test: σ is Unknown

6.1   Procedure for t-Test

7.      Difference between two Populations

8.      Tests about proportions

8.1   Difference between Two Proportions

9.      Tests about Correlation Coefficient

10. Non-Parametric Tests

10.1 Chi-Square Test Degrees of freedom

10.2  Measures of Association

10.3  Goodness-of-Fit Test

11.Conclusion References

 

OBJECTIVES

 

•      To study an overview of testing of hypotheses

•      To study procedure/steps in testing of hypotheses and related concepts

 

SUMMARY

 

Most often, the research process is incomplete without testing of hypotheses. As such there are two types of hypotheses normally referred in statistical testing viz. Null Hypothesis and Alternative Hypothesis. A research process involves:

 

1.      Identify the general problem(s);

2.      Conduct literature search;

3.      Decide the design methodology;

4.      Collect the data either for the population or for a sample;

5.      Analyze the data;

6.      Report the result; and

7.      Refine the hypotheses.

 

It is in step 1, we generally formulate the hypotheses and in step 5, we test the hypotheses. Based on the results of testing of hypotheses, we generalize the results. The Unit 19 discusses basically the z-test, t-test and the Chi Square test.

 

1 INTRODUCTION

 

Statistical analysis aims at inferring about a population based on the information/data contained in a sample. There are methods for making inferences which are usually based on statistical tests of hypotheses. Below we discuss only those aspects concerning testing of hypothesis.

 

A hypothesis is a well-defined statement. However, the word hypothesis in science generally refers to a definite interpretation of a given set of facts, which is put forth as a tentative assumptions and remain partially or wholly unverified. A simple definition of hypothesis as given by Luniberg “is a tentative generalisation, the validity of which remains to be tested. In this context testing of hypothesis, with relevant statistical data becomes important either to accept or reject the tentative assumption

 

1.1 Why Test Hypothesis?

 

Science does not accept anything as valid knowledge, until satisfactory tests confirm its validity. Therefore they need to be tested through research process for their acceptance or rejection. The hypothesis is normally tested by making use of a pre-defined assertion, rule which is applied to sample data and direct the research process in deciding to accept or reject the hypothesis. The process of testing hypothesis embodies the major part of research process. A hypothesis is tested on the basis of facts.

 

1.2  Types of Hypotheses and Notations

 

The two hypotheses in a statistical test are normally referred to as:

 

a)      Null Hypothesis, and

b)     Alternative Hypothesis.

 

a) The Null Hypothesis is a very useful tool in testing the significance of difference. In its simple form, the hypothesis asserts that there is no true difference in the sample and population in particular matter under consideration and that thedifference found is accidental, unimportant, arising out of fluctuations of sampling. A simple definition of hypothesis is that it is a hypothesis which is being tested.

 

b) The Alternative hypothesis specifies those values that the researcher considers to be true, and hopes that the sample data leads to acceptance of this whole hypothesis as true. In other words, when a null hypothesis is rejected, then alternative hypothesis is likely to be accepted. For example,

 

H0: µ = µ0

H1: µ ≠ µ0

where µ is the population mean and µ0 is the hypothesised value of the population mean.

 

1.3  Errors in Hypothesis Testing

 

When accepting or rejecting a null hypothesis, we may commit an error. For instance, we may reject Ho when it is correct; and accept Ho when it is not correct. These two errors are called Type I error and Type II error respectively. The probability of making a Type I error is denoted by α. The probability of making a Type II error is denoted as β. This is shown in the tabular form as below:

 

Conclusion of the Test H0  True H0  False
Accept H0 Correct Wrong (Type II Error)
Reject H0 Wrong (Type I Error) Correct
1.4  Empirical Test of Hypothesis

 

For the purpose of understanding the testing of hypotheses, let us discuss an experimental situation. Consider a condition of verifying the manufacturer’s statement about its product. For example, let us take a case of investigating the container weights specified on the labels of wheat products of the manufacturer. In order to demonstrate the hypothesis testing procedure, let us show how a test on label accuracy could be made for the company’s 2 kg packet of wheat flour.

 

The first assumption is that labels are correct. This assumption or hypothesis is subjected to a test by providing evidence regarding the truth of the claim or assumption. There are three possibilities in the case of 2 k.g. wheat flour packets. It is possible that the mean weight for the population of 2 kg packets could be;

 

i)      ≥ 2 kg or

ii)    ≤  2 kg or

iii)  =  2 kg.

In this situation, we have to determine whether or not the population mean (of wheat flour packets) µ = µ0 (say, 2). How to determine? This is discussed below:

 

A statement like µ = µ0 or µ µ0 or µ µ0 is called a hypothesis. As said in section 1.2, a hypothesis that is being tested is called the Null hypothesis. It is denoted by Ho. The hypothesis that we are willing to accept if we do not accept the null hypothesis is called the Alternative hypothesis. The two hypotheses, the Null Hypothesis (H o) and the Alternative Hypothesis (H1 ) are so constructed that if one is correct the other is wrong. It is denoted by H1 . Generally, the Null Hypothesis and Alternative Hypothesis for testing the mean will be shown in the following forms:

 

Null Hypothesis Alternative Hypothesis
Case 1: H0 : µ µ0 or H1 : µ < µ0
Case 2: H0 : µ µ0 or H1 : µ > µ0
Case 3: H0 : µ = µ0 or H1 : µ ≠ µ0

 

In establishing the critical value for a particular hypothesis testing situation, we always assume that the Ho holds as equality. This allows us to control the maximum probability of Type I error. Thus, in cases 1-3 above, the null hypotheses may be treated as H0: µ = µ0. Now with an assumption that the null hypothesis is true, let us select a sample from the population. If the sample results do not differ significantly from the assumed null hypothesis, we accept H0 as being true. If the sample results differ significantly from the hypothesis, we reject H0 and conclude that the alternate hypothesis H1 is true.

 

2     Z-TEST: AN EXPLANATION

 

In z-test, the distribution of the test statistic under the null hypothesis is approximated by a normal distribution. From the central limit theorem, we know that the sample mean  follows normal distribution with mean µ and standard

 

 

So, while testing a hypothesis, if the computed value of z is greater than | zα/2 | (if α = 0.05, |zα/2| = 1.96), the value of z falls in the critical region. Hence we reject Ho. In other words, if the experiment is conducted a number of times and follow the test procedure mentioned above, it is likely that 5% of the times, we may commit Type I error — rejecting Ho when it should have been accepted. While computing the value of z from the sample data, we may use the sample standard deviation instead of z which is usually unknown.

 

Most often, as mentioned earlier, we test the null hypothesis Ho: µ = µ0 against one of the following alternative hypothesis:

 

1)       H 1 : µ < µ0

2)       H 1 : µ > µ0

3)       H 1 : µ ≠ µ0

 

In such cases, the critical values (±zα or ±zα/2) are given by:

 

Further, if H 1 : µ < µ0 or H 1 : µ > µ0 , the test is also called one-sided test; otherwise, it is called two-sided test. The critical regions for the above three alternative hypotheses are shown in the following figures.

 

 

 

 

2.1 A Confidence Interval Approach to Test a Hypothesis of the Form H0: μ = μ0

H1: μ ≠ μ0

 

 

3     PROCEDURE INVOLVED IN TESTING OF HYPOTHESES

 

The following steps are involved in a test of significance:

 

Step 1: Formulate the null and alternative hypotheses. For example:

a) H0 : μ ≥ μ0 H1 : μ < μ0 or
b) H0 : μ ≤ μ0 H1 : μ > μ0 or
c) H0 : μ = μ0 H1 : μ ≠ μo.

 

Step 2: Fix the value of α; that is, deciding, the level of significance. Usually, we fix α = 0.5 or α = 0.01.

 

4          EXAMPLES WITH DIFFERENT METHODS:

 

a)      Example 1

 

Consider a sample of 36 Units; sample mean ( ) is 2.92 and is 0.18. Test whether H0 : μ ≥ μ0 H1 : μ < μ0; µ0 = 3.

 

Method 1:

 

    Basics of Testing of Hypotheses

 

c = µ0 – zα/2  = 3.0 -2.33*0.03 = 2.93.

 

Since  (= 2.92) < c (2.93), reject H0 that it is µ ≥ 3.

 

Method 2

 

Let α = 0.01 and |zα/2| = 2.57;  = 0.18/ = 0.03. Then

 

5     USE OF P-VALUE

 

In statistical significance testing the p-value is the probability of obtaining a test statistic at least as extreme as the one that was actually observed, assuming that the null hypothesis is true; the p-value is the smallest value of α for which the given sample outcome would lead to accepting H0. The decision rule is to accept H0 if the p-value ≥ α and reject H0 if p- value < α. In the Example 1, above, the p-value is 0.0038 (i.e., P ( > 2.92) which is also equivalent to P(z ≥ 2.66)); the p-value is < α and thus it leads to rejecting H0.

 

6.1

Procedure for t-test

 

Step 1: Formulate the null and alternative hypotheses. For example,

 

a) H0 : μ ≥ μ0 H1 : μ < μ0
b) H0 : μ ≤ μ0 H1 : μ > μ0
c) H0 : μ = μ0 H1 : μ ≠ μ0.

 

Step 2: Decide the level of significance (α) and determine the critical values for a given degree of freedom from the t-table. For (a) and (b), the critical value is given by | tα| such that P(|t| ≤ |tα|)= l – α . For (a), the critical values are given by at | t α / 2 | such that P(t ≤| tα / 2 |)= 1 − α .

 

Step 4: Accept the null hypothesis if t is less than the critical value; otherwise reject the null hypothesis.

 

7.                  Test of Difference between Two Population Means

 

Let us now deal with two populations for which standard deviations (σ1 and σ2) are known. However, the means (µ1 and µ 2) are not known. Under the circumstances, can we test whether or not µ1 = µ 2; i.e., µ1 – µ2 = 0? So in such cases, usually we would like to test

 

Ho : µ1 – µ2 = Do against a specified alternative hypothesis. It may be any one of the following:

 

H1 : µ1 – µ2 ≠ Do

H1 : µ1 – µ2 > Do

H1 : µ1 – µ2 < Do

 

If Do=0, we are actually testing whether or not µ1 = µ2. To test whether or not Ho is true against a specified H1 we consider the difference between x1 and x2 and their distribution in repeated samples. It has been shown in the probability theory that for repeated independent randomly drawn samples, x1 − x2 follows a normal

Thus, we can use the z-test to test the null hypothesis. The procedure is similar to the z-test explained earlier. If X1 and X2 follow normal distributions and if and σ1 and σ2 are unknown, for small samples, we can use the t-test. That is, t-statistic in this case has n1 + n2 – 2 degrees of freedom. However, for large samples, even if σ1 and σ 2 are unknown, we can use the z-test. In this case, we use s1 and s2 instead of σ1 and σ2. That is,

 

8     TESTS ABOUT PROPORTIONS

is a standardized normal variate, wherein p is the proportion of successes in a sample. Hence, to test the null hypothesis, we can use z-test as discussed above. The procedure involved in testing Ho is given below.

 

Step 1: Formulate the null and alternative hypothesis; for instance

 

H o : P = P o  H 1 : P≠ P o

H o : P ≥ P o H 1 : P< P o

H o : P ≤ P o H 1 : P> P o

 

Step 2: Fix the α value and then determine the critical value from the normal distribution table. | Zα/2, | = 1.96 and 2.58 for α = 0.05 and 0.01 respectively. | Zα | = 1.64 and 2.33 for α = 0.05 and 0.01 respectively.

 

Step 3: Compute p and q (= 1p) for the sample data.

 

Step 5: For two-sided test, case (a). That is, reject Ho if |z| > |zα/2|.

For one-sided test, case (b): Reject Ho if z > zα               and

For one-sided test, case (c): Reject Ho if z < – zα

 

8.1 Difference between Two Proportions

 

A general hypothesis that is tested regarding the theoretical proportion of successes (in two sample cases) is that H o 😛 1 – P 2 =P o against a specified alternative hypothesis. The alternative hypothesis may be any one of the following:

 

H1 : P1 – P2 ≠ P0
H1 : P1 – P2 > P0
H1 : P1 – P2 < P0

To test whether or not H o is true against a specified H 1 , we consider the difference P 1 and P 2 and their distribution in repeated samples. It has been shown in the probability theory for repeated independent randomly drawn samples, that P 1 – P 2 follows a normal distribution with mean P 1 – P 2 and variance

 

 

n is the size of the sample, x and y are the sample means of X and Y respectively. sx and s y are the sample standard deviations of X and Y respectively. We may like to test the null hypothesis that ρ = 0 (where ρ is the population correlation coefficient) against a specified alternative hypothesis. We are actually using r to test the hypothesis about ρ since r is an estimate of ρ. The testing is usually done by determining the calculated value of r as significantly different from zero. This can be done by using a t-test. For the purpose of testing the null hypothesis, the follow-ing t-statistic is computed

 

where the t-statistic is with (n—2) degrees of freedom. If the calculated value lies in the critical region, we have to reject the null hypothesis. If we accept the null hypothesis it means that there is no correlation between the two variables other than that due to chance.

 

10  NON-PARAMETRIC TESTS

 

The use of t-test or z-test requires an assumption that the sample data come from a normal or binomial population (or at least, the sample distribution must tend to a normal distribution for a large sample). Both the z-test and t-test are used to test the null hypothesis concerned with population means, variances and proportions. Hypotheses related to the independence of two criteria of classification, goodness-of-fit test, median of the population, etc. can be tested using the statistical tests called non-parametric tests. The non-parametric tests do not require many assumptions (like the z-test and t-test). A non-parametric tests is discussed below.

 

10.1 Chi-Square Test

 

The Chi Square test is normally applicable in situations in which determination of population parameters such as the mean and standard deviation are not an issue. The data in question falling into discrete categories and are presented in a contingency table. The entries in a contingency table are known cells. Let us consider the result of a survey of 100 adults (say, 50 females and 50 males). Let us say that it has been observed that among the 100 adults, 34 of them are library users and the rest are non-users. So, in this hypothetical example, we have two nominal variables sex and library use. On categorizing the 100 adults, using these two nominal variables, we get a contingency table like the one shown in Table below:

 

A Typical 2 x 2 Table

Let us now try to find out whether or not the two categories—gender (Male or Female) and library use—are independent; let us assume that there is no rela-tionship between the gender and library use. Under this assumption, compute the frequencies in each of the cells. Such frequencies are called theoretical frequencies. They are usually referred to as the expected numbers or expected frequencies. The logic for computation of the theoretical frequencies for the data given in the above Table is as follows:

 

We have 50 each of males and females; the ratio is 1:1. So we would expect that half of the library users are males and also half of the non-users are males, that is, out of 100 adults (N) we have 50 males (row total). Out of 34 users (column total), how many of them are males?

 

Using the cross multiplication technique, we have:

The number of male users = 50 × 34 = 17 .

100

 

Similarly, we can compute the number of male non-users, female users and female non-users. The results are shown in bold face in the corresponding cells in Table 8.1. On generalizing the above logic, we can easily prove that the following formula can be used to obtain theoretical frequencies ( E i j ) in each of the cells:

E      =  ri . × c. j

ij                 N

 

ri. is the total number of observations in the ith row

 

cij is the total number of observations in the jth column

 

Eij is the expected/theoretical frequencies in the ijth cell (ith row and jth column).

 

Degree of Freedom

 

Degrees of freedom are commonly discussed in relation to chi- square and other forms of hypothesis testing statistics. It is important to calculate the degree(s) of freedom when determining the significance of a chi square statistic and the validity of the null hypothesis. It is obvious that the theoretical frequencies need not necessarily be equal to the observed frequencies. If they are equal, one could perhaps conclude that there is no relationship between the two variables. If they are not equal, the question is, “Is the difference between the observed and expected frequencies statistically significant?” To answer this question, we use a

 

10.2     Measures of Association

 

The statistical significance of the null hypothesis depends both on the strength of the observed relationship and the size of the sample. Tests of statistical significance indicate only the likelihood that an observed relationship actually exists in the universe; but they do not reveal the fact as to how strong the relationship is. Further, a relationship may be statistically significant being substantially important.

There are a few measures that will describe the strength of the association between two nominal variables. They are:

 

10.3     Goodness-of-Fit Test

 

The chi-square statistic is also used to test the hypothesis that whether or not the probability distribution (of the population) is similar to that of the sample distribution. This type of test is often referred to as a goodness -of-fit test. The goodness-of-fit test is illustrated with following example. Examine whether or not the distribution of transactions follows a negative binomial distribution for the data shown below.

x f(x) x f(x) x f(x)
0 324 3 16 6 2
1 108 4 7 7 1
2 43 5 4

We will use the goodness-of-fit test for this purpose. The procedure is:

 

Step 1: Formulate the null and alternative hypothesis.

 

Ho: The sample data belongs to a population which follows a negative binomial distribution.

 

H1: The sample data belongs to a population which does not follow a negative binomial distribution.

 

Step 2: Compute the parameters (such as mean, variance, etc.); estimate the parameters of the theoretical probability distribution (which is assumed in the null hypothesis). Use, as far as possible, the maximum likelihood estimators.

 

Step 3: Compute the probabilities under the assumption that the Ho is true.

 

Step 4: Compute the theoretical or expected frequencies (use the formula, that expected frequency is equal to nP(x), where n is the sample size, and P(x) is the theoretical probability distribution function). In this case, P(x) is the mass function of the negative binomial distribution.

 

Step 5: Decide α and determine the critical region (for α = 0.05). Find out X2 for (k — 1) degrees of freedom; k is the number of frequency classes.

11. Conclusion

In this Unit, we have discussed the basics of z-test, t-test and chi square test.

you can view video on Basics of Testing of Hypothesis

REFERENCES

 

  • Anderson, David R.; Sweepney, Dennis J; and Williams, Thomas. A. (1981) Statistics for Bussiness and Economics. Edition 2. International Edition. West Publishing Company. SanFrancisco.
  • Ravichandra Rao, I.K. (1983) Quantitative Methods for Library and Information Science. Wiley Eastern. New Delhi.
  • Yule, G.H. and Kendall, M.G. (1950) An introduction to theory of statistics. London, Charles Griffin and Company.