pharm07
☆    

India,
2022-05-03 13:23
(713 d 23:01 ago)

Posting: # 22953
Views: 2,512
 

 Estimation of sample size for NIT using ISCV By R [Power / Sample Size]

Hi,

Can anyone guide, how to calculate sample size for NTI category drug using R software? I have primary information as ISCV.


Edit: Category changed; see also this post #1[Helmut]

Regards,
pharm07
dshah
★★  

India/United Kingdom,
2022-05-03 15:04
(713 d 21:20 ago)

@ pharm07
Posting: # 22954
Views: 2,335
 

 Estimation of sample size for NTI using ISCV By R

Hello Pharm07!
Kindly use PowerTOST and also search for earlier post.
Regards,
Dshah
Helmut
★★★
avatar
Homepage
Vienna, Austria,
2022-05-03 16:38
(713 d 19:46 ago)

@ pharm07
Posting: # 22955
Views: 2,112
 

 PowerTOST

Hi pharm07,

as suggested by Dshah, assuming a T/R-ratio of 0.975 and a CV of 0.1:

library(PowerTOST) # attach the library
theta0 <- 0.975    # assumed T/R-ratio
CV     <- 0.10     # intra-subject CV (assuming CVwT = CVwR)
target <- 0.80     # target power
design <- "2x2x4"  # 4-period full replicate mandatory for the FDA

# EMA and most others:
sampleN.TOST(CV = CV, theta0 = theta0, theta1 = 0.90,
             design = design, targetpower = target)

+++++++++++ Equivalence test - TOST +++++++++++
            Sample size estimation
-----------------------------------------------
Study design: 2x2x4 (4 period full replicate)
log-transformed data (multiplicative model)

alpha = 0.05, target power = 0.8
BE margins = 0.9 ... 1.111111
True ratio = 0.975,  CV = 0.1

Sample size (total)
 n     power
12   0.856278


# FDA and China CDE:
sampleN.NTID(CV = CV, theta0 = theta0, design = design,
             targetpower = target)

+++++++++++ FDA method for NTIDs ++++++++++++
           Sample size estimation
---------------------------------------------
Study design:  2x2x4 (TRTR|RTRT)
log-transformed data (multiplicative model)
1e+05 studies for each step simulated.

alpha  = 0.05, target power = 0.8
CVw(T) = 0.1, CVw(R) = 0.1
True ratio     = 0.975
ABE limits     = 0.8 ... 1.25
Implied scABEL = 0.9002 ... 1.1108
Regulatory settings: FDA
- Regulatory const. = 1.053605
- 'CVcap'           = 0.2142

Sample size search
 n     power
14   0.717480
16   0.788690
18   0.841790


# Beware of unequival variances!
CV.bad  <- signif(CVp2CV(CV, ratio = 1.5), 4)     # T worse than R
sampleN.NTID(CV = CV.bad, theta0 = theta0, design = design,
             targetpower = target)

+++++++++++ FDA method for NTIDs ++++++++++++
           Sample size estimation
---------------------------------------------
Study design:  2x2x4 (TRTR|RTRT)
log-transformed data (multiplicative model)
1e+05 studies for each step simulated.

alpha  = 0.05, target power = 0.8
CVw(T) = 0.1096, CVw(R) = 0.0894
True ratio     = 0.975
ABE limits     = 0.8 ... 1.25
Implied scABEL = 0.9103 ... 1.0986
Regulatory settings: FDA
- Regulatory const. = 1.053605
- 'CVcap'           = 0.2142

Sample size search
 n     power
20   0.758770
22   0.805070


CV.good <- signif(CVp2CV(CV, ratio = 1 / 1.5), 4) # T better than R
sampleN.NTID(CV = CV.good, theta0 = theta0, design = design,
             targetpower = target)

+++++++++++ FDA method for NTIDs ++++++++++++
           Sample size estimation
---------------------------------------------
Study design:  2x2x4 (TRTR|RTRT)
log-transformed data (multiplicative model)
1e+05 studies for each step simulated.

