Statistics How To

Hypothesis Testing

Contents (Click to skip to the section):

  1. Critical Values (new page — opens in new window)
  2. Hypothesis Testing
  3. What is a Hypothesis?
  4. What is Hypothesis Testing?
  5. Hypothesis Testing Examples (One Sample Z Test).
  6. Hypothesis Test on a Mean (TI 83).
  7. Bayesian Hypothesis Testing.
  8. More Hypothesis Testing Articles

Hypothesis Testing


critical valuesThe main purpose of statistics is to test a hypothesis. For example, you might run an experiment and find that a certain drug is effective at treating headaches. But if you can’t repeat that experiment, no one will take your results seriously. A good example of this was the cold fusion discovery, which petered into obscurity because no one was able to duplicate the results.

What is a Hypothesis?

What is a Hypothesis

Andreas Cellarius hypothesis, showing the planetary motions.


A hypothesis is an educated guess about something in the world around you. It should be testable, either by experiment or observation. For example:

  • A new medicine you think might work.
  • A way of teaching you think might be better.
  • A possible location of new species.
  • A fairer way to administer standardized tests.

It can really be anything at all as long as you can put it to the test.

What is a Hypothesis Statement?

If you are going to propose a hypothesis, it’s customary to write a statement. Your statement will look like this:
“If I…(do this to an independent variable)….then (this will happen to the dependent variable).”
For example:

  • If I (decrease the amount of water given to herbs) then (the herbs will increase in size).
  • If I (give patients counseling in addition to medication) then (their overall depression scale will decrease).
  • If I (give exams at noon instead of 7) then (student test scores will improve).
  • If I (look in this certain location) then (I am more likely to find new species).

A good hypothesis statement should:

  • Include an “if” and “then” statement (according to the University of California).
  • Include both the independent and dependent variables.
  • Be testable by experiment, survey or other scientifically sound technique.
  • Be based on information in prior research (either yours or someone else’s).
  • Have design criteria (for engineering or programming projects).

What is Hypothesis Testing?

hypothesis testing
Hypothesis testing in statistics is a way for you to test the results of a survey or experiment to see if you have meaningful results. You’re basically testing whether your results are valid by figuring out the odds that your results have happened by chance. If your results may have happened by chance, the experiment won’t be repeatable and so has little use.

Hypothesis testing can be one of the most confusing aspects for students, mostly because before you can even perform a test, you have to know what your null hypothesis is. Often, those tricky word problems that you are faced with can be difficult to decipher. But it’s easier than you think; all you need to do is:

  1. Figure out your null hypothesis,
  2. State your null hypothesis,
  3. Choose what kind of test you need to perform,
  4. Either accept or reject the null hypothesis.

What is the Null Hypothesis?

If you trace back the history of science, the null hypothesis is always the accepted fact. Simple examples of null hypotheses that are generally accepted as being true are:

  1. DNA is shaped like a double helix.
  2. There are 8 planets in the solar system (excluding Pluto).
  3. Taking Vioxx can increase your risk of heart problems (a drug now taken off the market).

How do I State the Null Hypothesis?

You won’t be required to actually perform a real experiment or survey in elementary statistics (or even disprove a fact like “Pluto is a planet”!), so you’ll be given word problems from real-life situations. You’ll need to figure out what your hypothesis is from the problem. This can be a little trickier than just figuring out what the accepted fact is. With word problems, you are looking to find a fact that is nullifiable (i.e. something you can reject).

Hypothesis Testing Examples #1: Basic Example

A researcher thinks that if knee surgery patients go to physical therapy twice a week (instead of 3 times), their recovery period will be longer. Average recovery times for knee surgery patients is 8.2 weeks.

The hypothesis statement in this question is that the researcher believes the average recovery time is more than 8.2 weeks. It can be written in mathematical terms as:
H1: μ > 8.2

Next, you’ll need to state the null hypothesis (See: How to state the null hypothesis). That’s what will happen if the researcher is wrong. In the above example, if the researcher is wrong then the recovery time is less than or equal to 8.2 weeks. In math, that’s:
H0 μ ≤ 8.2

Rejecting the null hypothesis

