R-Inferno [🇷 for BE/BA]

posted by Helmut Homepage – Vienna, Austria, 2018-01-23 14:37 (3053 d 20:59 ago) – Posting: # 18268
Views: 6,795

Hi ElMaestro,

that’s strange. Let’s try to access all values by their (original) names.

library(PowerTOST)
sampleN.RSABE(CV=0.3, theta0=0.95)$design
NULL
sampleN.RSABE(CV=0.3, theta0=0.95)$alpha
[1] 0.05
sampleN.RSABE(CV=0.3, theta0=0.95)$CVwT
[1] 0.3
sampleN.RSABE(CV=0.3, theta0=0.95)$CVwR
[1] 0.3
sampleN.RSABE(CV=0.3, theta0=0.95)$theta0
[1] 0.95
sampleN.RSABE(CV=0.3, theta0=0.95)$theta1
[1] 0.8
sampleN.RSABE(CV=0.3, theta0=0.95)$theta2
[1] 1.25
sampleN.RSABE(CV=0.3, theta0=0.95)$n
[1] 27
sampleN.RSABE(CV=0.3, theta0=0.95)$power
NULL
sampleN.RSABE(CV=0.3, theta0=0.95)$targetpower
NULL
sampleN.RSABE(CV=0.3, theta0=0.95)$nlast
[1] 27

sampleN.TOST(CV=0.3, theta0=0.95)$design
NULL
sampleN.TOST(CV=0.3, theta0=0.95)$alpha
[1] 0.05
sampleN.TOST(CV=0.3, theta0=0.95)$CV
[1] 0.3
sampleN.TOST(CV=0.3, theta0=0.95)$theta0
[1] 0.95
sampleN.TOST(CV=0.3, theta0=0.95)$theta1
[1] 0.8
sampleN.TOST(CV=0.3, theta0=0.95)$theta2
[1] 1.25
sampleN.TOST(CV=0.3, theta0=0.95)$n
NULL
sampleN.TOST(CV=0.3, theta0=0.95)$power
NULL
sampleN.TOST(CV=0.3, theta0=0.95)$targetpower
NULL


We get some NULLs also from sample.RSABE(). Even more interesting calling a variable which does not exist (since R is case-sensitive). foo()$design gave NULL, but:

sampleN.RSABE(CV=0.3, theta0=0.95)$Design
[1] 2x3x3
Levels: 2x3x3

sampleN.TOST(CV=0.3, theta0=0.95)$Design
[1] 2x2
Levels: 2x2


In the functions of PowerTOST design is character variable, but Design is a 1-level factor:
is.factor(sampleN.TOST(CV=0.3, theta0=0.95)$Design)
[1] TRUE


I don’t get it.

❝ […] if I want the sample sizes I can also easily get them via [1,7] or [1,8] from the sample size object returned …


I suggest to use Sample.Nfoo()[["Sample size"]] instead. You can use it in all functions and the current indices are not carved in stone. If we introduce another variable before #7 or reorder variables in a future version of PowerTOST your code will not work any more.

Dif-tor heh smusma 🖖🏼 Довге життя Україна! [image]
Helmut Schütz
[image]

The quality of responses received is directly proportional to the quality of the question asked. 🚮
Science Quotes

Complete thread:

UA Flag
Activity
 Admin contact
23,653 posts in 4,991 threads, 1,571 registered users;
203 visitors (0 registered, 203 guests [including 23 identified bots]).
Forum time: 12:36 CEST (Europe/Vienna)

I’m all in favor of the democratic principle
that one idiot is as good as one genius, but I draw the line
when someone takes the next step and concludes
that two idiots are better than one genius.    Leo Szilard

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