diff --git a/NAMESPACE b/NAMESPACE index 68c1e61..8ae08f6 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,15 +1,5 @@ # Generated by roxygen2: do not edit by hand -export(DID_EC_AIPW) -export(DID_EC_AIPW_bootstrap) -export(DID_EC_IPW) -export(DID_EC_IPW_bootstrap) -export(DID_EC_OR) -export(DID_EC_OR_bootstrap) -export(EC_AIPW_OPT) -export(EC_AIPW_OPT_bootstrap) -export(EC_IPW_OPT) -export(EC_IPW_OPT_bootstrap) export(run_analysis) export(run_simulation) export(setup_analysis_OLE) diff --git a/R/DID_EC_AIPW.R b/R/DID_EC_AIPW.R index 259398e..97c310c 100644 --- a/R/DID_EC_AIPW.R +++ b/R/DID_EC_AIPW.R @@ -19,7 +19,7 @@ #' #' @include DID_EC_AIPW_bootstrap.R #' @return tau and standard deviation -#' @export +#' @noRd #' DID_EC_AIPW <- function(data, outcome_col_name, diff --git a/R/DID_EC_AIPW_bootstrap.R b/R/DID_EC_AIPW_bootstrap.R index 1c79a6c..e69f298 100644 --- a/R/DID_EC_AIPW_bootstrap.R +++ b/R/DID_EC_AIPW_bootstrap.R @@ -12,7 +12,7 @@ #' @param model_form_mu0_ext Formula string(s) for the external control outcome model. #' #' @return tau and standard deviation -#' @export +#' @noRd #' #' @examples #' \dontrun{ diff --git a/R/DID_EC_IPW.R b/R/DID_EC_IPW.R index 19378cf..5657811 100644 --- a/R/DID_EC_IPW.R +++ b/R/DID_EC_IPW.R @@ -16,7 +16,7 @@ #' #' @include DID_EC_IPW_bootstrap.R #' @return tau and standard deviation -#' @export +#' @noRd #' DID_EC_IPW <- function(data, outcome_col_name, diff --git a/R/DID_EC_IPW_bootstrap.R b/R/DID_EC_IPW_bootstrap.R index 4ebecb7..8297a3e 100644 --- a/R/DID_EC_IPW_bootstrap.R +++ b/R/DID_EC_IPW_bootstrap.R @@ -11,7 +11,7 @@ #' @param model_form_piA Formula string for the treatment assignment model. #' #' @return Named numeric vector of treatment effect estimates. -#' @export +#' @noRd #' DID_EC_IPW_bootstrap <- function(data, indices, diff --git a/R/DID_EC_OR.R b/R/DID_EC_OR.R index 7f5e35c..629343f 100644 --- a/R/DID_EC_OR.R +++ b/R/DID_EC_OR.R @@ -17,7 +17,7 @@ #' #' @include DID_EC_OR_bootstrap.R #' @return tau and standard deviation -#' @export +#' @noRd #' #' @examples #' \dontrun{ diff --git a/R/DID_EC_OR_bootstrap.R b/R/DID_EC_OR_bootstrap.R index 2607190..a8e32bb 100644 --- a/R/DID_EC_OR_bootstrap.R +++ b/R/DID_EC_OR_bootstrap.R @@ -12,7 +12,7 @@ #' @param model_form_mu1_rct Formula string(s) for the RCT treatment outcome model. #' #' @return tau and standard deviation -#' @export +#' @noRd #' #' @examples #' \dontrun{ diff --git a/R/EC_AIPW_OPT.R b/R/EC_AIPW_OPT.R index 490883e..8a92aec 100644 --- a/R/EC_AIPW_OPT.R +++ b/R/EC_AIPW_OPT.R @@ -17,7 +17,7 @@ #' #' @include EC_AIPW_OPT_bootstrap.R #' @return a list containing: tau (effect size), sd.tau (standard deviation), wt (weight) -#' @export +#' @noRd #' @examples #' \dontrun{ #' res <- EC_AIPW_OPT( diff --git a/R/EC_AIPW_OPT_bootstrap.R b/R/EC_AIPW_OPT_bootstrap.R index f7dd2d7..ad2df62 100644 --- a/R/EC_AIPW_OPT_bootstrap.R +++ b/R/EC_AIPW_OPT_bootstrap.R @@ -12,7 +12,7 @@ #' @param wt Numeric fixed borrowing weight. #' #' @return a list containing: tau (effect size), sd.tau (standard deviation), wt (weight) -#' @export +#' @noRd #' @examples #' \dontrun{ #' res <- EC_AIPW_OPT( diff --git a/R/EC_IPW_OPT.R b/R/EC_IPW_OPT.R index d569ff5..8a9de2f 100644 --- a/R/EC_IPW_OPT.R +++ b/R/EC_IPW_OPT.R @@ -17,7 +17,7 @@ #' #' @include EC_IPW_OPT_bootstrap.R #' @return a list containing: tau (effect size), sd.tau (standard deviation), wt (weight) -#' @export +#' @noRd #' #' @examples #' \dontrun{ diff --git a/R/EC_IPW_OPT_bootstrap.R b/R/EC_IPW_OPT_bootstrap.R index 6295d44..a16a47e 100644 --- a/R/EC_IPW_OPT_bootstrap.R +++ b/R/EC_IPW_OPT_bootstrap.R @@ -11,7 +11,7 @@ #' @param wt Numeric fixed borrowing weight. #' #' @return a list containing: tau (effect size), sd.tau (standard deviation), wt (weight) -#' @export +#' @noRd #' #' @examples #' \dontrun{ diff --git a/R/SCM.R b/R/SCM.R index 32bd402..f58b684 100644 --- a/R/SCM.R +++ b/R/SCM.R @@ -24,7 +24,7 @@ #' @return A list contains: estimated ATE, SE, weight used, SE by Bootstrap #' and a 95% confidence interval for primary endpoint (only when #' Bootstrap=TRUE) -#' +#' @noRd SCM <- function(data, outcome_col_name, trial_status_col_name, @@ -207,7 +207,7 @@ SCM <- function(data, #' @param X00 Matrix of external control subjects (attributes by columns). #' @param long_term_col_name Character vector of long-term outcome column names. #' @param lambda Numeric penalty parameter. - +#' @noRd subject_SC <- function(subject, X10, X00, long_term_col_name, lambda) { # subset to only the intersted subject and matching vars x1 <- X10[-which(row.names(X10) %in% long_term_col_name), subject] @@ -239,7 +239,7 @@ subject_SC <- function(subject, X10, X00, long_term_col_name, lambda) { #' @param lambda.max Numeric. Maximum penalty parameter. #' @param nlambda Integer. Number of lambda values to evaluate. #' @param pb A progress bar object or \code{NULL}. - +#' @noRd lambdacv <- function(ec, long_term_col_name, lambda.min = 0, diff --git a/_pkgdown.yml b/_pkgdown.yml index b060335..5a998a1 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -55,31 +55,6 @@ reference: - setup_method_SCM - setup_bootstrap - - title: Weighting Estimators - desc: IPW and AIPW methods for primary analysis - contents: - - EC_IPW_OPT - - EC_IPW_OPT_bootstrap - - EC_AIPW_OPT - - EC_AIPW_OPT_bootstrap - - - title: Difference-in-Differences Estimators - desc: DID methods for OLE analysis - contents: - - DID_EC_IPW - - DID_EC_IPW_bootstrap - - DID_EC_AIPW - - DID_EC_AIPW_bootstrap - - DID_EC_OR - - DID_EC_OR_bootstrap - - - title: Synthetic Control Method - desc: SCM estimator and helpers - contents: - - SCM - - subject_SC - - lambdacv - - title: Data Generation desc: Simulate trial data contents: diff --git a/man/DID_EC_AIPW.Rd b/man/DID_EC_AIPW.Rd deleted file mode 100644 index b6d7041..0000000 --- a/man/DID_EC_AIPW.Rd +++ /dev/null @@ -1,60 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/DID_EC_AIPW.R -\name{DID_EC_AIPW} -\alias{DID_EC_AIPW} -\title{Difference in difference + AIPW + external control borrowing} -\usage{ -DID_EC_AIPW( - data, - outcome_col_name, - trial_status_col_name, - treatment_col_name, - covariates_col_name, - T_cross, - model_form_piS = "", - model_form_piA = "", - model_form_mu0_ext = "", - Bootstrap = FALSE, - R = 500, - bootstrap_CI_type = "bca", - alpha = 0.05, - quiet = TRUE -) -} -\arguments{ -\item{data}{data.frame. The input data containing the outcome, trial status, treatment, and covariates.} - -\item{outcome_col_name}{character. The column name for the outcome variable in the data.} - -\item{trial_status_col_name}{character. The column name for the trial -status variable in the data (indicating RCT vs external control).} - -\item{treatment_col_name}{character. The column name for the treatment variable in the data.} - -\item{covariates_col_name}{character vector. The column names for the covariates in the data.} - -\item{T_cross}{numeric. The time point that separates the placebo-control period and the follow-up period.} - -\item{model_form_piS}{character. The model formula for the selection model (S).} - -\item{model_form_piA}{character. The model formula for the treatment model (A).} - -\item{model_form_mu0_ext}{character. The model formula for the outcome model in the external data (mu0_ext).} - -\item{Bootstrap}{logical. Whether to use bootstrap for inference.} - -\item{R}{numeric. The number of bootstrap replications.} - -\item{bootstrap_CI_type}{character. The type of bootstrap confidence -interval to compute (e.g., "bca", "norm", "perc", "basic", "stud").} - -\item{alpha}{numeric. The significance level for confidence intervals.} - -\item{quiet}{Logical. If \code{TRUE}, suppress printed output.} -} -\value{ -tau and standard deviation -} -\description{ -Difference in difference + AIPW + external control borrowing -} diff --git a/man/DID_EC_AIPW_bootstrap.Rd b/man/DID_EC_AIPW_bootstrap.Rd deleted file mode 100644 index 94fbb69..0000000 --- a/man/DID_EC_AIPW_bootstrap.Rd +++ /dev/null @@ -1,59 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/DID_EC_AIPW_bootstrap.R -\name{DID_EC_AIPW_bootstrap} -\alias{DID_EC_AIPW_bootstrap} -\title{Difference in difference + AIPW + external control borrowing} -\usage{ -DID_EC_AIPW_bootstrap( - data, - indices, - outcome_col_name, - trial_status_col_name, - treatment_col_name, - covariates_col_name, - T_cross, - model_form_piS = "", - model_form_piA = "", - model_form_mu0_ext = "" -) -} -\arguments{ -\item{data}{A data frame containing all subject-level data.} - -\item{indices}{Bootstrap sample indices.} - -\item{outcome_col_name}{Character vector of outcome column names.} - -\item{trial_status_col_name}{Name of the trial status column.} - -\item{treatment_col_name}{Name of the treatment column.} - -\item{covariates_col_name}{Character vector of covariate column names.} - -\item{T_cross}{Integer crossover time point.} - -\item{model_form_piS}{Formula string for the trial participation model.} - -\item{model_form_piA}{Formula string for the treatment assignment model.} - -\item{model_form_mu0_ext}{Formula string(s) for the external control outcome model.} -} -\value{ -tau and standard deviation -} -\description{ -Difference in difference + AIPW + external control borrowing -} -\examples{ -\dontrun{ -DID_EC_AIPW_bootstrap( - data = my_data, - indices = seq_len(nrow(my_data)), - outcome_col_name = c("y1", "y2"), - trial_status_col_name = "S", - treatment_col_name = "A", - covariates_col_name = c("x1", "x2"), - T_cross = 1 -) -} -} diff --git a/man/DID_EC_IPW.Rd b/man/DID_EC_IPW.Rd deleted file mode 100644 index 78cb9e6..0000000 --- a/man/DID_EC_IPW.Rd +++ /dev/null @@ -1,55 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/DID_EC_IPW.R -\name{DID_EC_IPW} -\alias{DID_EC_IPW} -\title{Difference in difference + IPW + external control borrowing} -\usage{ -DID_EC_IPW( - data, - outcome_col_name, - trial_status_col_name, - treatment_col_name, - covariates_col_name, - T_cross, - model_form_piS = "", - model_form_piA = "", - Bootstrap = FALSE, - R = 500, - bootstrap_CI_type = "bca", - alpha = 0.05, - quiet = TRUE -) -} -\arguments{ -\item{data}{A data frame containing all subject-level data.} - -\item{outcome_col_name}{Character vector of outcome column names.} - -\item{trial_status_col_name}{Name of the trial status column.} - -\item{treatment_col_name}{Name of the treatment column.} - -\item{covariates_col_name}{Character vector of covariate column names.} - -\item{T_cross}{Integer crossover time point.} - -\item{model_form_piS}{Formula string for the trial participation model.} - -\item{model_form_piA}{Formula string for the treatment assignment model.} - -\item{Bootstrap}{Logical. Whether to use bootstrap inference.} - -\item{R}{Number of bootstrap replicates.} - -\item{bootstrap_CI_type}{Type of bootstrap CI (e.g. \code{"bca"}, \code{"perc"}).} - -\item{alpha}{Significance level.} - -\item{quiet}{Logical. If \code{TRUE}, suppress printed output.} -} -\value{ -tau and standard deviation -} -\description{ -Difference in difference + IPW + external control borrowing -} diff --git a/man/DID_EC_IPW_bootstrap.Rd b/man/DID_EC_IPW_bootstrap.Rd deleted file mode 100644 index a783db2..0000000 --- a/man/DID_EC_IPW_bootstrap.Rd +++ /dev/null @@ -1,43 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/DID_EC_IPW_bootstrap.R -\name{DID_EC_IPW_bootstrap} -\alias{DID_EC_IPW_bootstrap} -\title{Bootstrap statistic for DID + IPW} -\usage{ -DID_EC_IPW_bootstrap( - data, - indices, - outcome_col_name, - trial_status_col_name, - treatment_col_name, - covariates_col_name, - T_cross, - model_form_piS = "", - model_form_piA = "" -) -} -\arguments{ -\item{data}{A data frame containing all subject-level data.} - -\item{indices}{Bootstrap sample indices.} - -\item{outcome_col_name}{Character vector of outcome column names.} - -\item{trial_status_col_name}{Name of the trial status column.} - -\item{treatment_col_name}{Name of the treatment column.} - -\item{covariates_col_name}{Character vector of covariate column names.} - -\item{T_cross}{Integer crossover time point.} - -\item{model_form_piS}{Formula string for the trial participation model.} - -\item{model_form_piA}{Formula string for the treatment assignment model.} -} -\value{ -Named numeric vector of treatment effect estimates. -} -\description{ -Bootstrap statistic for DID + IPW -} diff --git a/man/DID_EC_OR.Rd b/man/DID_EC_OR.Rd deleted file mode 100644 index bfa6269..0000000 --- a/man/DID_EC_OR.Rd +++ /dev/null @@ -1,76 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/DID_EC_OR.R -\name{DID_EC_OR} -\alias{DID_EC_OR} -\title{Difference in difference + outcome regression + external control borrowing} -\usage{ -DID_EC_OR( - data, - outcome_col_name, - trial_status_col_name, - treatment_col_name, - covariates_col_name, - T_cross, - model_form_mu0_ext = "", - model_form_mu0_rct = "", - model_form_mu1_rct = "", - Bootstrap = FALSE, - R = 500, - bootstrap_CI_type = "bca", - alpha = 0.05, - quiet = TRUE -) -} -\arguments{ -\item{data}{A data frame containing all subject-level data.} - -\item{outcome_col_name}{Character vector of outcome column names.} - -\item{trial_status_col_name}{Name of the trial status column.} - -\item{treatment_col_name}{Name of the treatment column.} - -\item{covariates_col_name}{Character vector of covariate column names.} - -\item{T_cross}{Integer crossover time point.} - -\item{model_form_mu0_ext}{Formula string(s) for the external control outcome model.} - -\item{model_form_mu0_rct}{Formula string(s) for the RCT control outcome model.} - -\item{model_form_mu1_rct}{Formula string(s) for the RCT treatment outcome model.} - -\item{Bootstrap}{Logical. Whether to use bootstrap inference.} - -\item{R}{Number of bootstrap replicates.} - -\item{bootstrap_CI_type}{Type of bootstrap CI (e.g. \code{"bca"}, \code{"perc"}).} - -\item{alpha}{Significance level.} - -\item{quiet}{Logical. If \code{TRUE}, suppress printed output.} -} -\value{ -tau and standard deviation -} -\description{ -Difference in difference + outcome regression + external control borrowing -} -\examples{ -\dontrun{ -model_form_mu <- c( - "y1 ~ x1 + x2", - "y2 ~ x1 + x2", - "y3 ~ x1 + x2", - "y4 ~ x1 + x2" -) -res1 <- DID_EC_OR( - outcome = Y, trial_status = S, treatment = A, covariates = X, - long_term_marker = c(F, T, T, T), - model_form_mu0_ext = model_form_mu, - model_form_mu0_rct = model_form_mu, - model_form_mu1_rct = model_form_mu -) -} - -} diff --git a/man/DID_EC_OR_bootstrap.Rd b/man/DID_EC_OR_bootstrap.Rd deleted file mode 100644 index dccff97..0000000 --- a/man/DID_EC_OR_bootstrap.Rd +++ /dev/null @@ -1,63 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/DID_EC_OR_bootstrap.R -\name{DID_EC_OR_bootstrap} -\alias{DID_EC_OR_bootstrap} -\title{Difference in difference + outcome regression + external control borrowing} -\usage{ -DID_EC_OR_bootstrap( - data = data, - indices = indices, - outcome_col_name, - trial_status_col_name, - treatment_col_name, - covariates_col_name, - T_cross, - model_form_mu0_ext = "", - model_form_mu0_rct = "", - model_form_mu1_rct = "" -) -} -\arguments{ -\item{data}{A data frame containing all subject-level data.} - -\item{indices}{Bootstrap sample indices.} - -\item{outcome_col_name}{Character vector of outcome column names.} - -\item{trial_status_col_name}{Name of the trial status column.} - -\item{treatment_col_name}{Name of the treatment column.} - -\item{covariates_col_name}{Character vector of covariate column names.} - -\item{T_cross}{Integer crossover time point.} - -\item{model_form_mu0_ext}{Formula string(s) for the external control outcome model.} - -\item{model_form_mu0_rct}{Formula string(s) for the RCT control outcome model.} - -\item{model_form_mu1_rct}{Formula string(s) for the RCT treatment outcome model.} -} -\value{ -tau and standard deviation -} -\description{ -Difference in difference + outcome regression + external control borrowing -} -\examples{ -\dontrun{ -model_form_mu <- c( - "y1 ~ x1 + x2", - "y2 ~ x1 + x2", - "y3 ~ x1 + x2", - "y4 ~ x1 + x2" -) -res1 <- DID_EC_OR( - outcome = Y, trial_status = S, treatment = A, covariates = X, - long_term_marker = c(F, T, T, T), - model_form_mu0_ext = model_form_mu, - model_form_mu0_rct = model_form_mu, - model_form_mu1_rct = model_form_mu -) -} -} diff --git a/man/EC_AIPW_OPT.Rd b/man/EC_AIPW_OPT.Rd deleted file mode 100644 index 7db1793..0000000 --- a/man/EC_AIPW_OPT.Rd +++ /dev/null @@ -1,74 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/EC_AIPW_OPT.R -\name{EC_AIPW_OPT} -\alias{EC_AIPW_OPT} -\title{Using AIPW with external borrowing} -\usage{ -EC_AIPW_OPT( - data, - outcome_col_name, - trial_status_col_name, - treatment_col_name, - covariates_col_name, - model_form_piS = "", - model_form_mu0_ext = "", - optimal_weight_flag = FALSE, - wt = 0, - Bootstrap = FALSE, - R = 500, - bootstrap_CI_type = "bca", - alpha = 0.05, - quiet = TRUE -) -} -\arguments{ -\item{data}{A data frame containing all subject-level data.} - -\item{outcome_col_name}{Character vector of outcome column names.} - -\item{trial_status_col_name}{Name of the trial status column.} - -\item{treatment_col_name}{Name of the treatment column.} - -\item{covariates_col_name}{Character vector of covariate column names.} - -\item{model_form_piS}{Formula string for the trial participation model.} - -\item{model_form_mu0_ext}{Formula string(s) for the external control outcome model.} - -\item{optimal_weight_flag}{Logical. Whether to use the optimal borrowing weight.} - -\item{wt}{Numeric fixed borrowing weight.} - -\item{Bootstrap}{Logical. Whether to use bootstrap inference.} - -\item{R}{Number of bootstrap replicates.} - -\item{bootstrap_CI_type}{Type of bootstrap CI (e.g. \code{"bca"}, \code{"perc"}).} - -\item{alpha}{Significance level.} - -\item{quiet}{Logical. If \code{TRUE}, suppress printed output.} -} -\value{ -a list containing: tau (effect size), sd.tau (standard deviation), wt (weight) -} -\description{ -Using AIPW with external borrowing -} -\examples{ -\dontrun{ -res <- EC_AIPW_OPT( - data = data, - outcome_col_name = outcome_col_name, - trial_status_col_name = trial_status_col_name, - treatment_col_name = treatment_col_name, - covariates_col_name = covariates_col_name, - model_form_piS = model_form_piS, - model_form_mu0 = model_form_mu0, - wt = wt, - optimal_weight_flag = optimal_weight_flag, - Bootstrap -) -} -} diff --git a/man/EC_AIPW_OPT_bootstrap.Rd b/man/EC_AIPW_OPT_bootstrap.Rd deleted file mode 100644 index 2d0c481..0000000 --- a/man/EC_AIPW_OPT_bootstrap.Rd +++ /dev/null @@ -1,62 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/EC_AIPW_OPT_bootstrap.R -\name{EC_AIPW_OPT_bootstrap} -\alias{EC_AIPW_OPT_bootstrap} -\title{Using AIPW with external borrowing} -\usage{ -EC_AIPW_OPT_bootstrap( - data, - indices, - outcome_col_name, - trial_status_col_name, - treatment_col_name, - covariates_col_name, - model_form_piS = "", - model_form_mu0_ext = "", - optimal_weight_flag = FALSE, - wt = 0 -) -} -\arguments{ -\item{data}{A data frame containing all subject-level data.} - -\item{indices}{Bootstrap sample indices.} - -\item{outcome_col_name}{Character vector of outcome column names.} - -\item{trial_status_col_name}{Name of the trial status column.} - -\item{treatment_col_name}{Name of the treatment column.} - -\item{covariates_col_name}{Character vector of covariate column names.} - -\item{model_form_piS}{Formula string for the trial participation model.} - -\item{model_form_mu0_ext}{Formula string(s) for the external control outcome model.} - -\item{optimal_weight_flag}{Logical. Whether to use the optimal borrowing weight.} - -\item{wt}{Numeric fixed borrowing weight.} -} -\value{ -a list containing: tau (effect size), sd.tau (standard deviation), wt (weight) -} -\description{ -Using AIPW with external borrowing -} -\examples{ -\dontrun{ -res <- EC_AIPW_OPT( - data = data, - outcome_col_name = outcome_col_name, - trial_status_col_name = trial_status_col_name, - treatment_col_name = treatment_col_name, - covariates_col_name = covariates_col_name, - model_form_piS = model_form_piS, - model_form_mu0 = model_form_mu0, - wt = wt, - optimal_weight_flag = optimal_weight_flag, - Bootstrap -) -} -} diff --git a/man/EC_IPW_OPT.Rd b/man/EC_IPW_OPT.Rd deleted file mode 100644 index 4ce4486..0000000 --- a/man/EC_IPW_OPT.Rd +++ /dev/null @@ -1,70 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/EC_IPW_OPT.R -\name{EC_IPW_OPT} -\alias{EC_IPW_OPT} -\title{Using IPW with external borrowing} -\usage{ -EC_IPW_OPT( - data, - outcome_col_name, - trial_status_col_name, - treatment_col_name, - covariates_col_name, - model_form_piS = "", - optimal_weight_flag = FALSE, - wt = 0, - Bootstrap = FALSE, - R = 500, - bootstrap_CI_type = "bca", - alpha = 0.05, - quiet = TRUE -) -} -\arguments{ -\item{data}{A data frame containing all subject-level data.} - -\item{outcome_col_name}{Character vector of outcome column names.} - -\item{trial_status_col_name}{Name of the trial status column.} - -\item{treatment_col_name}{Name of the treatment column.} - -\item{covariates_col_name}{Character vector of covariate column names.} - -\item{model_form_piS}{Formula string for the trial participation model.} - -\item{optimal_weight_flag}{Logical. Whether to use the optimal borrowing weight.} - -\item{wt}{Numeric fixed borrowing weight.} - -\item{Bootstrap}{Logical. Whether to use bootstrap inference.} - -\item{R}{Number of bootstrap replicates.} - -\item{bootstrap_CI_type}{Type of bootstrap CI (e.g. \code{"bca"}, \code{"perc"}).} - -\item{alpha}{Significance level.} - -\item{quiet}{Logical. If \code{TRUE}, suppress printed output.} -} -\value{ -a list containing: tau (effect size), sd.tau (standard deviation), wt (weight) -} -\description{ -Using IPW with external borrowing -} -\examples{ -\dontrun{ -EC_IPW_OPT( - data = data, - outcome_col_name = outcome_col_name, - trial_status_col_name = trial_status_col_name, - treatment_col_name = treatment_col_name, - covariates_col_name = covariates_col_name, - model_form_piS = model_form_piS, - wt = wt, - optimal_weight_flag = optimal_weight_flag, - Bootstrap, R, bootstrap_CI_type -) -} -} diff --git a/man/EC_IPW_OPT_bootstrap.Rd b/man/EC_IPW_OPT_bootstrap.Rd deleted file mode 100644 index 8aa6d94..0000000 --- a/man/EC_IPW_OPT_bootstrap.Rd +++ /dev/null @@ -1,57 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/EC_IPW_OPT_bootstrap.R -\name{EC_IPW_OPT_bootstrap} -\alias{EC_IPW_OPT_bootstrap} -\title{Using IPW with external borrowing} -\usage{ -EC_IPW_OPT_bootstrap( - data, - indices, - outcome_col_name, - trial_status_col_name, - treatment_col_name, - covariates_col_name, - model_form_piS = "", - optimal_weight_flag = FALSE, - wt = 0 -) -} -\arguments{ -\item{data}{A data frame containing all subject-level data.} - -\item{indices}{Bootstrap sample indices.} - -\item{outcome_col_name}{Character vector of outcome column names.} - -\item{trial_status_col_name}{Name of the trial status column.} - -\item{treatment_col_name}{Name of the treatment column.} - -\item{covariates_col_name}{Character vector of covariate column names.} - -\item{model_form_piS}{Formula string for the trial participation model.} - -\item{optimal_weight_flag}{Logical. Whether to use the optimal borrowing weight.} - -\item{wt}{Numeric fixed borrowing weight.} -} -\value{ -a list containing: tau (effect size), sd.tau (standard deviation), wt (weight) -} -\description{ -Using IPW with external borrowing -} -\examples{ -\dontrun{ -EC_IPW_OPT( - outcome = outcome, - trial_status = trial_status, - treatment = treatment, - covariates = covariates, - model_form_piS = model_form_piS, - wt = wt, - optimal_weight_flag = optimal_weight_flag, - Bootstrap -) -} -} diff --git a/man/SCM.Rd b/man/SCM.Rd deleted file mode 100644 index 6cf0368..0000000 --- a/man/SCM.Rd +++ /dev/null @@ -1,67 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/SCM.R -\name{SCM} -\alias{SCM} -\title{Implement the Synthetic Control Method} -\usage{ -SCM( - data, - outcome_col_name, - trial_status_col_name, - treatment_col_name, - covariates_col_name, - T_cross, - Bootstrap = TRUE, - R = 100, - bootstrap_CI_type = "bca", - alpha = 0.05, - lambda.min = 0, - lambda.max = 0.1, - nlambda = 2, - parallel = "no", - ncpus = 1, - quiet = TRUE -) -} -\arguments{ -\item{data}{A data frame containing all subject-level data.} - -\item{outcome_col_name}{Character vector of outcome column names.} - -\item{trial_status_col_name}{Name of the trial status column.} - -\item{treatment_col_name}{Name of the treatment column.} - -\item{covariates_col_name}{Character vector of covariate column names.} - -\item{T_cross}{Integer crossover time point.} - -\item{Bootstrap}{Logical. Whether to use bootstrap inference.} - -\item{R}{Number of bootstrap replicates.} - -\item{bootstrap_CI_type}{Type of bootstrap CI (e.g. \code{"bca"}, \code{"perc"}).} - -\item{alpha}{Significance level.} - -\item{lambda.min}{Numeric. Minimum penalty parameter.} - -\item{lambda.max}{Numeric. Maximum penalty parameter.} - -\item{nlambda}{Integer. Number of lambda values for cross-validation.} - -\item{parallel}{Character. Parallelization type for \code{boot}.} - -\item{ncpus}{Integer. Number of CPUs for parallel bootstrap.} - -\item{quiet}{Logical. If \code{TRUE}, suppress printed output.} -} -\value{ -A list contains: estimated ATE, SE, weight used, SE by Bootstrap - and a 95% confidence interval for primary endpoint (only when - Bootstrap=TRUE) -} -\description{ -SCM() is the main function that calculates the estimated ATE by SC method -and Bootstrap CI. It calls subject_SC() and lambdacv(). -} diff --git a/man/lambdacv.Rd b/man/lambdacv.Rd deleted file mode 100644 index 1c156b0..0000000 --- a/man/lambdacv.Rd +++ /dev/null @@ -1,31 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/SCM.R -\name{lambdacv} -\alias{lambdacv} -\title{Find the optimal lambda via LOOCV} -\usage{ -lambdacv( - ec, - long_term_col_name, - lambda.min = 0, - lambda.max = 0.1, - nlambda = 10, - pb = NULL -) -} -\arguments{ -\item{ec}{Matrix of external control data (attributes by columns).} - -\item{long_term_col_name}{Character vector of long-term outcome column names.} - -\item{lambda.min}{Numeric. Minimum penalty parameter.} - -\item{lambda.max}{Numeric. Maximum penalty parameter.} - -\item{nlambda}{Integer. Number of lambda values to evaluate.} - -\item{pb}{A progress bar object or \code{NULL}.} -} -\description{ -Find the optimal lambda via LOOCV -} diff --git a/man/subject_SC.Rd b/man/subject_SC.Rd deleted file mode 100644 index 6ab03eb..0000000 --- a/man/subject_SC.Rd +++ /dev/null @@ -1,22 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/SCM.R -\name{subject_SC} -\alias{subject_SC} -\title{Find synthetic control for one specific subject} -\usage{ -subject_SC(subject, X10, X00, long_term_col_name, lambda) -} -\arguments{ -\item{subject}{Integer index of the target subject.} - -\item{X10}{Matrix of RCT control subjects (attributes by columns).} - -\item{X00}{Matrix of external control subjects (attributes by columns).} - -\item{long_term_col_name}{Character vector of long-term outcome column names.} - -\item{lambda}{Numeric penalty parameter.} -} -\description{ -Find synthetic control for one specific subject -}