How to do it...

Correcting p-values to account for multiple hypotheses can be done using the following steps:

  1. Run 10,000 t-tests:
set.seed(1)
random_number_t_test <- function(n){
  x <- rnorm(10)
  y <- rnorm(10)
  return(t.test(x,y)$p.value)
}

p_values <- sapply(1:10000, random_number_t_test )
  1. Assess the number of p-values, <= 0.05:
sum(p_values <= 0.05)
  1. Adjust the p-values:
adj_p_values <- p.adjust(p_values, method = "holm")
  1. Re-assess the number of p-values, <= 0.05:
sum(adj_p_values <= 0.05)
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.191.94