alpha  = 0.05, target power = 0.8
CVw(T) = 0.0894, CVw(R) = 0.1096
True ratio     = 0.975
ABE limits     = 0.8 ... 1.25
Implied scABEL = 0.8912 ... 1.1220
Regulatory settings: FDA
- Regulatory const. = 1.053605
- 'CVcap'           = 0.2142

Sample size search
 n     power
12   0.735990
14   0.814770


More details and examples in this article.

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

India,
2022-05-04 10:08
(713 d 02:16 ago)

@ Helmut
Posting: # 22958
Views: 2,207
 

 PowerTOST

HI Helmut,

Thanks for the information.

After installing package from local file, (https://cloud.r-project.org/)

response in R console : > utils:::menuInstallLocal()
package ‘PowerTOST’ successfully unpacked and MD5 sums checked

Even after this step i am not able to attach power tost to the library.

After this step i can able to do further.

[Using R 4.2.0]
Please suggest.

Regards,
pharm07
Helmut
★★★
avatar
Homepage
Vienna, Austria,
2022-05-04 12:33
(712 d 23:50 ago)

@ pharm07
Posting: # 22959
Views: 2,100
 

 PowerTOST

Hi pharm07,

❝ response in R console : > utils:::menuInstallLocal()

package ‘PowerTOST’ successfully unpacked and MD5 sums checked


OK, so you ended up as shown there (example for Power2Stage).

❝ Even after this step i am not able to attach power tost to the library.


Package library. Not sure what you mean, can you explain?

❝ After this step i can able to do further.


OK.

❝ Please suggest.


Copy one of the examples of my previous post and paste it to the [image] console. If you want to go for the FDA’s method, just a one-liner because theta0 = 0.975, design = "2x2x4", and targetpower = 0.8 are defaults of the function. Hence, you have to specify only the CV:

sampleN.NTID(CV = 0.1)

Should give:

+++++++++++ FDA method for NTIDs ++++++++++++
           Sample size estimation
---------------------------------------------
Study design:  2x2x4 (TRTR|RTRT)
log-transformed data (multiplicative model)
1e+05 studies for each step simulated.

alpha  = 0.05, target power = 0.8
CVw(T) = 0.1, CVw(R) = 0.1
True ratio     = 0.975
ABE limits     = 0.8 ... 1.25
Implied scABEL = 0.9002 ... 1.1108
Regulatory settings: FDA
- Regulatory const. = 1.053605
- 'CVcap'           = 0.2142

Sample size search
 n     power
14   0.717480
16   0.788690
18   0.841790


Since this is a four-period design, you may want to increase the sample size to compensate for a potential loss in power due to dropouts.

balance <- function(n, n.seq) {
  # Round up to obtain balanced sequences
  return(as.integer(n.seq * (n %/% n.seq + as.logical(n %% n.seq))))
}
nadj <- function(n, do.rate, n.seq) {
  # Round up to compensate for anticipated dropout-rate
  return(as.integer(balance(n / (1 - do.rate), n.seq)))
}
CV      <- 0.1                 # Assumed CV
do.rate <- 0.15                # Anticipated dropout-rate 15%
n       <- sampleN.NTID(CV = CV, print = FALSE, details = FALSE)[["Sample size"]]
dosed   <- nadj(n, do.rate, 2) # Adjust the sample size
df      <- data.frame(dosed = dosed, eligible = dosed:(n - 2))
for (j in 1:nrow(df)) {
  df$dropouts[j] <- sprintf("%.1f%%", 100 * (1 - df$eligible[j] / df$dosed[j]))
  df$power[j]    <- suppressMessages( # We know that some are unbalanced
                      power.NTID(CV = CV, n = df$eligible[j]))
}
print(df, row.names = FALSE)

 dosed eligible dropouts   power
    22       22     0.0% 0.91017
    22       21     4.5% 0.89602
    22       20     9.1% 0.88031
    22       19    13.6% 0.86072
    22       18    18.2% 0.84179
    22       17    22.7% 0.81658
    22       16    27.3% 0.78869


If you are confused, see there.

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

India,
2022-05-04 16:54
(712 d 19:30 ago)

@ Helmut
Posting: # 22961
Views: 2,129
 

 PowerTOST

Hi,

Package library. Not sure what you mean, can you explain?


I meant i was not able to execute library(PowerTOST) command.


Now, i am able to estimate sample size..!

Your guidance is much more appreciable.

Thanks.. :-)

