Alyssa
☆    

Malaysia,
2020-05-04 06:35
(1424 d 12:35 ago)

Posting: # 21389
Views: 9,864
 

 Sample size calculation (Pilot study result vs literature) [Power / Sample Size]

Hi,

We have a product, conducted pilot study, 2x2x2 , 18 subjects.

Geometric Lease square Mean Cmax (ng/mL) T = 15032.282
Geometric Lease square Mean Cmax (ng/mL) R = 15227.106
T/R ratio % = 98.70
90% CI = 84.41 – 115.46
ISCV (%) = 26.4
Power(%) = 76.6%

However, based on published literature (Public assessment report, PAR) for the same product. 3 way crossover, reference replicate with 41 subjects completed, the results shows below:-

Geometric Lease square Mean Cmax (ng/mL) T = 16530.654
Geometric Lease square Mean Cmax (ng/mL) R = 15064.108
T/R ratio % = 109.7
90% CI = 96.25-125.11%
ISCV (%) = 42.6%
Power(%) = NA

Based on the CRO in house data for their past experience, Range of Intra-Subject Variability of Reference Formulation (CVWR): 26.8% – 50.3% (Pass studies)

Question:
1. Usually ISCV result of the 3 way crossover or 4 way crossover, replicate study published in the PAR is CVwR or CVw?

2. Which ISCV should i consider to use for sample size calculation as our own pilot study shows promising result, however, published literature and CRO past experience shows the other way. CRO advised us to go for 4 way crossover, replicate design, with ratio 90-111%, ISCV = 35-40%

3. What would be the recommended ISCV and study design for product like this? I have to balance between passing the study and the company's budget.


Hope the expert here can give me some recommendation. Appreciated. TQ:-)
Dr_Dan
★★  

Germany,
2020-05-04 10:46
(1424 d 08:24 ago)

@ Alyssa
Posting: # 21391
Views: 7,991
 

 Sample size calculation (Pilot study result vs literature)

Dear Alyssa
I guess you are talking about an oral IR formulation, right?
ISCV are not carved in stone, there will always be a certain variability. However, big differences hint on differences in study performance and/or quality of formulations. It is reasonable to assume that the ISCV in the pivotal study will be similar to the pilot study if you use the same CRO (study procedure performance), the same test formulation vs. the same (batch of) reference product and the same bioanalytical method. If costs do not matter you can of course follow the suggestion of the CRO to go for 4 way crossover, replicate design, with ratio 90-111%, ISCV = 35-40%. :-D:-D:-D
I hope this helps

Kind regards and have a nice day
Dr_Dan
Alyssa
☆    

Malaysia,
2020-05-04 11:26
(1424 d 07:44 ago)

@ Dr_Dan
Posting: # 21392
Views: 7,885
 

 Sample size calculation (Pilot study result vs literature)

Dear Dr. Dan,

Thanks for your reply.

❝ I guess you are talking about an oral IR formulation, right?


Is a oral MR formulation.

❝ It is reasonable to assume that the ISCV in the pivotal study will be similar to the pilot study if you use the same CRO (study procedure performance), the same test formulation vs. the same (batch of) reference product and the same bioanalytical method.


The CRO we used for pilot study is the same as per the one used in the published literature (sponsor mentioned the CRO name in the PAR). Therefore, the study procedure performance and bioanalytical method variability is reduced.

❝ If costs do not matter you can of course follow the suggestion of the CRO to go for 4 way crossover, replicate design, with ratio 90-111%, ISCV = 35-40%. :-D:-D:-D


Cost is definitely a matter for us now, especially during this Covid-19 pandemic, have to spend wisely. Therefore i need some expert opinion here for my consideration. :confused:


Edit: Full quote removed. Please delete everything from the text of the original poster which is not necessary in understanding your answer; see also this post #5[Helmut]
Helmut
★★★
avatar
Homepage
Vienna, Austria,
2020-05-04 14:07
(1424 d 05:03 ago)

@ Alyssa
Posting: # 21393
Views: 7,847
 

 Estimation of CVw and/or CVwR

Hi Alyssa,

Usually ISCV result of the 3 way crossover or 4 way crossover, replicate study published in the PAR is CVwR or CVw?


There are no rules (it depends on what the assessor decides to include of the study report). However, since the study was a replicate design with reference-scaling, possibly it is CVwR (more important).
We can estimate the CVw with the R-package PowerTOST:

library(PowerTOST)
round(100*CVfromCI(lower = 0.9625, upper = 1.2511,
                   n = 41, design = "3x6x3"), 1)

and get

Unbalanced 3x6x3 design. n(i)= 7/7/7/7/7/6 assumed.
[1] 36.8

