0
votes

I don't know how to write the code to generate 1000 experiments of a uniform random variable between 0 and 10 with 10 data points such that it counts and returns to me how many times twice the mean of the sample points is greater than 10 and was hoping for some help with it. Thank you

1

1 Answers

1
votes
results <- rep(x=0,times=1000)
for(i in 1:1000) {
  dat <- runif(n=10,min=0,max=10)
  if(mean(dat) >= 5) {
    results[[i]] <- 1
  }
}
sum(results)