Regards,
pharm07
pharm07
☆    

India,
2022-05-11 07:30
(706 d 04:54 ago)

@ pharm07
Posting: # 22968
Views: 1,946
 

 PowerTOST

Hi Helmut,

Let me understand again by looking following framework,
Following data is available with me,
Target power : eg, 0.8, .85, 0.9, CwT,CwR,sigWT,SigWR,theta0,theta1,theta2.
i want to estimate sample size for low to moderate NTID. Also to estimate sample size by assuming 30 & 40 % dropout rate.
I have gone through the examples. Sometimes error comes as its beyond implied limit. Heteroscedasticity can be challenging for me as T>R.

Can you check and verify if i am using correct programming. This Example.

Regards,
pharm07
Helmut
★★★
avatar
Homepage
Vienna, Austria,
2022-05-11 15:19
(705 d 21:05 ago)

@ pharm07
Posting: # 22970
Views: 1,908
 

 PowerTOST: sampleN.NTID()

Hi pharm07,

❝ Let me understand again by looking following framework,

❝ Following data is available with me,

❝ Target power : eg, 0.8, .85, 0.9, CwT,CwR,sigWT,SigWR,theta0,theta1,theta2.


Although you could give values of theta1 and theta2, for the FDA keep the defaults of 0.8 and 1.25 (i.e., don’t specify anything): Additionally to passing RSABE and the variance-comparison you must pass conventional ABE.

❝ i want to estimate sample size for low to moderate NTID.


More examples are given there.

❝ Also to estimate sample size by assuming 30 & 40 % dropout rate.


See the two supportive functions in the section about dropouts in the named article.

❝ I have gone through the examples. Sometimes error comes as its beyond implied limit.


That’s possible if you specify a low or high theta0. Background: $$\eqalign{s_0&=0.1\tag{1}\\
\theta_\text{s}&=\frac{\log_e(1/0.9)}{s_0}\approx1.053605\ldots\\
\left\{\theta_{\text{s}_1},\theta_{\text{s}_2}\right\}&=\exp(\mp\theta_\text{s}\cdot s_\text{wR}),
}$$ where \(\small{s_0}\) is the regulatory switching condition, \(\small{\theta_\text{s}}\) the regulatory constant, and finally \(\small{\left\{\theta_{\text{s}_1},\theta_{\text{s}_2}\right\}}\) are the implied limits. Say, you assume \(\small{CV_\text{wR}=0.1}\). Since $$s_\text{wR}=\sqrt{\log_e(CV_\text{wR}^2+1)}\tag{2}$$ and by using \(\small{(1)}\) you end up with $$\left\{\theta_{\text{s}_1},\theta_{\text{s}_2}\right\}=\left\{0.9002,1.1108\right\}.\tag{3}$$ In other words, for this \(\small{CV_\text{wR}}\) any theta0 outside these limits cannot work. That’s by design:

library(PowerTOST)
sampleN.NTID(CV = 0.1, theta0 = 0.90)

+++++++++++ FDA method for NTIDs ++++++++++++
           Sample size estimation
---------------------------------------------
Study design:  2x2x4 (TRTR|RTRT)
log-transformed data (multiplicative model)
1e+05 studies for each step simulated.

alpha  = 0.05, target power = 0.8
CVw(T) = 0.1, CVw(R) = 0.1
True ratio     = 0.9
ABE limits     = 0.8 ... 1.25
Implied scABEL = 0.9002 ... 1.1108
Regulatory settings: FDA
- Regulatory const. = 1.053605
- 'CVcap'           = 0.2142

Error: theta0 outside implied scABE limits! No sample size estimable.


Would you want to estimate a sample size for conventional ABE with a T/R-ratio outside 80–125%? Try:

sampleN.TOST(CV = 0.1, theta0 = 0.7999) # any (!) CV, targetpower, design


