# Power Analysis with Noncentral F distribution

I'm looking to replicate a power analysis for binary data using an MRMC analysis (details found here). The data looks like this, where Score is a binary variable.

ReaderID     CaseID  Modality Score
1       truth Actual1001     truth     1


Essentially, the values used for the power calculation are:

SE.tot = .0377381
dfBDG = 2.3989
eff.size = .28
t.stat = eff.size/SE.tot = 7.4196
lambda = t.stat^2 = 55.04989
cutoff = qf(.95, 1, dfBDG) = 13.57782


And it's calculated with a noncentral F distribution. Using the relationship here I am trying to replicate the results from the Java applet on the Github page linked above.

Per the Java applet, power with these parameters should be .9. However when I try coding it as follows in R, I get .96.

Changing parameters also leads to different results, so I'm not exactly sure what small thing I'm messing up with this. Any help is appreciated!

F.vals = numeric(50)
d1 = 1
d2 = dfBDG - 1

for (i in 1:50){
j = i - 1
sfactor = exp(-lambda/2)*((lambda/2)^j)/factorial(j)
F.vals[j] = sfactor*pbeta((cutoff*d1/(cutoff*d1+d2)),
d1/2 + j, d2/2)
}
power = 1 - sum(F.vals)