У меня равномерное распределение с параметрами (0, $ \ theta $), и я вычислил его MME и две другие оценки.Я также рассчитал их индивидуальное смещение в моем коде.Но у меня возникли проблемы с правильным построением трех ошибок в одном графике.Интересно, не могли бы вы дать мне какое-нибудь предложение, как я могу изменить часть "matplot"?Может быть, вопрос лежит там?Большое спасибо !!
n <- 1000
theta <- 9
x <- runif(n, 0, theta)
theta.hat.mme <-2*mean(x)
theta.hat.G <-(n*theta)/(n+1)
theta.hat.H <-((n+1)/n)*theta.hat.G
# theta.hat.G is the max of (x_1, x_2,...,x_n) be an estimator of theta, and theta.hat.H is the modified estimator of theta.hat.G to make it unbiased.
# Empirical Exploration of properties
M <- 1000 # Number of sample of size n
L <- 9 # Different values of n
# create storage variables
mme <- numeric(M)
vn <- numeric(L)
bias <- variance <- matrix(0, nrow=L, ncol=3)
for(l in 1:L)
{
n <- 20 + (l-1)*10
for(m in 1:M)
{
x <- runif(n, 0, theta)
mme[m] <- 2*mean(x)
}
bias[l,1] <- mean(mme)-theta
bias[1,2] <-mean(theta.hat.G)-theta
bias[1,3] <-mean(theta.hat.H)-theta
variance[l,1] <- var(mme)
variance[1,2] <-var(theta.hat.G)
variance[1,3] <-var(theta.hat.H)
vn[l] <- n
}
#windows(5,5)
matplot(vn, bias, type='l', col=1:3, lty=1:3, xlab='n')
abline(h=0, lty=3)
legend('topright', col=1:3,
c('Method of Moments Estimator', 'Theta G', 'Theta H'),
inset=0.01, lty=1:2)