MATH 335: Estimating the uniform parameter simulation


reps <- 10000 
theta <- 3 # anything will do for your choice of theta
n <- 5
data <- t(replicate(reps,runif(n,0,theta)))
results.mle <- apply(data,1,max)
results.mom <- 2*apply(data,1,mean)

par(mfrow=c(1,2))

hist(results.mle,xlim=c(0,6))
hist(results.mom,xlim=c(0,6))