Since this does not match what is given in the PAR, it is a strong hint that the 42.6% is the CVwR.
[Nonsense, not a Williams’ design! See ElMaestro’s post and the correction.]
If the expanded limits are given in the PAR, you can estimate the CVwR from the upper limit by the function CVwRfromU() to check. Example for 136.4%:

round(100 * CVwRfromU(136.4 / 100), 1)
[1] 42.6

Although CVwT is not accessible in a partial replicate design, CVw < CVwR means that the test is less variable than the reference (since CVw is pooled from CVwR and CVwT).

I agree with Dan but want to add one point. In my experience the variability across studies (with the same clinical setup, bioanalytical method, :blahblah:) tends to be more “stable” than the T/R-ratio. Hence, don’t fall into the trap of believing the nice 98.7% you observed in the pilot study. It might well have been pure chance. For HVD(P)s assuming a T/R-ratio of better than 90–111% is not a good idea (recommended by the two Lászlós* and therefore, the default in functions sampleN.scABEL() and sampleN.RSABE() of PowerTOST).


PS: Avoid sample size “calculation” if you don’t mind. Use “estimation” instead. ;-)
PPS: The partial replicate is a lousy design. If you want to have only three periods I suggest the 2×2×3 full replicate TRT|RTR instead. If you insist in the partial replicate (why?), use the function sampleN.scABEL.sdsims(). Slower than sampleN.scABEL() but more accurate. For a comparison see the vignette and scroll down to “Heterogenicity”.

  • Tóthfalusi L, Endrényi L. Sample Sizes for Designing Bioequivalence Studies for Highly Variable Drugs. J Pharm Pharmaceut Sci. 2011;15(1):73–84. [image] open access.

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
ElMaestro
★★★

Denmark,
2020-05-04 14:14
(1424 d 04:56 ago)

@ Helmut
Posting: # 21394
Views: 7,862
 

 Estimation of CVw and/or CVwR

Hi Hötzi,

the powerTOST package is excellent and I am not myself a very experienced user (yet) as I tend to rely on much less reliable code of my own making :-D
So forgive me I am asking: I think the OP implied a partial replicate. TRR/RRT/RTR is not 3x6x3 but rather 2(trts)x3(seqs)x3(pers), is there a reason to plug in 3x6x3 in your code?

Pass or fail!
ElMaestro
Helmut
★★★
avatar
Homepage
Vienna, Austria,
2020-05-04 14:40
(1424 d 04:30 ago)

@ ElMaestro
Posting: # 21395
Views: 7,978
 

 Mea culpa!

Hi ElMaestro,

❝ the powerTOST package is excellent …


THX!

❝ … and I am not myself a very experienced user (yet) as I tend to rely on much less reliable code of my own making :-D


Sure. In line what Jaime once stated:

Never trust in any piece of software you haven't written yourself
(and even then you should be cautious…)


❝ So forgive me I am asking: I think the OP implied a partial replicate. TRR/RRT/RTR is not 3x6x3 but rather 2(trts)x3(seqs)x3(pers), …


Oops! You are absolutely right.

❝ ❝ 3 way crossover, reference replicate


❝ … is there a reason to plug in 3x6x3 in your code?


I screwed up! Of course, not a 3-period Williams’ design. Hence,

library(PowerTOST)
round(100 * CVfromCI(lower = 0.9625, upper = 1.2511,
                     n = 41, design = "2x3x3"), 2)

and

Unbalanced 2x3x3 design. n(i)= 14/14/13 assumed.
[1] 42.97

That’s reasonably close to the 42.6% given in the PAR. Sorry for the confusion caused!

@Alyssa: Can you please check whether the expanded limits are also given in the PAR? Based on CVwR 42.6% they should be close to

round(100 * scABEL(CV = 42.6 / 100), 1)
lower upper
 73.3 136.4


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
ElMaestro
★★★

Denmark,
2020-05-04 15:46
(1424 d 03:25 ago)

@ Helmut
Posting: # 21396
Views: 7,845
 

 It must be Myco

Hi again,

I believe it must be this assessment report.:
"the acceptance criteria for Cmax was widened to the acceptance range of 72.83-137.31%",

Pass or fail!
ElMaestro
Helmut
★★★
avatar
Homepage
Vienna, Austria,
2020-05-04 16:07
(1424 d 03:04 ago)

@ ElMaestro
Posting: # 21397
Views: 7,808
 

 It is, it is!

❝ I believe it must be this assessment report.:

❝ "the acceptance criteria for Cmax was widened to the acceptance range of 72.83-137.31%",


Almost my dear Dr Watson!
It’s the first study; results on page 7:
“… within-reference intra-subject CV of ln-transformed Cmax > 30% (42.6%), hence Cmax limits were widen[ed] to 73.31–136.42% using scaled-average-bioequivalence.”

