## ----setup, include = FALSE--------------------------------------------------- knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.width = 7, fig.height = 4.5, out.width = "100%", dpi = 96 ) library(SingleArmMRCT) ## ----------------------------------------------------------------------------- result_f <- rcp1armContinuous( mu = 0.5, mu0 = 0.1, sd = 1, Nj = c(20, 40, 40), PI = 0.5, approach = "formula" ) print(result_f) ## ----------------------------------------------------------------------------- result_s <- rcp1armContinuous( mu = 0.5, mu0 = 0.1, sd = 1, Nj = c(20, 40, 40), PI = 0.5, approach = "simulation", nsim = 10000, seed = 1 ) print(result_s) ## ----fig.alt="Line plot of RCP versus f1 for a continuous endpoint with mu = 0.5, mu0 = 0.1, sigma = 1, showing Method 1 and Method 2 across N = 20, 40, 100"---- plot_rcp1armContinuous( mu = 0.5, mu0 = 0.1, sd = 1, PI = 0.5, N_vec = c(20, 40, 100), J = 3, nsim = 5000, seed = 1, base_size = 8 ) ## ----------------------------------------------------------------------------- result_f <- rcp1armBinary( p = 0.5, p0 = 0.2, Nj = c(20, 40, 40), PI = 0.5, approach = "formula" ) print(result_f) ## ----------------------------------------------------------------------------- result_s <- rcp1armBinary( p = 0.5, p0 = 0.2, Nj = c(20, 40, 40), PI = 0.5, approach = "simulation", nsim = 10000, seed = 1 ) print(result_s) ## ----fig.alt="Line plot of RCP versus f1 for a binary endpoint with p = 0.5, p0 = 0.2, showing Method 1 and Method 2 across N = 20, 40, 100"---- plot_rcp1armBinary( p = 0.5, p0 = 0.2, PI = 0.5, N_vec = c(20, 40, 100), J = 3, nsim = 5000, seed = 1, base_size = 8 ) ## ----------------------------------------------------------------------------- result_f <- rcp1armCount( lambda = 2, lambda0 = 3, dispersion = 1, Nj = c(20, 40, 40), PI = 0.5, approach = "formula" ) print(result_f) ## ----------------------------------------------------------------------------- result_s <- rcp1armCount( lambda = 2, lambda0 = 3, dispersion = 1, Nj = c(20, 40, 40), PI = 0.5, approach = "simulation", nsim = 10000, seed = 1 ) print(result_s) ## ----fig.height=6, fig.alt="Grid plot of RCP versus f1 for a count endpoint with lambda = 2, lambda0 = 3, showing Method 1 on log-RR and linear-RR scales and Method 2 across N = 20, 40, 100"---- plot_rcp1armCount( lambda = 2, lambda0 = 3, dispersion = 1, PI = 0.5, N_vec = c(20, 40, 100), J = 3, nsim = 5000, seed = 1, base_size = 11 ) ## ----echo=FALSE--------------------------------------------------------------- tbl <- data.frame( Endpoint = c("Continuous", "Binary", "Count"), Model = c("Normal", "Binomial", "Negative binomial"), `Effect parameter` = c( "$\\delta = \\mu - \\mu_0$", "$\\delta = p - p_0$", "$\\log(RR) = \\log(\\lambda/\\lambda_0)$ (Method 1, log-RR scale); $1 - RR = 1 - \\lambda/\\lambda_0$ (Method 1, linear-RR scale)" ), `Benefit direction` = c( "$\\hat{\\mu}_j > \\mu_0$", "$\\hat{p}_j > p_0$", "$\\widehat{RR}_j < 1$" ), `Method 1 computation` = c( "Closed-form (normal approximation)", "Exact enumeration (binomial)", "Exact enumeration (negative binomial)" ), `Method 2 computation` = c( "Product of normal tail probabilities", "Product of binomial tail probabilities", "Product of NB tail probabilities" ), check.names = FALSE ) knitr::kable(tbl, align = "llllll")