Statistics is all about data but data alone is not interesting. It is the interpretation of the data that we are interested in…

The hypothesis test is one of the ways to do this interpretation.

Hypothesis originates from the Greek word hupo (under) and thesis (placing).

  • Using Hypothesis Testing, we try to interpret or draw conclusions about the population using sample data.
  • A Hypothesis Test evaluates two mutually exclusive statements about a population to determine which statement is best supported by the sample data.
  • A hypothesis is a tentative insight into the natural world; a concept that is not yet verified but if true would explain certain facts or phenomena.
  • HYPOTHESIS means assumption,supposition,estimation,presumption… It may be true or false.

Uses of Hypothesis Test

In many research areas, such as medicine, education, advertising, and insurance it is necessary to carry out statistical tests. These tests enable researchers to use the results of their experiments to answer questions such as:

  • Is drug A a more effective treatment for Diabetes than drug B?
  • Does training program T lead to improved staff efficiency?
  • Are the frequencies of large individual private motor insurance claims consistent with a lognormal distribution?

A hypothesis is where we make a statement about something; for example, the mean lifetime of smokers is less than that of non-smokers. A hypothesis test is where we collect a representative sample and examine it to see if our hypothesis holds true.

Terms related to Hypothesis testing

  • Null hypothesis: The null hypothesis ( denoted by Ho) is a statement that the value of a population parameter (such as proportion, mean, or standard deviation) is equal to some claimed value.
  • Alternative hypothesis: Contrary to the null hypothesis, the alternative hypothesis (denoted by H1 or Ha or HA) is the statement that the statistic has a value that somehow differs from the null hypothesis.
  • Level of significance: Refers to the degree of significance in which we accept or reject the null hypothesis. 100% accuracy is not possible for accepting or rejecting a hypothesis, so we, therefore, select a level of significance that is usually 5%.
  • Type I error: When we reject the null hypothesis, although that hypothesis was true. Type I error is denoted by alpha. In hypothesis testing, the normal curve that shows the critical region is called the alpha region.
  • Type II errors: When we accept the null hypothesis but it is false. Type II errors are denoted by beta. In Hypothesis testing, the normal curve that shows the acceptance region is called the beta region.
  • Power: Usually known as the probability of correctly accepting the null hypothesis. (1-beta) is called the power of the analysis.
  • One-tailed test: When the given statistical hypothesis is one value like H0: μ1 = μ2, it is called the one-tailed test.
  • Two-tailed test: When the given statistics hypothesis assumes a less than or greater than value, it is called the two-tailed test.

The testing procedure

The standard approach to carrying out a statistical test involves the following steps:

  • specify the hypothesis to be tested
  • select a suitable statistical model
  • design and carry out an experiment/study
  • calculate a test statistic
  • calculate the probability value
  • determine the conclusion of the test

Test Statistic

The test statistic is a value used in making a decision about the null hypothesis and is found by converting the sample statistic to a score with the assumption that the null hypothesis is true.

We can calculate test statistic like

  • Test statistic for proportions
  • Test statistic for mean
  • Test statistic for variance using the corresponding formulas.

Critical Region

The critical region is that region in the sample space in which if the calculated value lies then we reject the null hypothesis.

Critical Value

A critical value is any value that separates the critical region (where we reject the null hypothesis) from the values of the test statistic that do not lead to the rejection of the null hypothesis. The critical values depend on the nature of the null hypothesis, the sampling distribution that applies, and the significance level 𝞪.

One-tailed and two-tailed Hypothesis Testing

  • If the alternate hypothesis gives the alternate in both directions (less than and greater than) of the value of the parameter specified in the null hypothesis, it is called a Two-tailed test.
  • If the alternate hypothesis gives the alternate in only one direction (either less than or greater than) of the value of the parameter specified in the null hypothesis, it is called a One-tailed test.

Based on the alternative hypothesis, three cases of critical region arise:

Double-tailed test

Left-tailed test

Right-tailed test

Type I and Type II Error

Type I and type II error is one of the most important topics of hypothesis testing. Let’s simplify it.

  • Type I error — when we reject a true null hypothesis.
  • Type II error — when we accept a false null hypothesis.

The probability of committing Type I error (False positive) is equal to the significance level or size of critical region α.

α= P [rejecting H0 when H0 is true]

The probability of committing Type II error (False negative) is equal to the beta β. It is called the ‘power of the test’.

β = P [not rejecting H0 when h1 is true]

Level of confidence

  • A level of confidence means how confident we are in taking out decisions.
  • The level of confidence should be more than 95%. Less than 95% of confidence will not be accepted.

Level of significance(α)

  • The significance level (denoted by 𝞪) defines how much evidence we require to reject H0 in favor of HA.
  • It is the probability of a type 1 error. It is also the size of the critical region.
  • If H0 is not rejected at a significance level of 5%, then one can say that our null hypothesis is true with 95% assurance.

P-value

The P-value (or p-value or probability value) is the probability of getting a value of the test statistic that is at least as extreme as the one representing the sample data, assuming that the null hypothesis is true. The null hypothesis is rejected if the P-value is very small, such as 0.05 or less.

The p-value is the smallest level of significance at which a null hypothesis can be rejected.

That’s why many tests nowadays give a p-value and it is more preferred since it gives out more information than the critical value.

Conclusions in Hypothesis Testing based on P-value

We compare the p-value to the significance level(alpha) for taking a decision on the Null Hypothesis.

  • If the p-value is greater than alpha, we do not reject the null hypothesis.
  • If the p-value is smaller than alpha, we reject the null hypothesis.

Power of a hypothesis test

The power of a hypothesis test is the probability (1 — 𝛽 ) of rejecting a false null hypothesis, which is computed by using a particular significance level 𝞪 and a particular value of the population parameter that is an alternative to the value assumed true in the null hypothesis. That is, the power of the hypothesis test is the probability of supporting an alternative hypothesis that is true.

This is all about Hypothesis testing.

Aspiring Data Scientist | Machine Learning | NLP | Time Series | Python, Tableau & SQLExpert | Storyteller | Blogger | Data Science Trainee at AlmaBetter