For NTIDs the FDA requires stricter batch-release spec’s (±5% instead of the common ±10%). There­fore, theta0 = 0.975 is the default of this function. I would not go below 0.95 unless the CV is relatively high (no scaling if \(\small{CV_\text{wR}\geq0.2142}\)).

❝ Heteroscedasticity can be challenging for me as T>R.


Yes, you are not alone.

❝ Can you check and verify if i am using correct programming.


I can’t till you post an example which you consider problematic.

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

India,
2022-05-18 07:18
(699 d 05:05 ago)

@ Helmut
Posting: # 22995
Views: 1,832
 

 PowerTOST: sampleN.NTID()

Hi Helmut,

❝ Although you could give values of theta1 and theta2, for the FDA keep the defaults of 0.8 and 1.25 (i.e., don’t specify anything): Additionally to passing RSABE and the variance-comparison you must pass conventional ABE.


OK. Noted.

❝ More examples are given there.


OK. I referred these examples.

❝ See the two supportive functions in the section about dropouts in the named article.


Ok, I have pasted one example which i seems to be work upon.

❝ That’s possible if you specify a low or high theta0.


OK.

❝ Yes, you are not alone.

:ponder:

❝ I can’t till you post an example which you consider problematic.


Please see below example,
Note : CV is not in scalar form.'

sampleN.NTID(CV = c(0.045,0.07), theta0 = 0.95, targetpower = 0.9)

+++++++++++ FDA method for NTIDs ++++++++++++
           Sample size estimation
---------------------------------------------
Study design:  2x2x4 (TRTR|RTRT)
log-transformed data (multiplicative model)
1e+05 studies for each step simulated.

alpha  = 0.05, target power = 0.9
CVw(T) = 0.045, CVw(R) = 0.07
True ratio     = 0.95
ABE limits     = 0.8 ... 1.25
Implied scABEL = 0.9290 ... 1.0764
Regulatory settings: FDA
- Regulatory const. = 1.053605
- 'CVcap'           = 0.2142

Sample size search
 n     power
92   0.875810
94   0.882090
96   0.888810
98   0.894060
100   0.898510
102   0.903540


# with 30% DO rate,

# as CV was specified as Vector,
# is following steps right?
balance <- function(n, n.seq) {
  # Round up to obtain balanced sequences
  return(as.integer(n.seq * (n %/% n.seq + as.logical(n %% n.seq))))
}
nadj <- function(n, do.rate, n.seq) {
  # Round up to compensate for anticipated dropout-rate
  return(as.integer(balance(n / (1 - do.rate), n.seq)))
}
CV      <- 0.045               # Assumed CV # how to specify vector CV here?
do.rate <- 0.30                # Anticipated dropout-rate 30%
n       <- sampleN.NTID(CV = CV, print = FALSE, details = FALSE)[["Sample size"]]
dosed   <- nadj(n, do.rate, 2) # Adjust the sample size
df      <- data.frame(dosed = dosed, eligible = dosed:(n - 2))
for (j in 1:nrow(df)) {
  df$dropouts[j] <- sprintf("%.1f%%", 100 * (1 - df$eligible[j] / df$dosed[j]))
  df$power[j]    <- suppressMessages( # We know that some are unbalanced
                      power.NTID(CV = CV, n = df$eligible[j]))
}
print(df, row.names = FALSE)
dosed eligible dropouts   power
   58       58     0.0% 0.92040
   58       57     1.7% 0.91575
   58       56     3.4% 0.91254
   58       55     5.2% 0.90722
   58       54     6.9% 0.90364
   58       53     8.6% 0.89761
   58       52    10.3% 0.89257
   58       51    12.1% 0.88767
   58       50    13.8% 0.88215
   58       49    15.5% 0.87672
   58       48    17.2% 0.86952
   58       47    19.0% 0.86376
   58       46    20.7% 0.85690
   58       45    22.4% 0.84922
   58       44    24.1% 0.84310
   58       43    25.9% 0.83486
   58       42    27.6% 0.82810
   58       41    29.3% 0.81915
   58       40    31.0% 0.81109
   58       39    32.8% 0.80105
   58       38    34.5% 0.79410


Kindly guide me with this example, i want to check whether i am making a mistake or not.:confused:

