I am running a simulation in order to visualize how different values of beta impact a False Positive Rate analysis. So I've set up an iteration in which the value of beta increases and calculates the FPR. Here is the code:
p = 0.05
pi0 = 0.5
beta = 0
while(beta <= 1.000){
FPR1 <- (p *pi0)/((p*pi0)+((1-beta)*(1-pi0)))
beta = beta + 0.01
}
So beta starts at 0, and is supposed to increase by 0.01 until it reaches a number greater than 1, which will end the loop. So I expect to have a total of 101 outputs from 0 -> 1. But the problem is, for some reason beta is increasing by slightly more than 0.01, so the final value inputed is 0.9900000000000001, so with the final loop beta > 1, and the value for when beta == 1 is not calculated. I've already tried rounding but it doesn't seem to help.
I don't know where the extra value is being added or if it's just the product of how the loop is designed. If there is a solution or alternative approach I'd appreciate it! :)