# NOT RUN {
Design <- createDesign(sample_size = c(30, 60, 90, 120),
group_size_ratio = c(1, 4, 8),
standard_deviation_ratio = c(.5, 1, 2))
Generate <- function(condition, fixed_objects = NULL) {
N <- condition$sample_size
grs <- condition$group_size_ratio
sd <- condition$standard_deviation_ratio
if(grs < 1){
N2 <- N / (1/grs + 1)
N1 <- N - N2
} else {
N1 <- N / (grs + 1)
N2 <- N - N1
}
group1 <- rnorm(N1)
group2 <- rnorm(N2, sd=sd)
dat <- data.frame(group = c(rep('g1', N1), rep('g2', N2)), DV = c(group1, group2))
dat
}
Analyse <- function(condition, dat, fixed_objects = NULL) {
welch <- t.test(DV ~ group, dat)
ind <- t.test(DV ~ group, dat, var.equal=TRUE)
# In this function the p values for the t-tests are returned,
# and make sure to name each element, for future reference
ret <- c(welch = welch$p.value, independent = ind$p.value)
ret
}
Summarise <- function(condition, results, fixed_objects = NULL) {
#find results of interest here (e.g., alpha < .1, .05, .01)
ret <- EDR(results, alpha = .05)
ret
}
# test that it works
# Final <- runSimulation(design=Design, replications=5,
# generate=Generate, analyse=Analyse, summarise=Summarise)
# print code to console
SimShiny(design=Design, generate=Generate, analyse=Analyse,
summarise=Summarise, verbose=FALSE)
# save shiny code to file
SimShiny('app.R', design=Design, generate=Generate, analyse=Analyse,
summarise=Summarise, verbose=FALSE)
# run the application
shiny::runApp()
shiny::runApp(launch.browser = TRUE) # in web-browser
# }
Run the code above in your browser using DataLab