--- output: html_document --- 1. Simulate how power changes across sample sizes for a two-sample t-test. 2. Plot your results (sample size on the x axis, power on the y axis). How does sample size affect power? 3. Abstract the effect size in your experiment into an argument. Simulate and plot how power changes across effect sizes. How does effect size affect power? 4. Compare you power curve with your neighbor's! ```{r} experiment <- function(group_size) { # sample data of group size from each of two groups with different means # return p-value of t-test comparing them } power <- function(group_size) { # run experiment 100 times # return the percentage of experiments that have significant p-values } power_n <- tibble(group_size = 2:200) %>% mutate(power = map_dbl(group_size, power)) ggplot(power_n) # add plot structure power_d <- tibble(d = (1:200)/100) %>% mutate(power = map_dbl(d, ~power(20, .))) ggplot(power_d) # add plot structure ```