## Exact Power [R for BE/BA]

Hi HS,

» [Blahdeeblah] Therefore 0.1980422 rather than the

» value in full precision (0.1980422004353650284627675024887) [more blah]

Try to put yourself in the shoes of the software writer. There are two known options to getting the calculation of power. One is the bruteforce approach, the other goes via probabilities of the non-central t distribution.

The former can be cumbersome and is generally not preferred (takes time but converges asymptotically to the true power with the number of resamples if the random number generator works (and trust me, it is not that hard to make one that does!)), but there is still preference for the latter. Now, actually programming a stable Al Gore Rhythm which get the probs from the nct dist is a nightmare, so the developer of course googles it and finds some really neat source code. This is what the developers of R did, and a dollar gets ten that this is what others do as well.

And here's the deal: If you look at that source you can easily see that it is based on some (necessary) helper constants and short-cuts and convergence criteria and what not. In other words, whatever the algo does it is not exact. It is approximate, but how good that approximation actually is is unknown (unknown error will be a function of the conditions, by the way).

We know R's power is an approximation since it uses an adapted ASA243. So when two or more applications get the same result it could be either because they are both right or because they both make the same errors (as would be the case if they are based on mods of the same algo etc), or it could be pure chance. And we have absolutely no way of telling which one is the right one until some clever guy works out the integrals exactly. I'll buy you a Mozartkugel if you do it.

» I love validating software.

Decompile your recent acquisition and check if they one way or another use the ASA243. If they do, why validate?

EM.

» [Blahdeeblah] Therefore 0.1980422 rather than the

» value in full precision (0.1980422004353650284627675024887) [more blah]

Try to put yourself in the shoes of the software writer. There are two known options to getting the calculation of power. One is the bruteforce approach, the other goes via probabilities of the non-central t distribution.

The former can be cumbersome and is generally not preferred (takes time but converges asymptotically to the true power with the number of resamples if the random number generator works (and trust me, it is not that hard to make one that does!)), but there is still preference for the latter. Now, actually programming a stable Al Gore Rhythm which get the probs from the nct dist is a nightmare, so the developer of course googles it and finds some really neat source code. This is what the developers of R did, and a dollar gets ten that this is what others do as well.

And here's the deal: If you look at that source you can easily see that it is based on some (necessary) helper constants and short-cuts and convergence criteria and what not. In other words, whatever the algo does it is not exact. It is approximate, but how good that approximation actually is is unknown (unknown error will be a function of the conditions, by the way).

We know R's power is an approximation since it uses an adapted ASA243. So when two or more applications get the same result it could be either because they are both right or because they both make the same errors (as would be the case if they are based on mods of the same algo etc), or it could be pure chance. And we have absolutely no way of telling which one is the right one until some clever guy works out the integrals exactly. I'll buy you a Mozartkugel if you do it.

» I love validating software.

Decompile your recent acquisition and check if they one way or another use the ASA243. If they do, why validate?

EM.

### Complete thread:

- R-Code for Power in 2×2 Cross-over Helmut 2006-12-28 21:33 [R for BE/BA]
- Power in Diletti's sample size table Helmut 2007-01-01 23:59
- Approximate Power Helmut 2007-01-06 15:17
- Power Calculation for replicate crossover design mathews 2008-04-03 13:19
- Power Calculation for replicate crossover design Helmut 2008-04-03 13:49
- Power Calculation for replicate crossover design mathews 2008-04-04 13:21

- Power Calculation for replicate crossover design Helmut 2008-04-03 13:49
- Exact Power Helmut 2009-09-25 19:20
- Exact Power ElMaestro 2009-09-27 23:27
- Software validation Helmut 2009-09-28 15:21
- All the important answers are here! ElMaestro 2009-09-28 19:12
- All the important answers are here! Helmut 2009-09-28 19:52
- All the important answers are here! ElMaestro 2009-09-28 20:18
- All the important answers are here! yjlee168 2009-09-28 21:30
- All the important answers are here! Helmut 2009-09-28 23:18
- 42! SASophylistic power oracle d_labes 2009-09-29 13:37
- Al Gore Rhythms Helmut 2009-09-29 14:52
- Al Gore Rhythms ElMaestro 2009-09-29 18:14
- Al Gore Rhythms yjlee168 2009-09-29 23:55

- Al Gore Rhythms Helmut 2009-09-29 14:52

- 42! SASophylistic power oracle d_labes 2009-09-29 13:37
- All the important answers are here! yjlee168 2009-09-29 23:49

- All the important answers are here! Helmut 2009-09-28 23:18

- All the important answers are here! Helmut 2009-09-28 19:52

- All the important answers are here! ElMaestro 2009-09-28 19:12

- Software validation Helmut 2009-09-28 15:21

- Exact Power ElMaestro 2009-09-27 23:27

- Power Calculation for replicate crossover design mathews 2008-04-03 13:19

- Approximate Power Helmut 2007-01-06 15:17
- R-Code for Power in 2×2 Cross-over KDA 2019-01-23 04:24
- R-Code for Power in 2×2 Cross-over Ohlbe 2019-01-27 18:24

- Power in Diletti's sample size table Helmut 2007-01-01 23:59