As we don't test every possible value of the parameters, we don't know exactly when we cross the 80% threshold. I wrote some code to use interpolation to calculate a more specific sample size (for example) when the threshold is crossed. I haven't used it because currently it doesn't match up with what the plotting function does, but thought I would record it here as a suggestion for improvement.
# interpolate to get values for minimum 80% power
outPowerCalcs<-rep( NA, length = ncol(allProps)-1)
for(i in 2:ncol(allProps)){
overIndex <- which(allProps[,i] > 0.8)[1]
underIndex <- overIndex-1
interDist <- (0.8-allProps[underIndex,i])/(allProps[overIndex,i] - allProps[underIndex,i])
outPowerCalcs[ i - 1] <- allProps[underIndex,1] + (allProps[overIndex,1] - allProps[underIndex,1])*interDist
}
}
As we don't test every possible value of the parameters, we don't know exactly when we cross the 80% threshold. I wrote some code to use interpolation to calculate a more specific sample size (for example) when the threshold is crossed. I haven't used it because currently it doesn't match up with what the plotting function does, but thought I would record it here as a suggestion for improvement.