# Code in Assignment #3 for STAT 460/560 # Simulation study in Problem #2 n_1 <- 100 # Prespecifed Sample size theta <- 3 # Prespecified mean of Poisson distribution eta <- exp(-theta) eps <- 0.01 # Prespecified value out_region <- numeric(1000) for (i in 1:1000){ poisson_sample <- rpois(n = n_1, lambda = theta) sample_sum <- sum(poisson_sample) eta_hat <- (1 - 1/n_1)^(sample_sum) # The observed UMVUE for the parameter eta out_region[i] <- (abs(eta_hat - eta) > eps) # Record whether the difference is larger than eps } # Calculate the simulation probability sum(out_region)/1000