I am a newbie in R programming: I am using the below R code using runif() and rbern() to follow the generative recipe from the diagram below that will generate 4000 draws (i.e. realizations) of the "C" random variable representing the processing time of an individual car. Of the 4,000 draws you have generated, **what percentage of the draws have a car processing time GREATER than 6 minutes?
I am testing just using 4 draws and I am able to select a single value of C which is the maximum of the 4 draws. I am not sure how I can calculate the percentage =1/4 =0.25 in the below output
. Can someone please suggest?
[1] "Result=5.25363306910731"
[1] "Result=5.26856829319149"
[1] "Result=6.4678559161257"
[1] "Result=5.27019506809302"
Code:
library("tidyverse")
set.seed(222)
for (i in 1:4) {
rainTime = runif(n=4, min=1, max = 2)
Wash = runif(n=4, min=2, max=3)
A=Wash
preWash = runif(n=4, min=1, max=2)
B=preWash
rainFlag = rbern(4, 0.5)
x = rainFlag*rainTime
C=A+B+x
result =max(C)
outputMessage = paste0("Result=", result)
print(outputMessage)
}