library(PowerTOST)
identical(42.6 / 100, round(100 * CVwRfromU(136.42 / 100), 1))
[1] TRUE


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
Alyssa
☆    

Malaysia,
2020-05-05 07:00
(1423 d 12:11 ago)

@ Helmut
Posting: # 21400
Views: 7,967
 

 It is....

Wow! @Elmaestro nothing can hide from you. Opss I should'nt disclose it here. :surprised:

@Helmut thanks for the explanation i will try to digest the PowerTOST calculation mentioned above.
I'm not a biostatistician.....so need some time. :cool:


Edit: Full quote removed. Please delete everything from the text of the original poster which is not necessary in understanding your answer; see also this post #5[Helmut]
Helmut
★★★
avatar
Homepage
Vienna, Austria,
2020-05-05 14:45
(1423 d 04:25 ago)

@ Alyssa
Posting: # 21401
Views: 8,017
 

 Tutorial

Hi Alyssa,

❝ i will try to digest the PowerTOST calculation mentioned above.


Estimation, pleeze. ;-)

❝ I'm not a biostatistician.....so need some time. :cool:


It’s not that difficult; short tutorial:

library(PowerTOST)
# T/R-ratio, CVwR, and sample size from the PAR
theta0  <- 1.097
CVwR    <- 0.426
n       <- 41
design  <- "2x3x3"
# Since this was a partial replicate, we
# have to assume that CVwT = CVwR

CV      <- rep(CVwR, 2)

What was the – though irrelevant – post hoc power?

round(100 * power.scABEL(CV = CV, theta0 = theta0,
                         design = design, n = n), 2)

Gives

Unbalanced design. n(i)=14/14/13 assumed.
[1] 84.96

What’s the sample size applying all defaults (T/R-ratio 0.90, power 0.80, partial replicate design, 100,000 simulated studies)?

sampleN.scABEL(CV = CV)

Gives

+++++++++++ scaled (widened) ABEL +++++++++++
            Sample size estimation
   (simulation based on ANOVA evaluation)
---------------------------------------------
Study design: 2x3x3 (partial replicate)
log-transformed data (multiplicative model)
1e+05 studies for each step simulated.

alpha  = 0.05, target power = 0.8
CVw(T) = 0.426; CVw(R) = 0.426
True ratio = 0.9
ABE limits / PE constraint = 0.8 ... 1.25
EMA regulatory settings
- CVswitch            = 0.3
- cap on scABEL if CVw(R) > 0.5
- regulatory constant = 0.76
- pe constraint applied

Sample size search
 n     power
36   0.7642
39   0.7950
42   0.8198

OK, what about other designs/powers?

# partial replicate, 3- and 4-period full replicate designs
designs <- c("2x3x3", "2x2x3", "2x2x4")
# desired powers
target  <- c(0.80, 0.85, 0.90)
# assign a data.frame of results
res     <- data.frame(design = rep(designs, each = length(target)),
                      target = target, n = NA, power = NA)
# loop over the rows, apply the defaults:
# T/R-ratio 0.90, 100,000 simulated studies

for (j in 1:nrow(res)) {
  res[j, 3:4] <- sampleN.scABEL(CV = CV, design = res$design[j],
                                targetpower = res$target[j],
                                print = FALSE, details = FALSE)[8:9]
}
print(res, row.names = FALSE)

Gives

 design target  n   power
  2x3x3   0.80 42 0.81976
  2x3x3   0.85 48 0.86341
  2x3x3   0.90 57 0.90803
  2x2x3   0.80 44 0.80688
  2x2x3   0.85 52 0.85872
  2x2x3   0.90 62 0.90439
  2x2x4   0.80 28 0.80013
  2x2x4   0.85 34 0.86179
  2x2x4   0.90 40 0.90514


Sample sizes for the 3-period full replicate are higher than for the partial replicate. However, don’t think only about costs. The former is more informative, since you can estimate also CVwT. Not only that you learn something about your formulation, it is useful for designing other studies. Whereas expanding the limits is based on CVwR, the CI depends on the pooled variance of both treatments. In many cases CVwT < CVwR, which would give you an incentive of the sample size. Unfortunately CVwT is never given in PARs (not of regulatory concern). I recommend to perform pilot studies always in a full replicate design to obtain this information. Example:

# variance ratios T/R
ratio <- seq(0.75, 1, 0.05)
# variable CVwT and constant CVwR
CV    <- data.frame(CVwT = mse2CV(CV2mse(CVwR)*ratio),
                    CVwR = CVwR)
res   <- data.frame(CVwT = CV[, 1], CVwR = CV[, 2],
                    var.ratio = ratio, n = NA, power = NA)
# for heterogenicity (unequal variances)
# use the function sampleN.scABEL.sdsims()