Regards,
pharm07
Helmut
★★★
avatar
Homepage
Vienna, Austria,
2022-05-18 16:30
(698 d 19:54 ago)

@ pharm07
Posting: # 23002
Views: 1,818
 

 sampleN.NTID(): Example

Hi pharm07,

❝ Kindly guide me with this example, i want to check whether i am making a mistake or not.:confused:


In your second script you forgot to state theta0 = 0.95. Hence, the default theta = 0.975 was employed.

library(PowerTOST)
balance <- function(n, n.seq) {
  # Round up to obtain balanced sequences
  return(as.integer(n.seq * (n %/% n.seq + as.logical(n %% n.seq))))
}
nadj <- function(n, do.rate, n.seq) {
  # Round up to compensate for anticipated dropout-rate
  return(as.integer(balance(n / (1 - do.rate), n.seq)))
}
CV      <- c(0.045, 0.07)      # First element CVwT, second CVwR
do.rate <- 0.30                # Anticipated dropout-rate 30%
n       <- sampleN.NTID(CV = CV, theta0 = 0.95, targetpower = 0.90,
                        print = FALSE, details = FALSE)[["Sample size"]]
dosed   <- nadj(n, do.rate, 2) # Adjust the sample size
df      <- data.frame(dosed = dosed, eligible = dosed:(n - 2))
for (j in 1:nrow(df)) {
  df$dropouts[j] <- sprintf("%.1f%%", 100 * (1 - df$eligible[j] / df$dosed[j]))
  df$power[j]    <- suppressMessages(
                      power.NTID(CV = CV, theta0 = 0.95, n = df$eligible[j]))
}
print(df, row.names = FALSE)

 dosed eligible dropouts   power
   146      146     0.0% 0.97046
   146      145     0.7% 0.96815
   146      144     1.4% 0.96887
   146      143     2.1% 0.96730
   146      142     2.7% 0.96592
   146      141     3.4% 0.96512
   146      140     4.1% 0.96470
   146      139     4.8% 0.96316
   146      138     5.5% 0.96322
   146      137     6.2% 0.96172
   146      136     6.8% 0.96048
   146      135     7.5% 0.95969
   146      134     8.2% 0.95892
   146      133     8.9% 0.95649
   146      132     9.6% 0.95497
   146      131    10.3% 0.95505
   146      130    11.0% 0.95347
   146      129    11.6% 0.95245
   146      128    12.3% 0.95101
   146      127    13.0% 0.94969
   146      126    13.7% 0.94851
   146      125    14.4% 0.94723
   146      124    15.1% 0.94594
   146      123    15.8% 0.94386
   146      122    16.4% 0.94258
   146      121    17.1% 0.94121
   146      120    17.8% 0.94039
   146      119    18.5% 0.93931
   146      118    19.2% 0.93649
   146      117    19.9% 0.93461
   146      116    20.5% 0.93393
   146      115    21.2% 0.93164
   146      114    21.9% 0.92946
   146      113    22.6% 0.92741
   146      112    23.3% 0.92519
   146      111    24.0% 0.92361
   146      110    24.7% 0.92132
   146      109    25.3% 0.91851
   146      108    26.0% 0.91725
   146      107    26.7% 0.91563
   146      106    27.4% 0.91393
   146      105    28.1% 0.91186
   146      104    28.8% 0.90848
   146      103    29.5% 0.90711
   146      102    30.1% 0.90354
   146      101    30.8% 0.90250
   146      100    31.5% 0.89851

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

India,
2022-05-19 07:36
(698 d 04:48 ago)

@ Helmut
Posting: # 23003
Views: 2,102
 

 sampleN.NTID(): Example

Hi Helmut,

I got it..!

Thanks for the interaction and time :ok:

Regards,
pharm07
UA Flag
Activity
 Admin contact
22,984 posts in 4,822 threads, 1,649 registered users;
48 visitors (0 registered, 48 guests [including 6 identified bots]).
Forum time: 12:24 CEST (Europe/Vienna)

You can’t fix by analysis
what you bungled by design.    Richard J. Light, Judith D. Singer, John B. Willett

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