Skip to content

Commit 8cf1a3f

Browse files
author
NightlordTW
committed
Improve documentation
1 parent 4c951f9 commit 8cf1a3f

File tree

5 files changed

+45
-17
lines changed

5 files changed

+45
-17
lines changed

R/SampleSize.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ sampleSize <- function(mu_list, varcov_list = NA, sigma_list = NA, cor_mat = NA,
490490
# Parameters related to design ----
491491

492492
if (lognorm == TRUE & ctype == "DOM"){
493-
stop("No test available for DOM when variables are log normal distributed")
493+
stop("Testing is not supported for DOM when variables follow a log-normal distribution.")
494494
}
495495

496496
if( lognorm == FALSE & ctype == "ROM" & dtype =="2x2"){

R/helper.r

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ print.simss <- function(x, ...) {
1919
sst <- x$response[["n_total"]]
2020

2121
message(cat("### Sample Size Calculation Results ###"))
22-
message(cat(paste0("For a study targeting ",100*tpower,"% power with a ",100*alpha, "% type-I error.")))
22+
message(cat(paste0("For a trial targeting ",100*tpower,"% power with a ",100*alpha, "% type-I error.")))
2323
message(cat("-------------------------------------------------------------"))
2424
message(cat(paste0("The total required sample size to achieve ",100*power,"% power is ",sst," sample units.\n")))
2525
print(x$response[,-1], row.names = FALSE)

R/plot.sims.R

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
1-
#' @title plot.simss
2-
#' @description Plot of power vs sample size for all comparators and total of comparators
1+
#' @title Plot Power vs Sample Size for Simulation Results
2+
#' @description Generates a detailed plot showing the relationship between power and total sample size for each comparator and the overall combined comparators.
3+
#' The plot also includes confidence intervals for power estimates and highlights the target power with a dashed line for easy visual comparison.
34
#'
4-
#' @param x Object type simss
5-
#' @param \ldots Additional arguments which are passed to simss object.
5+
#' @param x An object of class `simss` containing simulation results.
6+
#' @param \ldots Additional arguments to be passed to the `plot.simss` function for customization.
7+
#'
8+
#' @return A `ggplot` object illustrating:
9+
#' - Power (y-axis) vs. Total Sample Size (x-axis) for individual endpoints and comparators.
10+
#' - Error bars representing the 95% confidence interval of the power estimates.
11+
#' - A dashed horizontal line indicating the target power for comparison.
12+
#' - Faceted panels for each comparator, making it easy to compare results across different groups.
13+
#'
14+
#' @details
15+
#' The plot dynamically adjusts to exclude unnecessary components, such as redundant endpoints or comparators with insufficient data, ensuring clarity and simplicity.
16+
#' The `ggplot2` framework is used for visualizations, allowing further customization if needed.
17+
#'
18+
#' @author
19+
#' Johanna Muñoz \email{[email protected]}
620
#'
7-
#' @return Plot of power vs total sample size per comparator and total of comparators
821
#' @importFrom data.table .SD
922
#' @export plot.simss
1023
#'
@@ -14,7 +27,7 @@ plot.simss <- function(x, ...){
1427

1528
table.test <- x$table.test
1629
nsim <- as.numeric(x$param.d["nsim"])
17-
tpower<-as.numeric(x$param.d["power"])
30+
tpower <- as.numeric(x$param.d["power"])
1831
# Calculate totaly test across all comparators= power
1932
qnam <- colnames(table.test)[grep("^totaly",colnames(table.test))]
2033

man/plot.simss.Rd

Lines changed: 19 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vignettes/sampleSize_parallel_3A1E.Rmd

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,13 @@ Key Considerations:
126126

127127
We proceed similarly to the initial example, modifying the `list_comparator` to include multiple comparators. In this case, the list contains two elements specifying the simultaneous comparison between SB2 vs. RemEU and SB2 vs. RemUSA. This approach ensures that the equivalence assessment accounts for both reference products.
128128

129+
Additionally, we must specify equivalence boundaries for each comparison individually. These boundaries define the acceptable range for equivalence and are provided separately for each comparator.
129130

130131
```{r}
131-
list_comparator <- list("EU" = c("SB2", "EU_Remicade"),
132-
"US" = c("SB2", "USA_Remicade"))
133-
list_lequi.tol <- list("EU" = 0.8, "US" = 0.8) # Lower equivalence boundary
134-
list_uequi.tol <- list("EU" = 1/0.8, "US" = 1/0.8) # Upper equivalence boundary
132+
list_comparator <- list("EMA" = c("SB2", "EU_Remicade"),
133+
"FDA" = c("SB2", "USA_Remicade"))
134+
list_lequi.tol <- list("EMA" = 0.8, "FDA" = 0.8) # Lower equivalence boundary
135+
list_uequi.tol <- list("EMA" = 1/0.8, "FDA" = 1/0.8) # Upper equivalence boundary
135136
```
136137

137138
## Computing Sample Size

0 commit comments

Comments
 (0)