Get access to all lessons in this course.
Inferential Statistics with R
- Welcome to Inferential Statistics with R
- Introduction to the Dataset
- Independent t-test
- Dependent t-test
- One-Way ANOVA
- Post Hoc Comparisons
- Other ANOVA Tests
- Dealing with Small Cells
- Linear Regression
- Multiple Regression
- Hierarchical Regression
- Extracting Output
- Reporting Results
- Testing Assumptions
- Testing for Normality
- Testing for Homogeneity of Variance
- Violated Assumptions
This lesson is locked
This lesson is called Dependent t-test, part of the Inferential Statistics with R course. This lesson is called Dependent t-test, part of the Inferential Statistics with R course.
Click on the transcript to go to that point in the video. Please note that transcripts are auto generated and may contain minor inaccuracies.
## 1 ## college %>% select(exam_1, exam_2) %>% pivot_longer(cols = everything(), names_to = "exam", values_to = "score", names_prefix = "exam_") %>% t_test(score ~ exam, paired = TRUE) ## 2 ## college %>% select(act_science, act_mathematics) %>% pivot_longer(cols = everything(), names_to = "act_test", values_to = "score", names_prefix = "weight_") %>% t_test(score ~ act_test, paired = TRUE)
Perform a dependent samples t-test to test whether there is a difference in exam scores:
exam_2. Is there a difference? What is the p-value?
Perform a dependent samples t-test to test whether there is a difference in
act_mathematicsscores. 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.
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
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.