Ten or so years ago, we believed that there were 9 planets in the solar system. Pluto was demoted as a planet in 2006. The null hypothesis of “Pluto is a planet” was replaced by “Pluto is not a planet.” Of course, rejecting the null hypothesis isn’t always that easy — the hard part is usually figuring out what your null hypothesis is in the first place.

Hypothesis Testing Examples (One Sample Z Test)

The one sample z test isn’t used very often (because we rarely know the actual population standard deviation). However, it’s a good idea to understand how it works as it’s one of the simplest tests you can perform in hypothesis testing. In English class you got to learn the basics (like grammar and spelling) before you could write a story; think of one sample z tests as the foundation for understanding more complex hypothesis testing. This page contains two hypothesis testing examples for one sample z-tests.

One Sample Hypothesis Testing Examples: #2


A principal at a certain school claims that the students in his school are above average intelligence. A random sample of thirty students IQ scores have a mean score of 112. Is there sufficient evidence to support the principal’s claim? The mean population IQ is 100 with a standard deviation of 15.

Step 1: State the Null hypothesis. The accepted fact is that the population mean is 100, so: H0: μ=100.

Step 2: State the Alternate Hypothesis. The claim is that the students have above average IQ scores, so:
H1: μ > 100.
The fact that we are looking for scores “greater than” a certain point means that this is a one-tailed test.

Step 3: Draw a picture to help you visualize the problem.


hypothesis testing examples

Step 4: State the alpha level. If you aren’t given an alpha level, use 5% (0.05).

Step 5: Find the rejection region area (given by your alpha level above) from the z-table. An area of .05 is equal to a z-score of 1.645.

Step 6: Find the test statistic using this formula: z score formula
For this set of data: z= (112.5-100) / (15/√30)=4.56.

Step 6: If Step 6 is greater than Step 4, reject the null hypothesis. If it’s less than Step 4, you cannot reject the null hypothesis. In this case, it is greater, so you can reject the null.

One Sample Hypothesis Testing Examples: #3

Blood glucose levels for obese patients have a mean of 100 with a standard deviation of 15. A researcher thinks that a diet high in raw cornstarch will have a positive or negative effect on blood glucose levels. A sample of 30 patients who have tried the raw cornstarch diet have a mean glucose level of 140. Test the hypothesis that the raw cornstarch had an effect.

Step 1: State the null hypothesis: H0:μ=100
Step 2: State the alternate hypothesis: H1:≠100
Step 3: State your alpha level. We’ll use 0.05 for this example. As this is a two-tailed test, split the alpha into two.
0.05/2=0.025
Step 4: Find the z-score associated with your alpha level. You’re looking for the area in one tail only. A z-score for 0.75(1-0.025=0.975) is 1.96. As this is a two-tailed test, you would also be considering the left tail (z=1.96)
Step 5: Find the test statistic using this formula: z score formula
z=(140-100)/(15/√30)=14.60.
Step 6: If Step 5 is less than -1.96 or greater than 1.96 (Step 3), reject the null hypothesis. In this case, it is greater, so you can reject the null.

*This process is made much easier if you use a TI-83 or Excel to calculate the z-score (the “critical value”).
See:

Hypothesis Testing Examples: Mean (Using TI 83)

You can use the TI 83 calculator for hypothesis testing, but the calculator won’t figure out the null and alternate hypotheses; that’s up to you to read the question and input it into the calculator.

Sample problem: A sample of 200 people has a mean age of 21 with a population standard deviation (σ) of 5. Test the hypothesis that the population mean is 18.9 at α = 0.05.

Step 1: State the null hypothesis. In this case, the null hypothesis is that the population mean is 18.9, so we write:
H0: μ = 18.9

Step 2: State the alternative hypothesis. We want to know if our sample, which has a mean of 21 instead of 18.9, really is different from the population, therefore our alternate hypothesis:
H1: μ ≠ 18.9

Step 3: Press Stat then press the right arrow twice to select TESTS.

Step 4: Press 1 to select 1:Z-Test…. Press ENTER.

Step 5: Use the right arrow to select Stats.

Step 6: Enter the data from the problem:
μ0: 18.9
σ: 5
x: 21
n: 200
μ: ≠μ0

