Skip to content

Instantly share code, notes, and snippets.

@nrkoehler
Created January 6, 2023 12:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nrkoehler/339191b6acaf5e5ef8365e9d8ec826b4 to your computer and use it in GitHub Desktop.
Save nrkoehler/339191b6acaf5e5ef8365e9d8ec826b4 to your computer and use it in GitHub Desktop.
report_samplesize_t.test <- function(pwr, drop_out){
n_raw <- ceiling(pwr$n)
n_total <- (n_raw + ceiling(n_raw * drop_out))*2
glue::glue("A two-sample t-test to detect a difference of {round(pwr$delta, 1)} l/min between the groups with an SD of {round(pwr$sd, 1)} l/min has power of {pwr$power*100}% if {ceiling(pwr$n)} patients per arm are randomized. Allowing for a drop-out of {drop_out*100}% implies that {n_total} patients need to be randomized in total.")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment