# NOT RUN {
# modified example from runSimulation()
Design <- createDesign(N = c(10, 20),
SD = c(1, 2))
Generate <- function(condition, fixed_objects = NULL) {
dat <- with(condition, rnorm(N, 10, sd=SD))
dat
}
Analyse <- function(condition, dat, fixed_objects = NULL) {
ret <- mean(dat) # mean of the sample data vector
ret
}
Summarise <- function(condition, results, fixed_objects = NULL) {
ret <- c(mu=mean(results), SE=sd(results)) # mean and SD summary of the sample means
ret
}
Final1 <- runSimulation(design=Design, replications=1000,
generate=Generate, analyse=Analyse, summarise=Summarise)
Final1
###
# later decide that N = 30 should have also been investigated. Rather than
# running the following object ....
newDesign <- createDesign(N = c(10, 20, 30),
SD = c(1, 2))
# ... only the new subset levels are executed to save time
subDesign <- subset(newDesign, N == 30)
subDesign
Final2 <- runSimulation(design=subDesign, replications=1000,
generate=Generate, analyse=Analyse, summarise=Summarise)
Final2
# glue results together by row into one object as though the complete 'Design'
# object were run all at once
Final <- rbind(Final1, Final2)
Final
summary(Final)
# }
Run the code above in your browser using DataLab