Running ‘doExtras.R’ [0s/0s]
  Comparing ‘doExtras.Rout’ to ‘doExtras.Rout.save’ ... OK
  Running ‘getArray-swap.R’ [1s/1s]
  Running ‘tst-wrongs.R’ [17s/40s]
  Running ‘tstTGforecasts.R’ [4s/10s]
  Running ‘tstVaRsuperadd.R’ [0s/1s]
  Running ‘varlist.R’ [1s/1s]
Running the tests in ‘tests/tstVaRsuperadd.R’ failed.
Complete output:
  > #### A "fast" and simplified version of demo(VaRsuperadd)
  > #### see ../demo/VaRsuperadd.R
  > ####     ~~~~~~~~~~~~~~~~~~~~~
  > 
  > require(simsalapar)
  Loading required package: simsalapar
  > source(system.file("xtraR/assertErr-etc.R", package="simsalapar", mustWork=TRUE))
  > 
  > ## Must be fast, rather than "interesting":
  > n.obs  <- 16
  > n.alpha <- 8
  > doExtras <- FALSE
  > 
  > demo(VaRsuperadd) # crucial part!
  
  
  	demo(VaRsuperadd)
  	---- ~~~~~~~~~~~
  
  > ## Copyright Marius Hofert
  > 
  > ### Goal: Simulation study for determining superadditivity of VaR
  > ### Submit via (for example):
  > ### bsub -N -W 01:00 -n 48 -R "select[model==Opteron8380]" -R "span[ptile=16]" \
  > ### mpirun -n 1 R CMD BATCH Brutus_demo.R
  > 
  > 
  > ### 0) Setup ###################################################################
  > 
  > usr <- Sys.info()[["user"]] # better portability than  Sys.getenv("USER")
  
  > if(exists("n.obs")   && is.numeric(n.obs) &&
  +    exists("n.alpha") && is.numeric(n.alpha)) {
  +     cat(">>> Using n.obs=", n.obs, ", n.alpha=", n.alpha, " <<<\n", sep="")
  + } else {
  +     ## user specific settings
  +     n.obs <- 100                        # default
  +     n.alpha <- 32
  +     switch(usr,
  + 	   "hofertj" =  {               # ETH Brutus
  + 	       setwd("/cluster/home/math/hofertj/VaRsuperadd")
  + 	       .libPaths("~/R/library")
  + 	       n.obs <- 1e4
  + 	       n.alpha <- 128
  + 	   },
  + 	   "mhofert" = {
  + 	       n.obs <- 1e4             # n=1e4 ~ 4min (standard notebook)
  + 	       n.alpha <- 128
  + 	   },
  + 	   "maechler" = {}
  + 	   )
  + }
  >>> Using n.obs=16, n.alpha=8 <<<
  
  > if(n.alpha > n.obs)
  +     stop("number of quantiles, n.alpha, must be smaller than the sample size, n.obs")
  
  > if(!exists("doExtras")) doExtras <- simsalapar:::doExtras()
  
  > doExtras
  [1] FALSE
  
  > ## load packages
  > require(simsalapar)
  
  > ## list of variables
  > varList <-
  +     varlist(
  +         ## sample size
  +         n = list(value = n.obs),
  +         ## dimensions, and weights (vector) for each d
  +         d = list(type="grid", value = c(4, 20, 100)),
  +         ## copula family names
  +         family = list(type="grid", expr = quote(C),
  +                       value = c("normal", "t", "Clayton", "Gumbel")), # t = t_4
  +         ## dependencies by Kendall's tau
  +         tau = list(type="grid", value = c(0.2, 0.5, 0.8)),
  +         ## margins
  +         qmargin = list(type="inner", expr = quote(F[j]),
  +                        value = c(norm = qnorm,
  +                        t4   = function(p) qt(p, df=4),
  +                        Par2 = function(p) (1-p)^(-1/2))), # Pareto(2)
  +         ## VaR confidence levels
  +         alpha = list(type="inner", value = 0:n.alpha/n.alpha))
  
  > ### 1) Functions ###############################################################
  > 
  > ##' @title Function to Compute F_{X_1+..+X_d}(d*F_1^-(\alpha))
  > ##' @author Marius Hofert
  > doOne <- function(n, d, family, tau, qmargin, alpha)
  + {
  +     ## checks (and load required packages here for parallel computing later on)
  +     ## stopifnot(require(copula))
  +     ## Note: This require() affects run time due to loading copula once on each
  +     ##       node, but this can easily be identified by *robust* analysis of all
  +     ##       run times (or is negligible due to much larger run times of the jobs)
  +     ##       or, as another alternative, can be avoided by using initExpr (see below)
  + 
  +     cop <- switch(family,
  +                 "normal" =
  +                   ellipCopula("normal", param=iTau(ellipCopula("normal"), tau=tau),
  +                               dim=d),
  +                 "t" =
  +                   ellipCopula("t", param=iTau(ellipCopula("t"), tau=tau), dim=d),
  +                 "Clayton" =
  +                   onacopulaL("Clayton", list(th=iTau(archmCopula("clayton"), tau),
  +                                              seq_len(d))),
  +                 "Gumbel" =
  +                   onacopulaL("Gumbel", list(th=iTau(archmCopula("gumbel"), tau),
  +                                             seq_len(d))),
  +                 stop("unsupported 'family'"))
  +     U <- rCopula(n, copula=cop)
  + 
  +     ## compute F_{X_1+..+X_d}(d*F_1^-(\alpha)) for all confidence levels alpha
  +     ## => VaR_alpha superadditive <=> F_{X_1+..+X_d}(d*F_1^-(\alpha)) - alpha < 0
  +     t(sapply(qmargin, function(FUN) ecdf(rowSums(FUN(U)))(d*FUN(alpha)) - alpha))
  +     ## note: t() is important here, since, otherwise, the order of the variables
  +     ## ----  would not be correct (=> check should reveal this)
  + }
  
  > ### 2) Main ####################################################################
  > 
  > ## check doOne
  > 
  > ## manually
  > require(copula) # for the following call of doOne()
  Loading required package: copula
  
  > nonGr <- get.nonGrids(varList)$nonGrids
  
  > dd <- doOne(n= min(nonGr$n, 100), d=4, family="Clayton", tau=0.5,
  +             qmargin=nonGr$qmargin, alpha=nonGr$alpha)
  Error in onacopulaL("Clayton", list(th = iTau(archmCopula("clayton"),  : 
    could not find function "onacopulaL"
  Calls: demo -> source -> withVisible -> eval -> eval -> doOne
  In addition: Warning message:
  In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
    there is no package called 'copula'
  Execution halted