Skip to content
What's New in R is a weekly email to help you up your R game. Sign up →
R for the Rest of Us Logo

Inferential Statistics with R

Dependent t-test

Transcript

Click on the transcript to go to that point in the video. Please note that transcripts are auto generated and may contain minor inaccuracies.

Your Turn

  1. Perform a dependent samples t-test to test whether there is a difference in exam scores: exam_1 and exam_2. Is there a difference? What is the p-value?

  2. Perform a dependent samples t-test to test whether there is a difference in act_science and act_mathematics scores. Is there a difference? What is the p-value?

Don’t forget: You’ll need to make your data long before running your t-test.

Learn More

We are using the rstatix package for the t_test() function (and other functions in later lessons). We use this package because it is tidyverse-friendly while some base R functions for inferential statistics are not. If you did want to use the base R equivalent function for a t-test, it is t.test().

For the dependent t-test using the t_test() function, you need to pivot the data set from wide to long using the pivot_longer() function in the tidyr package. Read this vignette for more information on the new pivoting functions.

Have any questions? Put them below and we will help you out!

You need to be signed-in to comment on this post. Login.

soundarya soundararajan

soundarya soundararajan • March 25, 2021

Hi thanks for the great session. I am writing to bring to your kind notice that there is an error in the solution 2. where it reads names_prefix = "weight_", whereas it should read names_prefix="act_"

Thanks!