|
Helmut ★★★ ![]() Vienna, Austria, 2025-08-22 12:28 (304 d 07:40 ago) Posting: # 24434 Views: 4,198 |
|
|
Dear all, THX to ElMaestro for detecting a bug in power.TOST(). Say, you dosed N subjects and are interested in post hoc power of a fraction f of this sample size (e.g., of eligible subjects). Calling power.TOST(..., n = f * N) might give a lower than the correct power.Example for CV = 0.3, N = 90, f = 0.7 (using all the defaults of a 2×2 design):
Why is that so? in the vectorization of the total sample size (to get subjects / sequence), trunc(n) is used. That is correct for n = 63 but not for n = 0.7 * 90.
PowerTOST and the planned new function:
Not for the first time we are a victim of floating-point arithmetic.
For details see the issue at GitHub. Until it is resolved and the library updated, please use power.TOST(n = round(f * N)). However, best is to give the subjects / sequence explicitly. The functions of PowerTOST don’t have a crystal ball and can only guess while keeping the sequences as balanced as possible. Only you know the actual values. If the sample size is divisible by the number of sequence, power.TOST() assumes balanced sequences. Quoting the note in the man-page of power.TOST():If
The internal function nvec(n, grps) of PowerTOST is called from its following functions:
n (assuming almost balanced sequences), the observed sequences as a vector (preferred), or use the workaround with rounding. Sorry for the inconvenience.— Dif-tor heh smusma 🖖🏼 Довге життя Україна! ![]() Helmut Schütz ![]() The quality of responses received is directly proportional to the quality of the question asked. 🚮 Science Quotes |
|
ElMaestro ★★★ Denmark, 2025-08-23 11:46 (303 d 08:22 ago) @ Helmut Posting: # 24435 Views: 3,478 |
|
|
Hi Hötzi, ❝ Say, you dosed ![]() Accusing me of being a member of the post-hoc power fan club? I think my membership was discontinued around 2007.For me, pre-study power considerations led me to look into this. Like checking a range of prospective attrition rates to evaluate the actual power. Before, not after. I have to say the bug is very minor. I have no relevant real-life (non-simulation) cases where this would make an much meaningful difference - extreme cases with unfavourable combinations of small sample sizes and high variabilities perhaps but most of what I do is not that extreme. A difference of e.g. 0.2% or whatever in a power estimation is to me not of particular relevance since in BE there are various assumption which can be violated and which may have unknown consequences for the magnitude of power. Dasatinib comes to mind. ![]() Add to that, that an unfortunate habit in the industry is to adjust assumptions to make the sample size / power meet a target, not the other way around. So, I would not invest too much too much time on fixing this one. PowerTOST is a great tool and the matter here does not in any way detract from its value. You and Detlew and possibly other people involved are doing a great job. Muchas gracias. — Pass or fail! ElMaestro |
|
Helmut ★★★ ![]() Vienna, Austria, 2025-08-23 13:01 (303 d 07:07 ago) @ ElMaestro Posting: # 24436 Views: 3,519 |
|
|
Hi ElMaestro, ❝ ❝ ❝ Say, you dosed ❝ ❝ Accusing me of being a member of the post-hoc power fan club? ❝ I think my membership was discontinued around 2007. ❝ For me, pre-study power considerations led me to look into this. Like checking a range of prospective attrition rates to evaluate the actual power. ❝ Before, not after. ❝ […] an unfortunate habit in the industry is to adjust assumptions to make the sample size / power meet a target, not the other way around. ❝ So, I would not invest too much too much time on fixing this one. PowerTOST is a great tool and the matter here does not in any way detract from its value. ❝ You and Detlew and possibly other people involved are doing a great job. Muchas gracias. — Dif-tor heh smusma 🖖🏼 Довге життя Україна! ![]() Helmut Schütz ![]() The quality of responses received is directly proportional to the quality of the question asked. 🚮 Science Quotes |
|
d_labes ★★★ Berlin, Germany, 2025-10-06 11:59 (259 d 08:09 ago) (edited on 2025-10-06 12:13) @ Helmut Posting: # 24448 Views: 1,725 |
|
|
Dear All, the Bug is fixed in PowerTOST version 1.5-7. On CRAN since 23.09.2025. Sorry for being late in announcing this. — Regards, Detlew |

THX to ElMaestro for detecting a bug in
However, best is to give the subjects / sequence explicitly. The functions of ![[image]](https://static.bebac.at/pics/Blue_and_yellow_ribbon_UA.png)
![[image]](https://static.bebac.at/img/CC by.png)

I think my membership was discontinued around 2007.
