Open rpsychologist opened 4 years ago
It would be useful to be able to use a study setup to calculate power for an ANCOVA or t-test, i.e. we use the assumed DGP but fit an ANCOVA/t-test. For instance, power for an ANCOVA should be:
p <- study_parameters( design = study_design(), n1 = 2, n2 = 10, T_end = 1, icc_pre_subject = c(0.7), var_ratio = NA, sigma_error = 10, cor_subject = 0, effect_size = cohend(0.5) ) n <- p$n2 alpha <- 0.05 delta <- p$effect_size[[1]]$get()$ES # -1 df added because the covariate df <- n * 2 - 2 - 1 r <- get_ICC_pre_subjects(p) sd <- sqrt(1 * (1 - r^2)) lambda <- sqrt(n / 2) * delta / sd power <- pt(qt(1 - alpha / 2, df = df), df = df, ncp = lambda, lower.tail = FALSE) + pt(qt(alpha / 2, df = df), df = df, ncp = lambda)
It would be useful to be able to use a study setup to calculate power for an ANCOVA or t-test, i.e. we use the assumed DGP but fit an ANCOVA/t-test. For instance, power for an ANCOVA should be: