You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: R/SampleSize.R
+26-42Lines changed: 26 additions & 42 deletions
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@
9
9
#' @param Eper Optional. Vector of length 2 specifying the period effect in a `dtype = "2x2"` design, applied to c(Period 0, Period 1). Defaults to `c(0, 0)` if not provided. Ignored for `dtype = "parallel"`.
10
10
#' @param Eco Optional. Vector of length 2 specifying the carry-over effect for each arm in a `dtype = "2x2"` design, applied to c(Reference, Treatment). Defaults to `c(0, 0)` if not provided. Ignored for `dtype = "parallel"`.
11
11
#' @param rho Correlation parameter applied uniformly across all endpoint pairs, used with sigma_list to calculate varcov if cor_mat or varcov_list are not provided.
12
-
#' @param TAR vector of allocation rates with allocation rates of the arm, default is equivalent rate.
12
+
#' @param TAR Numeric vector. Treatment allocation rate for each arm, where the length of `TAR` specifies the number of arms. The default is an equal allocation ratio across all arms.
13
13
#' @param arm_names Optional vector with the treatment names. If not supplied, it will be derived from mu_list.
14
14
#' @param ynames_list Optional list of vectors with Endpoint names on each arm. When not all endpoint names are provided for each arm, arbitrary names (assigned by vector order) are used.
15
15
#' @param type_y vector with the type of endpoints: primary endpoint(1), otherwise (2).
@@ -22,23 +22,22 @@
22
22
#' @param list_lequi.tol list of lower equivalence bounds (e.g., -0.5) expressed in raw scale units (e.g., scalepoints) of endpoint in comparator
23
23
#' @param list_uequi.tol list of upper equivalence bounds (e.g., -0.5) expressed in raw scale units (e.g., scalepoints) of endpoint in comparator
24
24
#' @param vareq Logical indicating whether variances are assumed equal across arms (default = FALSE).
25
-
#' @param dtype design type ("parallel","2x2")
25
+
#' @param dtype Character. Design type for the trial: `"parallel"` (default) for parallel group design or `"2x2"` for crossover design (applicable only for trials with 2 arms).
26
26
#' @param lognorm Is data log-normally distributed? (TRUE, FALSE)
27
27
#' @param k Vector with the number of endpoints that must be successful (integer) for global bioequivalence for each comparator. If no k vector is provided, it will be set to the total number of endpoints on each comparator.
#' @param ctype comparison dtype ("DOM"(Difference of means), "ROM"(Ratio of means))
28
+
#' @param adjust Character. Method for alpha adjustment: `"k"` (K-fold), `"bon"` (Bonferroni), `"sid"` (Sidak), `"no"` (no adjustment, default), or `"seq"` (sequential adjustment).
29
+
#' @param ctype Character. Specifies the type of hypothesis test for comparison: `"DOM"` for Difference of Means or `"ROM"` for Ratio of Means.
30
30
#' @param dropout vector with proportion of total population with dropout per arm
31
-
#' @param step.power initial step size is 2^step.power
32
-
#' @param step.up if TRUE steps up from 'lower', if FALSE steps down from 'upper'
33
-
#' @param pos.side if TRUE finds integer, i, closest to the root such that f(i) >0
34
-
#' @param maxiter maximum number of iterations
35
31
#' @param nsim number of simulated studies (default=5000)
36
-
#' @param lower initial value of N to be searched (default=2)
37
-
#' @param upper max value of N to be searched (default=500)
38
32
#' @param seed main seed
39
-
#' @param ncores Number of processing cores for parallel computation; defaults to the total detected cores minus one.
33
+
#' @param ncores Integer. Number of processing cores to use for parallel computation. Defaults to one less than the total number of detected cores.
40
34
#' @param optimization_method Character. Method for determining the required sample size: "fast" (using modified root-finding algorithms) or "step-by-step". Defaults to "fast".
41
-
#'
35
+
#' @param lower Integer. Initial value of `N` for the search range. Defaults to 2.
36
+
#' @param upper Integer. Maximum value of `N` for the search range. Defaults to 500.
37
+
#' @param step.power Numeric. The initial step size for the sample size search, defined as `2^step.power`. Relevant when `optimization_method` is `"fast"`.
38
+
#' @param step.up Logical. If `TRUE` (default), the sample size search increments upward from the `lower` limit; if `FALSE`, it decrements downward from the `upper` limit. Used only when `optimization_method` is `"fast"`.
39
+
#' @param pos.side Logical. If `TRUE`, finds the smallest integer, `i`, closest to the root such that `f(i) > 0`. Used only when `optimization_method` is `"fast"`.
40
+
#' @param maxiter Integer. Maximum number of iterations allowed for finding the sample size. Defaults to 1000. Used only when `optimization_method` is `"fast"`.
42
41
#' @return An object simss that contains the following elements :
43
42
#' \describe{
44
43
#' \item{"response"}{ array with the sample sizes for each arm and aproximated achieved power with confidence intervals}
The main features of this package is `sampleSize` function which can be used to calculate sample size for individual and multiple endpoints.
43
+
The main features of this package is `sampleSize` function which can be used to calculate sample size for individual and multiple endpoints. Various worked examples are available as [vignettes](https://smartdata-analysis-and-statistics.github.io/SimTOST)
44
44
45
-
The example of using the functionality of this package can be found in these vignettes:
46
-
47
-
1.[Sample size calculation of individual endpoint]()
48
-
2.[Sample size calculation of multiple endpoints]()
0 commit comments