View source: R/test_overseveraln.R
test_power_overkn | R Documentation |
Wrapper to test data simulated under independent or repeated measurements and under different outcome distributions
with different sample sizes. Takes output from simulate_twoway_nrange
as input, along with test and plotting options.
test_power_overkn(
data,
test = "ANOVA",
plot = TRUE,
target_power = NULL,
title = NULL,
target_line = TRUE,
alpha_line = TRUE,
alpha = 0.05
)
data |
data.frame - |
test |
character - Statistical test to be applied, possible values are 'ANOVA', 'rank' and 'permutation'. |
plot |
logical - Should the power curve be plotted. Default is TRUE. |
target_power |
Desired power to be attained. Accepts values between 0 and 1, defaults to 0.8. |
title |
Title for the graph. Defaults to 'Power curve from exact ANOVA test' |
target_line |
Set to TRUE. If FALSE no target line will be drawn. Overrides target_power. |
alpha_line |
|
alpha |
|
Data frame with power and confidence intervals for the main effects and interaction for each of the sample sizes.
Also presented in graphical form if plot=TRUE
.
## In this example we simulate an independent sample design with skewed outcome
## Model was specified with the 'calculate_mean_matrix function' (see ?calculate_mean_matrix)
refmean <- 1
treatgroups <- 4
timepoints <- 5
treateff <- 1.25
timeeff <- 0.85
factors_levels_names <- list(treatment=letters[1:treatgroups], time=1:timepoints)
indep_matrix <- calculate_mean_matrix(refmean = refmean,
fAeffect = treateff, fBeffect = timeeff,
nlfA = treatgroups, nlfB = timepoints,
label_list = factors_levels_names)
indep_skewsim <- simulate_twoway_nrange(indep_matrix, seq(6, 12, 2),
distribution = "skewed", skewness = 1.8, nsims=5)
##used low number of iterations to reduce computation time
test_power_overkn(indep_skewsim, test="rank")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.