Skip to content

Commit 0b88528

Browse files
committed
update documentation & function names
1 parent 3545c2e commit 0b88528

21 files changed

+65
-48
lines changed

NAMESPACE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ importFrom(Rcpp, evalCpp)
33
exportPattern("^[[:alpha:]]+")
44
S3method(plot,simss)
55
S3method(print,simss)
6-
export(N_Mielke)
7-
export(estSampleSize)
6+
export(sampleSize_Mielke)
7+
export(sampleSize)
88
export(get_par)
99
export(plot.simss)
1010
importFrom(data.table,.SD)

R/estSampleSize.R renamed to R/SampleSize.R

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
#' @param sigma_list list of sigma vectors, each element corresponds to a comparator with a sigma vector of size number of endpoints.
77
#' @param cor_mat matrix specifying the correlation matrix between endpoints, used along with sigma_list to calculate the varcov list in case it is not provided.
88
#' @param sigmaB number between subject variance only for 2x2 design.
9-
#' @param Eper vector of size 2, effect of period on c(0,1).
10-
#' @param Eco vector of size 2, carry over effect of arm c(Reference, Treatment).
9+
#' @param Eper Vector of length 2, specifying the period effect in `dtype = "2x2"` design, applied to c(Period 0, Period 1).
10+
#' @param Eco Vector of length 2, specifying the carry-over effect for each arm in `dtype = "2x2"` design, applied to c(Reference, Treatment).
1111
#' @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.
1212
#' @param TAR vector of allocation rates with allocation rates of the arm, default is equivalent rate.
1313
#' @param arm_names Optional vector with the treatment names. If not supplied, it will be derived from mu_list.
@@ -81,7 +81,7 @@
8181
#' FDA = c("AUClast", "Cmax"))
8282
#'
8383
#'# Run the simulation
84-
#'estSampleSize(power = 0.9, # target power
84+
#'sampleSize(power = 0.9, # target power
8585
#' alpha = 0.05,
8686
#' mu_list = mu_list,
8787
#' sigma_list = sigma_list,
@@ -99,14 +99,8 @@
9999
#' seed = 1234)
100100
#'
101101
#' @export
102-
estSampleSize <- function(mu_list,
103-
varcov_list=NA,
104-
sigma_list=NA,
105-
cor_mat=NA,
106-
sigmaB =NA,
107-
Eper = c(0,0),
108-
Eco = c(0,0),
109-
rho=0,
102+
sampleSize <- function(mu_list, varcov_list=NA, sigma_list=NA, cor_mat=NA,
103+
sigmaB =NA, Eper = c(0,0), Eco = c(0,0), rho=0,
110104
TAR=NA,
111105
arm_names=NA,
112106
ynames_list=NA,
@@ -458,14 +452,20 @@ estSampleSize <- function(mu_list,
458452
}
459453

460454

461-
if(dtype=="parallel"){
462-
if(length(arm_names)!=length(dropout)){
463-
warning("Incorrect number of dropout supplied (One needed for each arm),so it will be assigned a dropout=0")
455+
if (dtype == "parallel") {
456+
if (length(arm_names) != length(dropout)) {
457+
warning("The number of dropout values provided does not match the number of arms specified in 'arm_names'. A default dropout rate of 0 will be assigned to each arm.")
464458
dropout <- rep(0,length(arm_names))
465459
}
466-
if(is.null(names(dropout))){
467-
names(dropout) <- arm_names}
468-
}else{
460+
if (is.null(names(dropout))) {
461+
names(dropout) <- arm_names
462+
}
463+
464+
# Check if dtype is "parallel" and Eper or Eco are non-default
465+
if ((any(Eper != c(0, 0)) || any(Eco != c(0, 0)))) {
466+
warning("Eper and Eco are only applicable for dtype = '2x2'. Non-default values for Eper or Eco will be ignored in parallel design.")
467+
}
468+
} else {
469469
if(length(dropout)!=2){
470470
warning("Incorrect number of dropout supplied (One needed for each sequence),so it will be assigned a dropout=0")
471471
dropout <- rep(0,2)

R/SimTOST-package.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88
#' @title Sample Size Estimation via Simulation
99
#' @references
1010
#' Mielke, J., Jones, B., Jilma, B. & König, F. Sample Size for Multiple Hypothesis Testing in Biosimilar Development. \emph{Statistics in Biopharmaceutical Research} 10, 39–49 (2018).
11-
#' @seealso \link{estSampleSize}
11+
#' @seealso \link{sampleSize}
1212
"_PACKAGE"

R/get_par.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#' @title Parameter Configuration for Endpoints and Comparators
2-
#' @description Constructs and returns a list of key parameters (mean vectors, variance-covariance matrices, and allocation rates) required for input into the `estSampleSize` function. This function ensures that the parameters for each endpoint and comparator are consistent, properly named, and formatted.
2+
#' @description Constructs and returns a list of key parameters (mean vectors, variance-covariance matrices, and allocation rates) required for input into the `sampleSize` function. This function ensures that the parameters for each endpoint and comparator are consistent, properly named, and formatted.
33
#'
44
#' @param mu_list A list of mean (\eqn{\mu}) vectors. Each element in the list represents a comparator, with the corresponding \eqn{\mu} vector having a length equal to the number of endpoints.
55
#' @param varcov_list A list of variance-covariance matrices. Each element corresponds to a comparator, with a matrix of size \eqn{(n \times n)}, where \eqn{n} is the number of endpoints.

R/N_one_ep.r renamed to R/sampleSize_Mielke.R

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,18 @@ power_dom <- function(seed, mu_test, mu_control, sigma_test, sigma_control,
172172
#' \item{"power.a"}{Achieved power with the estimated sample size.}
173173
#' \item{"SS"}{Required sample size per sequence to achieve the target power.}
174174
#' }
175+
#'
176+
#' @examples
177+
#' # Example 1 from Mielke
178+
#' sampleSize_Mielke(power = 0.8, Nmax = 1000, m = 5, k = 5, rho = 0,
179+
#' sigma = 0.3, true.diff = log(1.05), equi.tol = log(1.25),
180+
#' design = "parallel", alpha = 0.05, adjust = "no",
181+
#' seed = 1234, nsim = 100)
182+
#'
175183
#' @export
176-
N_Mielke <- function(power, Nmax, m, k, rho, sigma, true.diff, equi.tol,
177-
design, alpha, adjust="no", seed = NULL, nsim = 10000) {
184+
sampleSize_Mielke <- function(power, Nmax, m, k, rho, sigma, true.diff,
185+
equi.tol, design, alpha, adjust = "no",
186+
seed = NULL, nsim = 10000) {
178187

179188
if (!is.null(seed)) {
180189
set.seed(seed)

README.Rmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ devtools::install_github("smartdata-analysis-and-statistics/SimTOST")
4040

4141
## Example
4242

43-
The main features of this package is `estSampleSize` 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.
4444

4545
The example of using the functionality of this package can be found in these vignettes:
4646

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ devtools::install_github("smartdata-analysis-and-statistics/SimTOST")
3434

3535
## Example
3636

37-
The main features of this package is `estSampleSize` function which can be used
37+
The main features of this package is `sampleSize` function which can be used
3838
to calculate sample size for individual and multiple endpoints.
3939

4040
The example of using the functionality of this package can be found in

man/SimTOST.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/get_par.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/power_Mielke.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)