## Convert power.htest to something usable (later use broom?) ## z <- as.data.frame(unclass(x)) z <- x single <- nrow(z) == 1L ## let's assume single run for now onesample <- grepl("^One-sample", z$method) ## otherwise two-sample if(onesample) { method <- "one-sample *t* test of a normal mean" } else { method <- "two-sample *t* test of normal means" } txt1 <- paste0( "A total of ", ceiling(z$n) + ceiling(z$n) %% 2, " subjects will be enrolled in this study. Using a ", method, " we have ", trunc(z$power * 100), "% power to detect a treatment effect at a two-sided ", z$sig.level, " significance level, if the true effect is ", z$delta, " ", ifelse(z$delta == 1, "unit", "units"), " different from zero. This is based on the assumption that the standard deviation of the response variable is ", z$sd, "." ) txt2 <- paste0( "A total of ", ceiling(z$n) + ceiling(z$n) %% 2, " subjects will be enrolled in this study. Using a ", method, " we have ", trunc(z$power * 100), "% power to detect a treatment difference at a two-sided ", z$sig.level, " significance level, if the true difference in the response between treatment groups is ", z$delta, " ", ifelse(z$delta == 1, "unit", "units"), ". This is based on the assumption that the standard deviation of the response variable is ", z$sd, "." ) if(onesample) { cat(txt1, "\n") } else { cat(txt2, "\n") }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.