Step 7: Arrow down to Calculate and press ENTER. The calculator shows the p-value:
p = 2.87 × 10-9

This is smaller than our alpha value of .05. That means we should reject the null hypothesis.

Bayesian Hypothesis Testing: What is it?

bayesian hypothesis testing

Image: Los Alamos National Lab.


Bayesian hypothesis testing helps to answer the question: Can the results from a test or survey be repeated?
Why do we care if a test can be repeated? Let’s say twenty people in the same village came down with leukemia. A group of researchers find that cell-phone towers are to blame. However, a second study found that cell-phone towers had nothing to do with the cancer cluster in the village. In fact, they found that the cancers were completely random. If that sounds impossible, it actually can happen! Clusters of cancer can happen simply by chance. There could be many reasons why the first study was faulty. One of the main reasons could be that they just didn’t take into account that sometimes things happen randomly and we just don’t know why.

P Values.

It’s good science to let people know if your study results are solid, or if they could have happened by chance. The usual way of doing this is to test your results with a p-value. A p value is a number that you get by running a hypothesis test on your data. A P value of 0.05 (5%) or less is usually enough to claim that your results are repeatable. However, there’s another way to test the validity of your results: Bayesian Hypothesis testing. This type of testing gives you another way to test the strength of your results.

Bayesian Hypothesis Testing.

Traditional testing (the type you probably came across in elementary stats or AP stats) is called Non-Bayesian. It is how often an outcome happens over repeated runs of the experiment. It’s an objective view of whether an experiment is repeatable.
Bayesian hypothesis testing is a subjective view of the same thing. It takes into account how much faith you have in your results. In other words, would you wager money on the outcome of your experiment?

Differences Between Traditional and Bayesian Hypothesis Testing.

Traditional testing (Non Bayesian) requires you to repeat sampling over and over, while Bayesian testing does not. The main different between the two is in the first step of testing: stating a probability model. In Bayesian testing you add prior knowledge to this step. It also requires use of a posterior probability, which is the conditional probability given to a random event after all the evidence is considered.

Arguments for Bayesian Testing.

Many researchers think that it is a better alternative to traditional testing, because it:

  1. Includes prior knowledge about the data.
  2. Takes into account personal beliefs about the results.

Arguments against.

  1. Including prior data or knowledge isn’t justifiable.
  2. It is difficult to calculate compared to non-Bayesian testing.

Back to top

Hypothesis Testing Articles


Basics:

  1. What is a Rejection Region?
  2. What is a Two Tailed Test?
  3. How to Decide if a Hypothesis Test is a One Tailed Test or a Two Tailed Test.
  4. How to Decide if a Hypothesis is a Left Tailed Test or a Right-Tailed Test.
  5. How to State the Null Hypothesis in Statistics.
  6. How to Find a Critical Value.
  7. How to Support or Reject a Null Hypothesis.

Specific Tests:

  1. ANOVA.
  2. F Value in ANOVA: When to reject the null.
  3. F Test: What is it?
  4. The two tailed F Test.
  5. F Test to Compare Two Variances.
  6. Granger Causality Test.
  7. KPSS Test.
  8. What is a Likelihood-Ratio Test?
  9. MANCOVA
  10. Sequential Probability Ratio Test
  11. How to Run a Sign Test.
  12. T Test: one sample.
  13. T-Test: Two sample.
  14. Welch’s ANOVA.
  15. Welch’s Test for Unequal Variances.
  16. Z-Test: one sample.
  17. Z Test: Two Proportion
  18. Wald Test.

Related Articles:

  1. How to calculate the Least Significant Difference.
  2. What is a Standardized Test Statistic?
  3. Standardized values: Example.
  4. Degrees of Freedom.
  5. How to Find Standard Error
  6. How to Calculate Chebyshev’s Theorem.
  7. Mean Difference (Difference in Means)
  8. How to Find a Sample Size (General Instructions).
  9. Levels in Statistics.
  10. How to Calculate Margin of Error.
  11. How to Calculate a Z-Score.
  12. How to Calculate a T-Score.
  13. What is the Neyman-Pearson Lemma?
  14. Testing a Single Mean.
  15. Unequal Sample Sizes.
  16. The Multiple Testing Problem.
  17. T-Score Vs. a Z.Score.
  18. Uniformly Most Powerful Tests.
