View source: R/plot_powercurves.R
plot_powercurves | R Documentation |
Internal function, called by test_twoway_nrange, to plot power against sample size.
plot_powercurves(
power_over_nrange,
target_power = NULL,
title = NULL,
target_line = TRUE,
alpha_line = TRUE,
alpha = 0.05
)
power_over_nrange |
data.frame with sample sizes and corresponding powers to be plotted |
target_power |
Numeric. Desired power to be attained. Accepts values between 0 and 1, defaults to 0.8. |
title |
Character. Title for the graph. Defaults to 'Power curve from exact ANOVA test' |
target_line |
Logical. If FALSE no target line will be drawn. Overrides target_power. Default is TRUE. |
alpha_line |
Logical. Should a dashed line at the set alpha level be drawn. Default is TRUE. |
alpha |
Numeric. Type I error rate. |
Plot with power curves.
## 'cornorm_model' is created with the calculate_mean_matrix function
refmean <- 10
treateff <- 1.2
timeeff <- 0.75
treatgroups <- 3
treatgroups_names <- c("wt", "DrugA", "DrugB")
timepoints <- 4
timepoints_names <- paste0("t", 1:timepoints)
nameslist <- list(treatment=treatgroups_names, time=timepoints_names)
rho = 0.7
cornorm_model <- calculate_mean_matrix(refmean = refmean, fAeffect = treateff, fBeffect = timeeff,
nlfA = treatgroups, nlfB = timepoints,
rho = rho, withinf = "fB", label_list = nameslist)
nset <- seq(7, 14, 2)
cornorm_sim <- simulate_twoway_nrange(cornorm_model, nset, repeated_measurements=TRUE, nsims=5)
##used small number of iterations to reduce computation time
power_results <- test_power_overkn(cornorm_sim, test="rank", plot=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.