# Problem 4a x <- seq(1, 10, 1) sample(x, 10) # Problem 4b sample(x, 10, replace = TRUE) # Problem 5 trial <- 10000 x <- rep(0, trial) for(i in 1:trial) { x[i] <- sample(1:6, 1) } table(x) # Problem 6 trial <- 10000 x <- rep(0, trial) for(i in 1:trial) { x[i] <- sum(sample(1:6, 3, replace = TRUE)) } oc <- as.data.frame(table(x)) barplot(oc$Freq / trial, names.arg = oc$x) # Problem 8a hist(rnorm(100, 10, 2)) # Problem 8b q <- qnorm(0.05, 10, 2) p <- pnorm(q, 10, 2)