Valores exato e estimado (Monte Carlo) dos Erros Quadrático Médio

theta<-11 ; n<-1000 ; m<-1e3
set.seed(21/11/2021)

eqm.MVE <- \(n) 2*theta^2/((n+1)*(n+2))

mat.dados <- replicate(m,runif(n,0,theta))
maximos <- apply(mat.dados,2,max)

est_eqm.MVE <-  mean((maximos - theta)^2)
est_eqm.T   <-  mean(( ((n+1)/n)*maximos - theta)^2)

setNames(c(eqm.MVE(n),est_eqm.MVE,est_eqm.T), c("EQM do MVE ", "Est. EQM do MVE ", "Est. EQM do ENVVUM"))
##        EQM do MVE    Est. EQM do MVE  Est. EQM do ENVVUM 
##       0.0002412757       0.0002664301       0.0001289433

Comparação dos Erros Quadrático Médio

theta<-10
eqm.MVE <- \(n) 2*theta^2/((n+1)*(n+2))

eqm.T <- \(n) theta^2/(n*(n+2))

require(ggplot2)
ggplot()+
  xlim(100,1000)+
  geom_function(fun = eqm.MVE)+
  geom_function(fun = eqm.T,colour = "red")