for (j in 1:nrow(res)) {
  res[j, 4:5] <- sampleN.scABEL.sdsims(CV = as.numeric(CV[j, ]),
                                       design = "2x2x3", print = FALSE,
                                       details = FALSE)[8:9]
}
print(signif(res, 4), row.names = FALSE)

Gives

   CVwT  CVwR var.ratio  n  power
 0.3650 0.426      0.75 40 0.8135
 0.3778 0.426      0.80 40 0.8053
 0.3902 0.426      0.85 42 0.8119
 0.4024 0.426      0.90 42 0.8042
 0.4143 0.426      0.95 44 0.8114
 0.4260 0.426      1.00 44 0.8040

Although the expansion remains constant, with lower CVwT you will need less subjects.

But in your case we don’t have this information and have to assume that CVwT = CVwR. I recommend to perform a power analysis (see the vignette) to assess the impact of deviations from our assumptions on power. Try:

# defaults: T/R-ratio 0.90, target power 0.80,
# minimum acceptable power 0.70, partial replicate design

res <- pa.scABE(CV = CVwR)
print(res, plotit = FALSE)

Gives
Sample size plan scABE (EMA/ABEL)
 Design alpha  CVwT  CVwR theta0 theta1 theta2 Sample size Achieved power Target power
  2x3x3  0.05 0.426 0.426    0.9    0.8   1.25          42        0.81976          0.8

Power analysis
CV, theta0 and number of subjects which lead to min. acceptable power of at least 0.7:
 CV= 0.6668, theta0= 0.8718
 n = 31 (power= 0.7059)

Now:

plot(res, pct = FALSE, ratiolabel = "T/R")


[image]


Let’s explore the panels.
  1. If the CV will be higher than assumed, we gain power because we may expand the limits more. At ~50% power starts to drop because the upper cap of scaling and the restriction of the point estimate (within 80–125%) cuts in.
    If the CV will be lower than assumed, we loose power because we may expand the limits less. At 30% and below we may not expand the limits any more but at such low CVs the study will be sufficiently powered for ABE anyway.
  2. The T/R-ratio is the most sensitive condition. If it drops from the assumed 0.90 to 0.8718 (that’s a relative deviation of just 3.13%) power will already reach our minimum acceptable 0.70. Science is a cruel mistress.
  3. We don’t have to worry about dropouts at all.

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
Alyssa
☆    

Malaysia,
2020-05-08 08:48
(1420 d 10:22 ago)

@ Helmut
Posting: # 21406
Views: 7,326
 

 Tutorial

Dear Helmut,

Thanks for the detailed tutorial!

I was trying to follow your command and out in the powerTOST, however, i cant get the sample size estimation. May i know what has gone wrong? Thank you ~


