#' Data generation function for simulation study
#'
#' @param n total number of units for simulation
#' @param scenario scenario indicate simulation scenario 1 or scenario 2
#' @param ratio
#' @param overlap levels of covariate overlap, weak/strong/moderate overlap
#' @param all_confounder For simulation scenario 2, moderate covariate overlap, whether it is lacking for a true confounder
#'
#' @return list with the 5 elements. Nested within each list, it contains
#' \item{n:}{Number of units for simulation}
#' \item{trt_ind:}{A data frame with number of rows equals to n and 11 columns}
#' \item{Y:}{Observed binary outcome for 3 treatments}
#' \item{Yobs:}{Observed binary outcome}
#' \item{Est:}{True ATE/ATT for RD/RR/OR}
#' @export data_gen
#'
#' @examples
data_gen <- function(n, scenario, ratio, overlap, all_confounder){
if (scenario == 1) {
data_gen_result <- data_gen_p1(n, ratio)
}
if (scenario == 2) {
data_gen_result <- data_gen_p1(n, overlap, all_confounder)
}
return(data_gen_result)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.