Skip to content

Instantly share code, notes, and snippets.

@yalla
Created February 25, 2016 15:13
Show Gist options
  • Save yalla/35f50d0d119c34b6a789 to your computer and use it in GitHub Desktop.
Save yalla/35f50d0d119c34b6a789 to your computer and use it in GitHub Desktop.
simuruns <- 5000;
diameter <- rnorm(simuruns, mean=0.8, sd=0.003);
strokelength <- rnorm(simuruns, mean=2.5, sd=0.15);
rpm <- 9.5;
desired_mean <- 12;
desired_sd <- 0.2;
simulation <- pi*(diameter/2)^2 * strokelength * rpm;
par(mfrow=c(2,1));
hist(simulation, breaks=100);
boxplot(simulation, horizontal = TRUE);
abline(v=(desired_mean - desired_sd), col="green");
abline(v=(desired_mean + desired_sd), col="green");
abline(v=mean(simulation)-sd(simulation), col="red");
abline(v=mean(simulation)+sd(simulation), col="red");
summary(simulation);
sd(simulation);
sd(simulation)<=desired_sd;
t.test(simulation);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment