The a
and b
as shown below are the same quantities but are calculated in two different ways in R. They are mostly the same but with several big differences. I could not figure out why that was the case.
theta0 <- c(-0.4, 10)
OS.mean <- function(shape, rank, n=100){
term1 <- factorial(n)/(factorial(rank-1)*factorial(n-rank))
term2 <- beta(n-rank+1, rank) - beta(n-rank+shape+1, rank)
term1*term2/shape
}
OS.mean.theta0.100 <- OS.mean(theta0[1], rank=seq(1, 100, by=1))
Bias.MOP <- function(shape, scale, alpha){
scale*shape*OS.mean.theta0.100[alpha*100]/(1-(1-alpha)^shape) - scale
}
a <- rep(0, 98)
for(i in 2:99){
a[i-1] <- Bias.MOP(theta0[1], theta0[2], i/100)
}
plot(a)
b <- Bias.MOP(theta0[1], theta0[2], seq(0.02, 0.99, by=0.01))
plot(b)
a-b
One other strange thing is as follows.
b[13] # -0.8185083
Bias.MOP(theta0[1], theta0[2], 0.14) # -0.03333929
They are supposed to be the same. But they clearly are not. Why?