Hypothesis Testing was last modified: January 31st, 2017 by Andale

20 thoughts on “Hypothesis Testing

  1. Andale Post author

    No, they are different. A z-score is something you find in a table. A z-test uses a z-score and is part of a hypothesis test. See

  2. Jason Shorten

    I cant figure out what test to do for my dissertation.
    I have tested and counted 4 areas;
    1. I counted the number of ewes who went into parturition per hour between 1900 – 0700 during the night for 30 days. This is the most important for me as I’m trying to see if ewes enter parturition at a set point in the night or not.
    2. During the 12 hours I also tested light levels per hour for 30 days and I don’t know what test to do to find or not find a relation between light levels and ewes entering parturition. I want to prove or disprove cause and effect.
    3. I also have done this for temperature and humidity (both individually) to see if they effect ewes entering parturition.

    No-one I know can figure out which statistical test(s) I can do with the results, basically I have 4 tables of data that I tested for 12 hours (Once an hour eg 1900 – 1959, 2000 – 2059 etc…) for 30 days.
    The light levels, humidity levels and temperature I need to compare with the ewes entering parturition data, I’ve calculated the means and standard deviation but, I get mixed results when I then run an ANVOVA test, t test two sample assuming equal variances and an f test two sampled for variances

    Any help or hints would be a massive help!

    Watched the youtube videos too but I think this might be more complicated than the basics!

    Many thanks!

  3. hetal

    Hello, my significant level is 10% (0.10) and my p value for 2 independent variable (after running a wald test) is 0.0000 so how can I interpret this?

  4. Andale Post author

    You have a tiny p-value (it’s probably 0.000021 or some other small number). You can reject the null.

  5. Krista

    Im having a hard time answer a problem. The genetics and IV I situate conduct a clinical trial of the YOSORT method designed to increase the probability of a boy and 239 of them were Boyd’s. Use a 0.01 significance level to test the claim that the YOSORT method is effective in increasing the like hood that a baby will be a boy . I have to identify the null hypothesis, alternative hypothesis, test status is, p-value or critical value .

    I can remember how to figure the critical value I’m suing the formula P hat -p/pqn

    Can you please help me

  6. Andale Post author

    Krista,
    I’m not sure what your question is. You list quite a few (identify null, alternate, test status, p-value or critical). Are you having trouble identifying the null and alternate hypotheses? Or is it that you don’t know what test to run?
    BTW: both the critical value and p-value will give you the same results. I’d just choose one and go from there.
    Stephanie

  7. Kim

    I have a question about critical value and t-value. If your critical value is 2.412 and your t-value is -3.68 (p<0.01), isn't this not considered significant because in a one-tailed test it is in the wrong tail, and it can't be a two-tailed test because it only lists the critical value as a positive number? I am trying to complete a problem but am stuck on this point. Should I just consider the absolute value of the critical value and t-value?
    Thanks!

  8. Andale Post author

    Your critical value is 2.412, which cuts off the right tail. Any t-value greater than 2.412 is going to be significant. As your t-value is -3.68, that’s not significant. You can’t use the absolute value, as this is not a two-tailed test. I would double check your data though! Also, you say that ” it can’t be a two-tailed test because it only lists the critical value as a positive number?”. The critical value doesn’t determine what tailed test it is: your hypothesis does that (i.e. “Is such and such equal to or greater than or less than”).

  9. Kim

    Thank you for your response. The problem I was completing gave us the data (critical value 2.412, t- value -3.68, p-value <0.01) wanted us to create the null and alternative hypothesis and analyze the data for significance. I was confused on how to write the hypotheses because the critical value was positive and the t-value was negative.

  10. Andale Post author

    The null for a test might be “the mean is equal to 0” and the alternate might be “the mean is not equal to zero”. I can’t see how you would be able to formulate a null/alternate from the test values. Were you given any other information in the question?

Leave a Reply

Your email address will not be published. Required fields are marked *