R/FullExperiment.US.R

Defines functions FullExperiment.US

Documented in FullExperiment.US

#' FULL EXPERIMENT - runs an experiment for one distribution
#'
#' @param distribution One of the following strings : "normal", "gamma.skewed", "gamma.symmetrical",
#' "log.normal","bimodal1","bimodal2" ,"t3" , "laplace"
#' @param MC number of monte carlo replications
#' @param n an integer - sample size from each population
#' @param cl a parallel::makeCluster object
#' @param US_ratio factor to multiply the bandwidth (default = 0.5)
#' @return simsalapar's experiment resutls, for the following parameter grid :
#' AUC = 0.7,0.8,0.9 ; theta_squared = 0.5,1,2 ; var_eq = TRUE, FALSE ; ME_var_ratio = 0.5,1,2
#' to be used with write.csv directly
#' @examples FullExperiment.US("gamma.skewed",MC=2,n=250,cl=parallel::makeCluster(parallel::detectCores()-1))
#' @export

FullExperiment.US <- function(distribution, MC, n, cl=parallel::makeCluster(parallel::detectCores()-1), US_ratio){
  tictoc::tic()
  AUC.values <- c(0.7,0.8,0.9)
  AUC.values <- c(0.7,0.8,0.9)
  theta_squared.values <- c(0.5,1,2)
  var_eq.values <- c(TRUE,FALSE)
  ME_var_ratio.values <- c(0.5,1,2)
  distribution.values <- distribution


    varList <- simsalapar::varlist(
    n.sim = list(type = "N", expr = quote(n.sim),  value = MC),
    theta_squared = list(type = "grid",expr = quote(theta^2), value =theta_squared.values),
    AUC = list(type = "grid",expr = quote(A), value = AUC.values),
    var_eq = list(type = "grid",expr = quote("VX=VY"), value = var_eq.values),
    ME_var_ratio = list(type = "grid",expr = quote(Veps/Veta), value = ME_var_ratio.values),
    distribution = list(type = "grid", expr = quote(F), value = distribution.values),
    US_ratio = list(type = "frozen", expr = quote(q),value = c(0.5,0.25)),
    n = list(type = "frozen", expr = quote(n), value = n)

  )
  RES <- simsalapar::doForeach(vList = varList,
                               doOne = AtomicSim.US,
                               monitor = interactive(),
                               extraPkgs = c("QPdecon","boot","coxed"),
                               cluster = cl)


  tictoc::toc()
  return(RES)


}
blebedenko/thescript2 documentation built on Dec. 19, 2021, 9:53 a.m.