# Solved – How many times to repeat a simulation

I'm simulating the travel times of trucks moving between two points. The time it takes them to reach their destination is dependent on a few variable so it never the same. I need to compare the simulated travel times to historical data to show the simulation accurately portrays the real world system.

My question now is how many times do i need to repeat my simulation before I'm able to confidently say my simulation is able to represent the real world system?

Contents

A general idea is that you should repeat the simulation until the results converge. An easy but illustrative example of this is that we want to see if the `R` function `rbinom` is accurate in simulating a coin toss with a given probability. We will simulate one coin toss 10000 times, and plot the percentage of heads against the number of coin tosses:
``set.seed(1) n <- 10000 result <- NULL percent <- NULL for (i in 1:n) {   result[i] <- rbinom(1,1,0.5)   percent[i] <- sum(result)/i } plot(seq(1:10000),percent, type="l") abline(0.5, 0, lty=2) ``