How to create table of results [Power / Sample Size]

posted by ElMaestro  – Denmark, 2017-07-20 16:32 (3253 d 03:57 ago) – Posting: # 17578
Views: 10,338

Hi BE-proff,

try this:

library(PowerTOST)

arrGMR=c(0.85, 0.9, 0.95, 1.0, 1.05, 1.10, 1.15, 1.20)
myCV=0.26
N=arrGMR

for (i in 1:length(arrGMR))
   N[i]=sampleN.TOST(theta0=arrGMR[i], CV=myCV, targetpower=0.8) [1,7] 

A=data.frame(arrGMR, N)

print(A)


you can easily put it inside a little function if the purpose is specifcally to "return" the data frame (as in, a table).

You can make the code totally fancier and totally unreadable by using sapply or some similar function - I am sure this is what the code police recommends.:-D

Pass or fail!
ElMaestro

Complete thread:

UA Flag
Activity
 Admin contact
23,654 posts in 4,992 threads, 1,571 registered users;
107 visitors (0 registered, 107 guests [including 10 identified bots]).
Forum time: 20:30 CEST (Europe/Vienna)

Always listen to experts.
They’ll tell you what can’t be done and why.
Then do it.    Robert A. Heinlein

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