# R program to simulate distribution of ML estimates from # a Poisson distribution. lambda=2 # True value of lambda. n=10 # Sample size to use in simulations. nsim=1000 # Number of simulations. lambdahat=numeric(nsim) # Vector of zeros. for (i in 1:nsim) { lambdahat[i]=mean(rpois(n,lambda)) # Loop to fill lambdahat vector # with ML estimates of lambda. } hist(lambdahat) # Histogram of ML estimates.