# partial replicate, 3- and 4-period full replicate designs
> designs <- c("2x3x3", "2x2x3", "2x2x4")
> # desired powers
> target  <- c(0.80, 0.85, 0.90)
> # assign a data.frame of results
> res     <- data.frame(design = rep(designs, each = length(target)),
+                       target = target, n = NA, power = NA)
> # loop over the rows, apply the defaults:
> # T/R-ratio 0.90, 100,000 simulated studies
> for (j in 1:nrow(res)) {
+   res[j, 3:4] <- sampleN.scABEL(CV = CV, design = res$design[j],
+                                 targetpower = res$target[j],
+                                 print = FALSE, details = FALSE)[8:9] + }
Error in sampleN.scABEL(CV = CV, design = res$design[j], targetpower = res$target[j],  :
  could not find function "sampleN.scABEL"
> print(res, row.names = FALSE)
 design target  n power
  2x3x3   0.80 NA    NA
  2x3x3   0.85 NA    NA
  2x3x3   0.90 NA    NA
  2x2x3   0.80 NA    NA
  2x2x3   0.85 NA    NA
  2x2x3   0.90 NA    NA
  2x2x4   0.80 NA    NA
  2x2x4   0.85 NA    NA
  2x2x4   0.90 NA    NA



Edit: Code and results BBCoded; see also this post #10[Helmut]
d_labes
★★★

Berlin, Germany,
2020-05-08 13:16
(1420 d 05:55 ago)

@ Alyssa
Posting: # 21407
Views: 7,524
 

 library

Dear Alyssa,

❝ I was trying to follow your command and out in the powerTOST, however, i cant get the sample size estimation. May i know what has gone wrong? Thank you ~


Did you issue a
library(PowerTOST)
before executing the rest of the code?

Regards,

Detlew
Helmut
★★★
avatar
Homepage
Vienna, Austria,
2020-05-08 15:08
(1420 d 04:02 ago)

@ Alyssa
Posting: # 21408
Views: 7,319
 

 Tutorial (from the start)

Hi Alyssa,

❝ Thanks for the detailed tutorial!


Welcome.

❝ I was trying to follow your command and out in the powerTOST, however, i cant get the sample size estimation. May i know what has gone wrong?


Your results show that you did not attach the library (see Detlew’s post). However, this part of the code alone will still not work because the CV is not specified. You would get:
Error in sampleN.scABEL(CV = CV, design = res$design[j], targetpower = res$target[j],  :
  object 'CV' not found

I assumed that you will execute the entire code of the tutorial step by step. If you want only this part and/or the power analysis at the end, start with:

library(PowerTOST)
CVwR <- 0.426
CV   <- rep(CVwR, 2)




PS: R-terminology.
  • A package contains functions, man-pages, a DESCRIPTION-file (mandatory); data, vignettes, PDFs, … (optional).
    Hence, you find Packages in the menu-bar of the R-console. IMHO, in the sub­menu it should rather state Load library… instead of Load package… because:
  • A library is a locally installed package.
    Therefore, the command to attach it is library().
  • For beginners I recommend Load package…. Say, you want to work with “foo”. If “foo” is not installed yet, it will be missing in the list. If you try library(foo) in the R-console and “foo” is not installed you will get:
      Error in library(foo) : there is no package called ‘foo’

    The safe way to check whether a package “foo” is already installed (and if not, download it from a CRAN-mirror & install it) and attach the library is:
    p <- "foo"
    i <- p %in% installed.packages()
    if (length(p[!i]) > 0) install.packages(p[!i])
    library(p, character.only = TRUE)

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
Alyssa
☆    

Malaysia,
2020-05-12 06:05
(1416 d 13:05 ago)

@ Helmut
Posting: # 21426
Views: 6,900
 

 Tutorial (from the start)

Hi Helmut,

Yeah, you are right, i din't install powerTOST. :-|

Once i installed and i follow from the the start, i managed to get up to :-

Sample size search
 n     power
36   0.7642
39   0.7950
42   0.8198


Then i continued with the following command but it appeared error:-

> # partial replicate, 3- and 4-period full replicate designs
> designs <- c("2x3x3", "2x2x3", "2x2x4")
> # desired powers
> target  <- c(0.80, 0.85, 0.90)
> # assign a data.frame of results
> res     <- data.frame(design = rep(designs, each = length(target)),
+                       target = target, n = NA, power = NA)
> # loop over the rows, apply the defaults:
> # T/R-ratio 0.90, 100,000 simulated studies
> for (j in 1:nrow(res)) {
+   res[j, 3:4] <- sampleN.scABEL(CV = CV, design = res$design[j],
+                                 targetpower = res$target[j],
+                                 print = FALSE, details = FALSE)[8:9] + }
Error in match.arg(design) : 'arg' must be NULL or a character vector
> print(res, row.names = FALSE)
 design target  n power
  2x3x3   0.80 NA    NA
  2x3x3   0.85 NA    NA
  2x3x3   0.90 NA    NA
  2x2x3   0.80 NA    NA
  2x2x3   0.85 NA    NA
  2x2x3   0.90 NA    NA
  2x2x4   0.80 NA    NA
  2x2x4   0.85 NA    NA
  2x2x4   0.90 NA    NA


May i know what is this error about? Thank you.


Edit: Code and results BBCoded; see also this post #10[Helmut]
Helmut
★★★
avatar
Homepage
Vienna, Austria,
2020-05-12 13:49
(1416 d 05:21 ago)

@ Alyssa
Posting: # 21427
Views: 6,946
 

 Tracking down error

Hi Alyssa,

❝ Then i continued with the following command but it appeared error: […]



Let’s try to figure it out. Execute this code:
library(PowerTOST)
CVwR    <- 0.426
CV      <- rep(CVwR, 2)
designs <- c("2x3x3", "2x2x3", "2x2x4")
target  <- c(0.80, 0.85, 0.90)
res     <- data.frame(design = rep(designs, each = length(target)),
                      target = target, n = NA, power = NA)
for (j in 1:nrow(res)) {
  res[j, 3:4] <- sampleN.scABEL(CV = CV, design = res$design[j],
                                targetpower = res$target[j],
                                print = FALSE, details = FALSE)[8:9]
}
print(res, row.names = FALSE)


If it works now, fine. If you get the same error, try:
res[1, 3:4] <- sampleN.scABEL(CV = CV, design = "2x3x3",
                              targetpower = 0.8, print = FALSE,
                              details = FALSE)[8:9]
print(res[1, ], row.names = FALSE)


Expected:
 design target  n   power
  2x3x3    0.8 42 0.81976


If you get an error (or something else), let’s see what you have installed. Try this:
p <- c("PowerTOST", "mvtnorm", "stats", "utils",
       "graphics", "grDevices", "cubature",
       "TeachingDemos", "crossdes", "devtools")
i <- data.frame(name = c("R", p),
                version = c(noquote(as.character(getRversion())),
                            rep(NA, length(p))),
                status = c("-", rep("required", 8),
                           rep("suggested", 2)))
for (j in 2:nrow(i)) {
  i[j, 2] <- noquote(as.character(packageVersion(i[j, 1])))
}
print(i, row.names = FALSE)

On my machine:
          name    version    status
             R      4.0.0         -
     PowerTOST 1.4.9.9999  required
       mvtnorm      1.1.0  required
         stats      4.0.0  required
         utils      4.0.0  required
      graphics      4.0.0  required
     grDevices      4.0.0  required
      cubature      2.0.4  required
 TeachingDemos       2.12  required
      crossdes      1.1.1 suggested
      devtools      2.3.0 suggested

If you have [image] <4.0.0, I suggest to update. Then copy the entire library-folder of the old installation over the new installation. When asked whether newer files should be overwritten, answer No. Open the console of the new [image] and execute:
  update.packages(checkBuilt = TRUE, ask = FALSE)
Once done, it should look similar to mine. 1.4.9.9999 is the development version of PowerTOST; on your machine it should be 1.4.9. If one is missing (<NA> in the column version), download/install it.
To get more information about you installation, execute:
  devtools::session_info()
On my machine:
- Session info ---------------------------------------------------------------
 setting  value                       
 version  R version 4.0.0 (2020-04-24)
 os       Windows 7 x64 SP 1         
 system   x86_64, mingw32             
 ui       Rgui                       
 language EN                         
 collate  German_Germany.1252         
 ctype    German_Germany.1252         
 tz       Europe/Vienna               
 date     2020-05-12                 

- Packages -------------------------------------------------------------------
 package       * version    date       lib source       
 assertthat      0.2.1      2019-03-21 [1] CRAN (R 4.0.0)
 backports       1.1.6      2020-04-05 [1] CRAN (R 4.0.0)
 callr           3.4.3      2020-03-28 [1] CRAN (R 4.0.0)
 cli             2.0.2      2020-02-28 [1] CRAN (R 4.0.0)
 crayon          1.3.4      2017-09-16 [1] CRAN (R 4.0.0)
 cubature        2.0.4      2019-12-04 [1] CRAN (R 4.0.0)
 desc            1.2.0      2018-05-01 [1] CRAN (R 4.0.0)
 devtools        2.3.0      2020-04-10 [1] CRAN (R 4.0.0)
 digest          0.6.25     2020-02-23 [1] CRAN (R 4.0.0)
 ellipsis        0.3.0      2019-09-20 [1] CRAN (R 4.0.0)
 fansi           0.4.1      2020-01-08 [1] CRAN (R 4.0.0)
 fs              1.4.1      2020-04-04 [1] CRAN (R 4.0.0)
 glue            1.4.0      2020-04-03 [1] CRAN (R 4.0.0)
 magrittr        1.5        2014-11-22 [1] CRAN (R 4.0.0)
 memoise         1.1.0      2017-04-21 [1] CRAN (R 4.0.0)
 mvtnorm         1.1-0      2020-02-24 [1] CRAN (R 4.0.0)
 pkgbuild        1.0.8      2020-05-07 [1] CRAN (R 4.0.0)
 pkgload         1.0.2      2018-10-29 [1] CRAN (R 4.0.0)
 PowerTOST     * 1.4.9.9999 2020-05-11 [1] local         
 prettyunits     1.1.1      2020-01-24 [1] CRAN (R 4.0.0)
 processx        3.4.2      2020-02-09 [1] CRAN (R 4.0.0)
 ps              1.3.3      2020-05-08 [1] CRAN (R 4.0.0)
 R6              2.4.1      2019-11-12 [1] CRAN (R 4.0.0)
 Rcpp            1.0.4.6    2020-04-09 [1] CRAN (R 4.0.0)
 remotes         2.1.1      2020-02-15 [1] CRAN (R 4.0.0)
 rlang           0.4.6      2020-05-02 [1] CRAN (R 4.0.0)
 rprojroot       1.3-2      2018-01-03 [1] CRAN (R 4.0.0)
 sessioninfo     1.1.1      2018-11-05 [1] CRAN (R 4.0.0)
 TeachingDemos   2.12       2020-04-07 [1] CRAN (R 4.0.0)
 testthat        2.3.2      2020-03-02 [1] CRAN (R 4.0.0)
 usethis         1.6.1      2020-04-29 [1] CRAN (R 4.0.0)
 withr           2.2.0      2020-04-20 [1] CRAN (R 4.0.0)

[1] D:/Program Files/R/R-4.0.0/library

Likely your list will be shorter; please post here what you got.


PS: When you post code/output, please embed it within the respective BBCode. With active JavaScript highlight the text in the message-area and click on the Button Code. THX.

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
d_labes
★★★

Berlin, Germany,
2020-05-13 13:34
(1415 d 05:36 ago)

@ Helmut
Posting: # 21431
Views: 6,711
 

 Tracking down error: stringsAsFactors

Dear Helmut, dear Alyssa!

❝ ❝ Then i continued with the following command but it appeared error: […]


❝ Let’s try to figure it out. Execute this code:

❝ ...

❝ res <- data.frame(design = rep(designs, each = length(target)),

❝ target = target, n = NA, power = NA)


This line is the casus knacktus!
The error
Error in match.arg(design) : 'arg' must be NULL or a character vector
means that the design argument in the call of sampleN.scABEL() is not character.
Reason:
Before R4.0.0 the optional argument stringsAsFactors in the call of data.frame() was TRUE. Changed in R4.0.0 to FALSE.
Check this in your installation via
default.stringsAsFactors()
If you get TRUE as answer change
res     <- data.frame(design = rep(designs, each = length(target)),
                      target = target, n = NA, power = NA,
                      stringsAsFactors = FALSE)

and than I'm sure that it works.

All the best

Regards,

Detlew
Helmut
★★★
avatar
Homepage
Vienna, Austria,
2020-05-13 14:07
(1415 d 05:03 ago)

@ d_labes
Posting: # 21432
Views: 6,764
 

 R <4.0.0

Dear Detlew,

oh, f**k! I forgot that users may not have updated yet.

Shall we add a line to PowerTOST’s functions as a precaution?
  if (is.factor(design)) design <- as.character(design)

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
ElMaestro
★★★

Denmark,
2020-05-13 16:18
(1415 d 02:53 ago)

@ Helmut
Posting: # 21433
Views: 6,642
 

 R <4.0.0

Doh!:-D:-D:-D:-D:-D:-D

Pass or fail!
ElMaestro
Helmut
★★★
avatar
Homepage
Vienna, Austria,
2020-05-13 16:21
(1415 d 02:49 ago)

@ ElMaestro
Posting: # 21434
Views: 6,633
 

 R <4.0.0?

[image] [image] © Helmut Schütz 2012
»Dead as a Dodo«

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
d_labes
★★★

Berlin, Germany,
2020-05-13 20:50
(1414 d 22:20 ago)

@ Helmut
Posting: # 21435
Views: 6,606
 

 PowerTOST’s functions with as.character(design)

Dear Helmut,

❝ oh, f**k! I forgot that users may not have updated yet.


Don't worry. Many R users are fallen or will fall into this trap I think, amongst others me.

❝ Shall we add a line to PowerTOST’s functions as a precaution?

  if (is.factor(design)) design <- as.character(design)


Not a bad idea. But don't really know if this is absolutely necessary and if it pays the effort.

Regards,

Detlew
Helmut
★★★
avatar
Homepage
Vienna, Austria,
2020-05-13 20:55
(1414 d 22:15 ago)

@ d_labes
Posting: # 21436
Views: 6,601
 

 PowerTOST’s functions with as.character(design)

Dear Detlew,

❝ Don't worry. Many R users are fallen or will fall into this trap I think, amongst others me.


Count me in.

❝ ❝ Shall we add a line to PowerTOST’s functions as a precaution?

❝ ❝   if (is.factor(design)) design <- as.character(design)


❝ Not a bad idea. But don't really know if this is absolutely necessary and if it pays the effort.


It’s easy for us. But you’re right: Duno how many times a user would set up a data.frame and call the design-argument in a loop.

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
Alyssa
☆    

Malaysia,
2020-05-15 07:08
(1413 d 12:02 ago)

@ Helmut
Posting: # 21438
Views: 6,676
 

 Tracking down error

Hi Helmut and d_labes,

Sorry for late reply because i din't receive email notification i thought no one has reply to my query yet until i login just now.

I followed your instructions and yeah...finally i could get the sample size estimation !!!! so happy!:rotfl:

I dint get to try the below command because i have updated the programme to R 4.0.0

res     <- data.frame(design = rep(designs, each = length(target)),
                      target = target, n = NA, power = NA,
                      stringsAsFactors = FALSE)


When i run devtools::session_info(), this is what i get:-

- Session info ---------------------------------------------------------------
 setting  value                       
 version  R version 4.0.0 (2020-04-24)
 os       Windows 10 x64             
 system   x86_64, mingw32             
 ui       Rgui                       
 language (EN)                       
 collate  English_Malaysia.1252       
 ctype    English_Malaysia.1252       
 tz       Asia/Kuala_Lumpur           
 date     2020-05-15                 

- Packages -------------------------------------------------------------------
 package       * version date       lib source       
 assertthat      0.2.1   2019-03-21 [1] CRAN (R 4.0.0)
 backports       1.1.6   2020-04-05 [1] CRAN (R 4.0.0)
 callr           3.4.3   2020-03-28 [1] CRAN (R 4.0.0)
 cli             2.0.2   2020-02-28 [1] CRAN (R 4.0.0)
 crayon          1.3.4   2017-09-16 [1] CRAN (R 4.0.0)
 cubature        2.0.4   2019-12-04 [1] CRAN (R 4.0.0)
 desc            1.2.0   2018-05-01 [1] CRAN (R 4.0.0)
 devtools        2.3.0   2020-04-10 [1] CRAN (R 4.0.0)
 digest          0.6.25  2020-02-23 [1] CRAN (R 4.0.0)
 ellipsis        0.3.0   2019-09-20 [1] CRAN (R 4.0.0)
 fansi           0.4.1   2020-01-08 [1] CRAN (R 4.0.0)
 fs              1.4.1   2020-04-04 [1] CRAN (R 4.0.0)
 glue            1.4.0   2020-04-03 [1] CRAN (R 4.0.0)
 htmltools       0.4.0   2019-10-04 [1] CRAN (R 4.0.0)
 knitr           1.28    2020-02-06 [1] CRAN (R 4.0.0)
 magrittr        1.5     2014-11-22 [1] CRAN (R 4.0.0)
 memoise         1.1.0   2017-04-21 [1] CRAN (R 4.0.0)
 mvtnorm         1.1-0   2020-02-24 [1] CRAN (R 4.0.0)
 pkgbuild        1.0.8   2020-05-07 [1] CRAN (R 4.0.0)
 pkgload         1.0.2   2018-10-29 [1] CRAN (R 4.0.0)
 PowerTOST     * 1.4-9   2019-12-19 [1] CRAN (R 4.0.0)
 prettyunits     1.1.1   2020-01-24 [1] CRAN (R 4.0.0)
 processx        3.4.2   2020-02-09 [1] CRAN (R 4.0.0)
 ps              1.3.3   2020-05-08 [1] CRAN (R 4.0.0)
 R6              2.4.1   2019-11-12 [1] CRAN (R 4.0.0)
 Rcpp            1.0.4.6 2020-04-09 [1] CRAN (R 4.0.0)
 remotes         2.1.1   2020-02-15 [1] CRAN (R 4.0.0)
 rlang           0.4.6   2020-05-02 [1] CRAN (R 4.0.0)
 rprojroot       1.3-2   2018-01-03 [1] CRAN (R 4.0.0)
 sessioninfo     1.1.1   2018-11-05 [1] CRAN (R 4.0.0)
 TeachingDemos   2.12    2020-04-07 [1] CRAN (R 4.0.0)
 testthat        2.3.2   2020-03-02 [1] CRAN (R 4.0.0)
 tufte           0.6     2020-05-08 [1] CRAN (R 4.0.0)
 usethis         1.6.1   2020-04-29 [1] CRAN (R 4.0.0)
 withr           2.2.0   2020-04-20 [1] CRAN (R 4.0.0)
 xfun            0.13    2020-04-13 [1] CRAN (R 4.0.0)

[2] C:/Program Files/R/R-4.0.0/library


Thank you and Cheers~~ :-D:party:
Helmut
★★★
avatar
Homepage
Vienna, Austria,
2020-05-15 12:52
(1413 d 06:18 ago)

@ Alyssa
Posting: # 21439
Views: 6,476
 

 All’s well that ends well.

Hi Alyssa,

❝ Sorry for late reply because i din't receive email notification …


You didn’t tick the box
E-mail notification if there has been a reply to this message
See also there.
However, that’s not ideal because you will miss other replies (i.e., not directly addressed to you). Consider to subscribe the thread.

❝ … i thought no one has reply to my query yet until i login just now.


You don’t have to login to read posts in the forum. I suggest to bookmark the Latest Posts.

❝ I followed your instructions and yeah...finally i could get the sample size estimation !!!! so happy!:rotfl:


:-D

❝ When i run devtools::session_info(), this is what i get: […]



Perfect!

❝ Thank you and Cheers~~ :-D:party:


You are welcome!

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
UA Flag
Activity
 Admin contact
22,957 posts in 4,819 threads, 1,638 registered users;
74 visitors (0 registered, 74 guests [including 9 identified bots]).
Forum time: 18:11 CET (Europe/Vienna)

Nothing shows a lack of mathematical education more
than an overly precise calculation.    Carl Friedrich Gauß

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