Owen’s Q implementation issues [Power / Sample Size]

posted by d_labes  – Berlin, Germany, 2012-03-13 13:01 (4854 d 17:14 ago) – Posting: # 8260
Views: 8,911

Dear Ben,

❝ First, there still are some discrepancies, e.g. in case of T/R=1, CV=7.5% (see e.g. #4266): for n=4 power.TOST "exact" gives 0.7290143 whereas nQuery gives 0.71559 (for n=6: 0.9869919 vs. 0.97943). I guess it's just not the same exact method that is implemented? (rounding?)


These discrepancies may be due to not at least hidden bugs! They are too great in magnitude to be simply the result of rounding errors.

I have implemented the evaluation of the distinct integral the Q-function is based on for simplicity and in analogy to the function power.equivalence.md() of package MBESS using the R-function integrate() from package stats. This is a little bit "black box programming" because I have no precise idea what integrate() really does and if there are circumstances where it can fail like all numeric integration routines.

To check my implementation in package PowerTOST I have coded the algorithm given by Owen itself (repeated integration by parts) in a function OwensQOwen().

Using the calls that results if one tries to compute the power for T/R=1, CV=7.5% and n=4 the following results are obtained:
df=2
tvalue= 2.919986
delta1= 4.213542
delta2= -4.213542
R= 2.040712
p1 <- OwensQ(df, +tvalue, delta1, 0, R) # PowerTOST implementation
p2 <- OwensQ(df, -tvalue, delta2, 0, R)
power <- p2 - p1
-- gives
p1= 0.07316842
p2= 0.8021825
power = 0.7290141

p1 <- OwensQOwen(df, +tvalue, delta1, 0, R)  #Owen's integration by parts
p2 <- OwensQOwen(df, -tvalue, delta2, 0, R)
power <- p2 - p1
-- gives
p1= 0.07316842
p2= 0.8021825
power = 0.7290141

Boing! Totally consistence of the values from both implementations :cool:.
(Red is rounding to the results from the call of power.TOST() with full internal precision of tvalue, delta1, delta2 and R).

The same coincidence is observed with T/R=1, CV=7.5% and n=6 with power=0.9869919 via OwensQOwen().

The deduction in which software there is eventually a bug or a flawed implementation is left to you :-D.

BTW: OwensQOwen() code is available upon request.

Regards,

Detlew

Complete thread:

UA Flag
Activity
 Admin contact
23,424 posts in 4,927 threads, 1,686 registered users;
36 visitors (0 registered, 36 guests [including 9 identified bots]).
Forum time: 07:16 CEST (Europe/Vienna)

Complex, statistically improbable things are by their nature
more difficult to explain than
simple, statistically probable things.    Richard Dawkins

The Bioequivalence and Bioavailability Forum is hosted by
BEBAC Ing. Helmut Schütz
HTML5