# Hypothesis Testing in R

Learn how and when to use hypothesis testing in R, including t-tests, proportion tests, and chi-square tests.

Start Course for Free4 Hours16 Videos53 Exercises

## Create Your Free Account

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.Training 2 or more people?Try DataCamp For Business

## Loved by learners at thousands of companies

## Course Description

## Discover Hypothesis Testing in R

Hypothesis testing lets you ask questions about your datasets and answer them in a statistically rigorous way. In this course, you'll learn how and when to use common tests like t-tests, proportion tests, and chi-square tests.You'll gain a deep understanding of how they work and the assumptions that underlie them. You'll also learn how different hypothesis tests are related using the ""There is only one test"" framework and use non-parametric tests that let you sidestep the requirements of traditional hypothesis tests.

## Learn About T-Tests and Chi-Square Tests

You’ll start by learning why hypothesis testing in R is useful while examining some key concepts as you go. You’ll also learn how t-tests can help you test for differences in means between two groups and how chi-square tests can help you compare observed results with expected results.## Understand the Relationships Between R Hypothesis Tests

As you progress, you’ll discover the relationships between different tests, exploring elements of randomness, independence of observation, and sample sizes.By the time you finish this course, you’ll have a deeper understanding of hypothesis testing in R and when it’s appropriate to use specific tests on your data.

Throughout the course, you'll explore a Stack Overflow user survey and a dataset of late shipments of medical supplies."

For Business

### Training 2 or more people?

Get your team access to the full DataCamp library, with centralized reporting, assignments, projects and more### In the following Tracks

#### Statistician with R

Go To Track- 1
### Introduction to Hypothesis Testing

**Free**Learn why hypothesis testing is useful, and step through the workflow for a one sample proportion test. In doing so, you'll encounter important concepts like z-scores, p-p-values, and false negative and false positive errors. The Stack Overflow survey and late medical shipments datasets are introduced.

Hypothesis tests and z-scores50 xpUses of A/B testing50 xpCalculating the sample mean100 xpCalculating a z-score100 xpp-values50 xpCriminal trials and hypothesis tests50 xpLeft tail, right tail, two tails100 xpCalculating p-values100 xpStatistical significance50 xpDecisions from p-values50 xpCalculating confidence intervals100 xpType I and type II errors100 xp - 2
### Two-Sample and ANOVA Tests

Learn how to test for differences in means between two groups using t-tests, and how to extend this to more than two groups using ANOVA and pairwise t-tests.

Performing t-tests50 xpHypothesis testing workflow100 xpTwo sample mean test statistic100 xpCalculating p-values from t-statistics50 xpWhy is t needed?50 xpThe t-distribution50 xpFrom t to p100 xpPaired t-tests50 xpIs pairing needed?100 xpVisualizing the difference100 xpUsing t.test()100 xpANOVA tests50 xpVisualizing many categories100 xpConducting an ANOVA test100 xpPairwise t-tests100 xp - 3
### Proportion Tests

Learn how to test for differences in proportions between two groups using proportion tests, extended it to more than two groups with chi-square independence tests, and return to the one sample case with chi-square goodness of fit tests.

One-sample proportion tests50 xpt for proportions?50 xpTest for single proportions100 xpTwo-sample proportion tests50 xpTest of two proportions100 xpprop_test() for two samples100 xpChi-square test of independence50 xpThe chi-square distribution50 xpHow many tails for chi-square tests?50 xpPerforming a chi-square test100 xpChi-square goodness of fit tests50 xpVisualizing goodness of fit100 xpPerforming a goodness of fit test100 xp - 4
### Non-Parametric Tests

Learn about the assumptions made by parametric hypothesis tests and see how simulation-based and rank-based non-parametric tests can be used when those assumptions aren't met.

Assumptions in hypothesis testing50 xpCommon assumptions of hypothesis tests50 xpTesting sample size100 xpThe "There is only one test" framework50 xpThere is only one test50 xpSpecifying and hypothesizing100 xpContinuing the infer pipeline50 xpGenerating & calculating100 xpObserved statistic and p-value100 xpNon-parametric ANOVA and unpaired t-tests50 xpSimulation-based t-test100 xpRank sum tests100 xpCongratulations!50 xp

For Business

### Training 2 or more people?

Get your team access to the full DataCamp library, with centralized reporting, assignments, projects and more### In the following Tracks

#### Statistician with R

Go To TrackIn other tracks

Statistics Fundamentals with RDatasets

Late ShipmentsLate shipments Bootstrap DistributionDemocratic Presidential Candidates by CountyStackOverflow SurveyCollaborators

Prerequisites

Sampling in RRichie Cotton

See MoreData Evangelist at DataCamp

Richie is a Data Evangelist at DataCamp. He has been using R since 2004, in the fields of proteomics, debt collection, and chemical health and safety. He has released almost 30 R packages on CRAN and Bioconductor – most famously the assertive suite of packages – as well as creating and contributing to many others. He also has written two books on R programming, Learning R and Testing R Code.

## FAQs

## Join over 14 million learners and start Hypothesis Testing in R today!

## Create Your Free Account

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.