R-Inferno [🇷 for BE/BA]

posted by Helmut Homepage – Vienna, Austria, 2018-01-23 14:37 (2077 d 16:20 ago) – Posting: # 18268
Views: 4,450

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
22,763 posts in 4,775 threads, 1,628 registered users;
9 visitors (0 registered, 9 guests [including 2 identified bots]).
Forum time: 07:58 CEST (Europe/Vienna)

The object of statistics is information.
The objective of statistics is the understanding of information
contained in data.    Irwin and Marylees Miller

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