diff --git a/README.Rmd b/README.Rmd
index 46ecb16..d6ab5d1 100644
--- a/README.Rmd
+++ b/README.Rmd
@@ -9,6 +9,7 @@ always_allow_html: yes
```{r, include = FALSE, cache = FALSE}
+library(cTOST)
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
@@ -34,34 +35,124 @@ asciicast::init_knitr_engine(
[![CRAN RStudio mirror downloads](https://cranlogs.r-pkg.org/badges/grand-total/cTOST)](https://www.r-pkg.org/pkg/cTOST)
-## `cTOST` Overview
+## 1. `cTOST` Overview
-This R package contains the functions to test equivalence in univariate and multivariate settings based on the Two One-Sided Tests (TOST). In addition, the package contains different corrective procedures applied to the standard TOST in order to adjust the size of the procedure at the desired nominal level leading to more powerful procedures. This package implements the $\alpha$-TOST and $\delta$-TOST methods proposed in Boulaguiem et al. (2024a) and in Boulaguiem et al. (2024b).
+This R package contains functions for testing equivalence in both univariate and multivariate settings, based on the Two One-Sided Tests (TOST). The `cTOST` package implements the $\alpha$-TOST and $\delta$-TOST methods proposed by Boulaguiem et al. (2024a, 2024b). These two corrective procedures that can be applied to the standard TOST to adjust the size of the procedure to the desired nominal level, resulting in more powerful procedures.
-## Install Instructions
+## 2. Install Instructions
-The `cTOST` package is available on GitHub at the moment. It is subject to ongoing updates that may lead to stability issues.
+The `cTOST` package is available on cran and on GitHub. The version on GitHub is subject to ongoing updates that may lead to stability issues.
-In order to install the package, it is required to pre-install the `devtools` dependency. Run the following command if you do not have it already installed:
+The package can from cran as follows:
-```{r, eval=FALSE}
-install.packages("devtools")
+```{r, eval = F}
+install.packages("cTOST")
```
-The package is then installed with the following command:
+The package can also be install from GitHub using the `devtools` package:
```{r, eval=FALSE}
+install.packages("devtools")
devtools::install_github("stephaneguerrier/cTOST")
```
Note that Windows users are assumed that have Rtools installed (if this is not the case, please visit this [link](https://cran.r-project.org/bin/windows/Rtools/).
-## How to use
+## 3. How to use
+
+We provide here a few examples on the usage of the `cTOST` package. More information can be found here: ???
+
+### 3.1. Univariate settings
+
+To illustrate the use of the proposed method in the univariate settings, we consider the `skin` dataset analyzed in Boulaguiem et al. (2024a), which can be loaded as follows:
+
+```{r}
+data(skin)
+theta_hat = diff(apply(skin,2,mean))
+nu = nrow(skin) - 1
+sig_hat = sd(apply(skin,1,diff))/sqrt(nu)
+```
+
+### 3.1.1. Standard TOST
+
+The standard TOST can be used as follows:
+
+```{r, eval = F}
+stost = tost(theta = theta_hat, sigma = sig_hat, nu = nu, delta = log(1.25))
+stost
+```
+
+```{asciicast}
+library(cTOST)
+data(skin)
+theta_hat = diff(apply(skin,2,mean))
+nu = nrow(skin) - 1
+sig_hat = sd(apply(skin,1,diff))/sqrt(nu)
+stost = tost(theta = theta_hat, sigma = sig_hat, nu = nu, delta = log(1.25))
+stost
+```
+
+#### 3.1.2. $\alpha$-TOST
+
+The $\alpha$-TOST can be used through the function `ctost` as follows:
+
+```{r, eval = F}
+atost = ctost(theta = theta_hat, sigma = sig_hat, nu = nu,
+ delta = log(1.25), method = "alpha")
+atost
+```
+
+```{asciicast}
+library(cTOST)
+data(skin)
+theta_hat = diff(apply(skin,2,mean))
+nu = nrow(skin) - 1
+sig_hat = sd(apply(skin,1,diff))/sqrt(nu)
+atost = ctost(theta = theta_hat, sigma = sig_hat, nu = nu, delta = log(1.25), method = "alpha")
+atost
+```
+
+It is possible to compare the results of the $\alpha$-TOST (or $\delta$-TOST, see below) with the standard TOST as follows:
+
+```{r, eval = F}
+compare_to_tost(atost)
+```
+
+```{asciicast}
+library(cTOST)
+data(skin)
+theta_hat = diff(apply(skin,2,mean))
+nu = nrow(skin) - 1
+sig_hat = sd(apply(skin,1,diff))/sqrt(nu)
+atost = ctost(theta = theta_hat, sigma = sig_hat, nu = nu, delta = log(1.25), method = "alpha")
+compare_to_tost(atost)
+```
+
+### 3.1.3. $\delta$-TOST
+
+The $\delta$-TOST can be used through the function `ctost` as follows:
+
+```{r}
+dtost = ctost(theta = theta_hat, sigma = sig_hat, nu = nu,
+ delta = log(1.25), method = "delta")
+dtost
+```
+
+```{asciicast}
+library(cTOST)
+data(skin)
+theta_hat = diff(apply(skin,2,mean))
+nu = nrow(skin) - 1
+sig_hat = sd(apply(skin,1,diff))/sqrt(nu)
+dtost = ctost(theta = theta_hat, sigma = sig_hat, nu = nu, delta = log(1.25), method = "delta")
+dtost
+```
-TO DO
+### 3.2. Multivariate settings
+COMING SOON
-## How to cite
+## 4. How to cite
```{}
@Manual{boulaguiem2024ctost,
@@ -73,11 +164,11 @@ TO DO
}
```
-## License
+## 5. License
The license this source code is released under is the GNU AFFERO GENERAL PUBLIC LICENSE (AGPL) v3.0. Please see the LICENSE file for full text. Otherwise, please consult [GNU](https://www.gnu.org/licenses/agpl-3.0.en.html) which will provide a synopsis of the restrictions placed upon the code.
-## References
+## 6. References
Boulaguiem, Y., Quartier, J., Lapteva, M., Kalia, Y. N., Victoria-Feser, M. P., Guerrier, S. & Couturier, D. L., "*Finite Sample Adjustments for Average Equivalence Testing*", Statistics in Medicine, 2024a, [https://doi.org/10.1002/sim.9993]( https://doi.org/10.1002/sim.9993).
diff --git a/README.md b/README.md
index 566fc6a..18e08b3 100644
--- a/README.md
+++ b/README.md
@@ -14,32 +14,32 @@ downloads](http://cranlogs.r-pkg.org/badges/cTOST)](https://www.r-pkg.org/pkg/cT
downloads](https://cranlogs.r-pkg.org/badges/grand-total/cTOST)](https://www.r-pkg.org/pkg/cTOST)
-## `cTOST` Overview
+## 1. `cTOST` Overview
-This R package contains the functions to test equivalence in univariate
-and multivariate settings based on the Two One-Sided Tests (TOST). In
-addition, the package contains different corrective procedures applied
-to the standard TOST in order to adjust the size of the procedure at the
-desired nominal level leading to more powerful procedures. This package
-implements the $\alpha$-TOST and $\delta$-TOST methods proposed in
-Boulaguiem et al. (2024a) and in Boulaguiem et al. (2024b).
+This R package contains functions for testing equivalence in both
+univariate and multivariate settings, based on the Two One-Sided Tests
+(TOST). The `cTOST` package implements the $\alpha$-TOST and
+$\delta$-TOST methods proposed by Boulaguiem et al. (2024a, 2024b).
+These two corrective procedures that can be applied to the standard TOST
+to adjust the size of the procedure to the desired nominal level,
+resulting in more powerful procedures.
-## Install Instructions
+## 2. Install Instructions
-The `cTOST` package is available on GitHub at the moment. It is subject
-to ongoing updates that may lead to stability issues.
+The `cTOST` package is available on cran and on GitHub. The version on
+GitHub is subject to ongoing updates that may lead to stability issues.
-In order to install the package, it is required to pre-install the
-`devtools` dependency. Run the following command if you do not have it
-already installed:
+The package can from cran as follows:
``` r
-install.packages("devtools")
+install.packages("cTOST")
```
-The package is then installed with the following command:
+The package can also be install from GitHub using the `devtools`
+package:
``` r
+install.packages("devtools")
devtools::install_github("stephaneguerrier/cTOST")
```
@@ -47,11 +47,82 @@ Note that Windows users are assumed that have Rtools installed (if this
is not the case, please visit this
[link](https://cran.r-project.org/bin/windows/Rtools/).
-## How to use
+## 3. How to use
+
+We provide here a few examples on the usage of the `cTOST` package. More
+information can be found here: ???
+
+### 3.1. Univariate settings
+
+To illustrate the use of the proposed method in the univariate settings,
+we consider the `skin` dataset analyzed in Boulaguiem et al. (2024a),
+which can be loaded as follows:
+
+``` r
+data(skin)
+theta_hat = diff(apply(skin,2,mean))
+nu = nrow(skin) - 1
+sig_hat = sd(apply(skin,1,diff))/sqrt(nu)
+```
+
+### 3.1.1. Standard TOST
+
+The standard TOST can be used as follows:
+
+``` r
+stost = tost(theta = theta_hat, sigma = sig_hat, nu = nu, delta = log(1.25))
+stost
+```
+
+
+
+#### 3.1.2. $\alpha$-TOST
+
+The $\alpha$-TOST can be used through the function `ctost` as follows:
+
+``` r
+atost = ctost(theta = theta_hat, sigma = sig_hat, nu = nu,
+ delta = log(1.25), method = "alpha")
+atost
+```
+
+
+
+It is possible to compare the results of the $\alpha$-TOST (or
+$\delta$-TOST, see below) with the standard TOST as follows:
+
+``` r
+compare_to_tost(atost)
+```
+
+
+
+### 3.1.3. $\delta$-TOST
+
+The $\delta$-TOST can be used through the function `ctost` as follows:
+
+``` r
+dtost = ctost(theta = theta_hat, sigma = sig_hat, nu = nu,
+ delta = log(1.25), method = "delta")
+dtost
+#> ✖ Can't accept (bio)equivalence
+#> Corr. Equiv. Region: |----------------0----------------|
+#> Estim. Inter.: (--------------x---------------)
+#> CI = (-0.21174 ; 0.25715)
+#>
+#> Method: delta-TOST
+#> alpha = 0.05; Equiv. lim. = +/- 0.22314
+#> Corrected Equiv. lim. = +/- 0.25473
+#> Mean = 0.02270; Stand. dev. = 0.13428; df = 16
+```
+
+
+
+### 3.2. Multivariate settings
-TO DO
+COMING SOON
-## How to cite
+## 4. How to cite
@Manual{boulaguiem2024ctost,
title = {cTOST: Finite Sample Correction of The TOST in The Univariate Framework},
@@ -61,7 +132,7 @@ TO DO
url = {https://github.com/stephaneguerrier},
}
-## License
+## 5. License
The license this source code is released under is the GNU AFFERO GENERAL
PUBLIC LICENSE (AGPL) v3.0. Please see the LICENSE file for full text.
@@ -69,7 +140,7 @@ Otherwise, please consult
[GNU](https://www.gnu.org/licenses/agpl-3.0.en.html) which will provide
a synopsis of the restrictions placed upon the code.
-## References
+## 6. References
Boulaguiem, Y., Quartier, J., Lapteva, M., Kalia, Y. N., Victoria-Feser,
M. P., Guerrier, S. & Couturier, D. L., “*Finite Sample Adjustments for
diff --git a/README_files/figure-gfm/unnamed-chunk-10.svg b/README_files/figure-gfm/unnamed-chunk-10.svg
index 4b34504..4bd4109 100644
--- a/README_files/figure-gfm/unnamed-chunk-10.svg
+++ b/README_files/figure-gfm/unnamed-chunk-10.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
cTOST
Vignettevignettes/get_started.Rmd
+ Source: vignettes/get_started.Rmd
get_started.Rmd
Developed by Younes Boulaguiem, Stéphane Guerrier, Dominique-Laurent Couturier.
+Developed by Stéphane Guerrier, Younes Boulaguiem, Dominique-Laurent Couturier, Luca Insolia.
Using the \(\delta\)-TOST, we still cannot accept bioequivalence, even though the corrected region is larger:
-+-res_dtost = dtost(theta = theta_hat, sigma = sig_hat, nu = nu, alpha = 0.05, delta = log(1.25)) res_dtost
---#> ✖ Can't accept (bio)equivalence -#> Corr. Equiv. Region: |----------------0----------------| -#> Estim. Inter.: (--------------x---------------) -#> CI = (-0.21174 ; 0.25715) -#> -#> Method: delta-TOST -#> alpha = 0.05; Equiv. lim. = +/- 0.22314 -#> Corrected Equiv. lim. = +/- 0.25473 -#> Mean = 0.02270; Stand. dev. = 0.13428; df = 16 --++library(cTOST) +data(skin) +theta_hat = diff(apply(skin,2,mean)) +nu = nrow(skin) - 1 +sig_hat = sd(apply(skin,1,diff))/sqrt(nu) +res_dtost = dtost(theta = theta_hat, sigma = sig_hat, nu = nu, alpha = 0.05, delta = log(1.25)) +res_dtost
-compare_to_tost(res_dtost)
-+-#> TOST: ✖ Can't accept (bio)equivalence -#> delta-TOST: ✖ Can't accept (bio)equivalence -#> -#> Stand. Equiv. Region: |--------------0--------------| -#> Corr. Equiv. Region: |----------------0----------------| -#> TOST: (--------------x---------------) -#> delta-TOST: (--------------x---------------) -#> -#> Standard Equiv. lim. = +/- 0.22314 -#> Corrected Equiv. lim. = +/- 0.25473 --library(cTOST) +data(skin) +theta_hat = diff(apply(skin,2,mean)) +nu = nrow(skin) - 1 +sig_hat = sd(apply(skin,1,diff))/sqrt(nu) +res_dtost = dtost(theta = theta_hat, sigma = sig_hat, nu = nu, alpha = 0.05, delta = log(1.25)) +compare_to_tost(res_dtost)
@@ -216,40 +184,25 @@
However, the \(\alpha\)-TOST allows us to accept bioequivalence:
-+-res_atost = atost(theta = theta_hat, sigma = sig_hat, nu = nu, alpha = 0.05, delta = log(1.25)) res_atost
---#> ✔ Accept (bio)equivalence -#> Equiv. Region: |----------------0----------------| -#> Estim. Inter.: (---------------x--------------) -#> CI = (-0.17654 ; 0.22194) -#> -#> Method: alpha-TOST -#> alpha = 0.05; Equiv. lim. = +/- 0.22314 -#> Corrected alpha = 0.07866 -#> Mean = 0.02270; Stand. dev. = 0.13428; df = 16 --++library(cTOST) +data(skin) +theta_hat = diff(apply(skin,2,mean)) +nu = nrow(skin) - 1 +sig_hat = sd(apply(skin,1,diff))/sqrt(nu) +res_atost = atost(theta = theta_hat, sigma = sig_hat, nu = nu, alpha = 0.05, delta = log(1.25)) +res_atost
-compare_to_tost(res_atost)
-+-#> TOST: ✖ Can't accept (bio)equivalence -#> alpha-TOST: ✔ Accept (bio)equivalence -#> -#> Equiv. Region: |---------------0---------------| -#> TOST: (---------------x----------------) -#> alpha-TOST: (-------------x--------------) -#> -#> CI - low CI - high -#> TOST: -0.21174 0.25715 -#> alpha-TOST: -0.17654 0.22194 -#> -#> Equiv. lim. = +/- 0.22314 --library(cTOST) +data(skin) +theta_hat = diff(apply(skin,2,mean)) +nu = nrow(skin) - 1 +sig_hat = sd(apply(skin,1,diff))/sqrt(nu) +res_atost = atost(theta = theta_hat, sigma = sig_hat, nu = nu, alpha = 0.05, delta = log(1.25)) +compare_to_tost(res_atost)
@@ -258,7 +211,7 @@Interval Inclusion Pri
To visually assess bioequivalence with the interval inclusion principal, we reproduce Figure 5 of Boulaguiem et al. (2023) with the following code:
-+-# Nominal level and zquivalence bounds alpha = 0.05 delta = log(1.25) @@ -312,7 +265,6 @@
Interval Inclusion Pri labels = c("-0.3", expression(paste("-",delta)), "-0.1", "0", "0.1", expression(delta), "0.3"),padj=-0.15,cex.axis=1.3) mtext(expression(theta), side = 1, line = 2.35, cex = 1.4)
@@ -347,7 +299,7 @@References -
Developed by Younes Boulaguiem, Stéphane Guerrier, Dominique-Laurent Couturier.
+Developed by Stéphane Guerrier, Younes Boulaguiem, Dominique-Laurent Couturier, Luca Insolia.
diff --git a/docs/index.html b/docs/index.html index a60069d..9862576 100644 --- a/docs/index.html +++ b/docs/index.html @@ -83,13 +83,12 @@--
cTOST
Overview +1.
cTOST
OverviewThis R package contains the functions to test equivalence in univariate and multivariate settings based on the Two One-Sided Tests (TOST). In addition, the package contains different corrective procedures applied to the standard TOST in order to adjust the size of the procedure at the desired nominal level leading to more powerful procedures. This package implements the α-TOST and δ-TOST methods proposed in Boulaguiem et al. (2024a) and in Boulaguiem et al. (2024b).
-Install Instructions +
2. Install Instructions
The
cTOST
package is available on GitHub at the moment. It is subject to ongoing updates that may lead to stability issues.In order to install the package, it is required to pre-install the
@@ -101,20 +100,60 @@devtools
dependency. Run the following command if you do not have it already installed:Install Instructionslink.
-How to use +
3. How to use
-TO DO
+++3.1 Uni +
+ + ++++δ-TOST +
++ ++dtost = ctost(theta = theta_hat, sigma = sig_hat, nu = nu, + delta = log(1.25), method = "delta") +dtost +#> ✖ Can't accept (bio)equivalence +#> Corr. Equiv. Region: |----------------0----------------| +#> Estim. Inter.: (--------------x---------------) +#> CI = (-0.21174 ; 0.25715) +#> +#> Method: delta-TOST +#> alpha = 0.05; Equiv. lim. = +/- 0.22314 +#> Corrected Equiv. lim. = +/- 0.25473 +#> Mean = 0.02270; Stand. dev. = 0.13428; df = 16
How to cite
- +License diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index 07b648e..113873d 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -4,5 +4,5 @@ pkgdown_sha: ~ articles: get_started: get_started.html reproducibility: reproducibility.html -last_built: 2024-05-02T15:40Z +last_built: 2024-05-02T16:49Z diff --git a/docs/reference/alphahat.fun.html b/docs/reference/alphahat.fun.html index 023f1d8..6949a59 100644 --- a/docs/reference/alphahat.fun.html +++ b/docs/reference/alphahat.fun.html @@ -28,12 +28,6 @@ -
- Get started - -- Reproducibility - Reference @@ -53,7 +47,7 @@@@ -100,7 +94,7 @@@@ -150,7 +133,7 @@Author
Examples