Skip to content
R for the Rest of Us Logo

Inferential Statistics with R

Violated Assumptions

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

Try the various transformations on the age variable. Do any of them improve the normality of the variable? Test using the shapiro_test() function as you learned in the “Testing assumptions” lesson.

Learn More

Read more about the Winsorize() function in the DescTools package.

Read more about applying transformations in R.

Read more about performing the non-parametric equivalent statistics in the rstatix package:

  • wilcox_test() as the non-parametric equivalent of the independent samples t-test (note: this is synonymous of the Mann-Whitney U test)

  • sign_test() as the non-parametric equivalent of the dependent samples t-test

  • kruskall_test() as the non-parametric equivalent of the one-way ANOVA

  • friedman_test() as the non-parametric equivalent of the one-way repeated measures ANOVA

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

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

Mike LeVan

Mike LeVan • January 9, 2025

Hi,

Sorry to be a pain. I am getting an error with the Winsorize example. I have entered the same command but am getting this :

Error in mutate(): ℹ In argument: iq = DescTools::Winsorize(iq, minval = 84, maxval = 125). Caused by error in DescTools::Winsorize(): ! unused arguments (minval = 84, maxval = 125) Run rlang::last_trace() to see where the error occurred.

Backtrace: ▆

  1. ├─college %>% select(id, iq) %>% arrange(iq) %>% ...
  2. ├─dplyr::mutate(., iq = DescTools::Winsorize(iq, minval = 84, maxval = 125))
  3. └─dplyr:::mutate.data.frame(., iq = DescTools::Winsorize(iq, minval = 84, maxval = 125))
  4. └─dplyr:::mutate_cols(.data, dplyr_quosures(...), by)
  5. ├─base::withCallingHandlers(...)
    
  6. └─dplyr:::mutate_col(dots[[i]], data, mask, new_columns)
    
  7.   └─mask$eval_all_mutate(quo)
    
  8.     └─dplyr (local) eval()
    

Run rlang::last_trace(drop = FALSE) to see 3 hidden frames.

Thanks for any insights, Mike

Dana Linnell

Dana Linnell • January 13, 2025

What version of DescTools do you have? I just installed the latest version of it and I'm having no issues running this code:

college %>% select(id, iq) %>% arrange(iq) %>% mutate(iq = DescTools::Winsorize(iq, minval = 84, maxval = 125))

Dana Linnell

Dana Linnell • January 13, 2025

What version of DescTools do you have? I just installed the latest version of it and I'm having no issues running this code:

college %>% select(id, iq) %>% arrange(iq) %>% mutate(iq = DescTools::Winsorize(iq, minval = 84, maxval = 125))