Running 'backtest.function.test.R' [156s]
  Running 'backtest.summary.test.R' [149s]
  Running 'backtest.totalCounts.test.R' [0s]
  Running 'bt.mean.test.R' [0s]
  Running 'bt.spread.test.R' [0s]
  Running 'bucketize.test.R' [0s]
  Running 'bucketize.test2.R' [160s]
  Running 'calc.true.weight.test.R' [0s]
  Running 'calc.turnover.test.R' [0s]
  Running 'categorize.test.R' [163s]
  Running 'overlaps.compute.test.R' [0s]
Running the tests in 'tests/backtest.function.test.R' failed.
Complete output:
  > ################################################################################
  > ##
  > ## $Id: backtest.function.test.R 1300 2008-08-27 21:01:11Z zhao $
  > ##
  > ## Tests for function "backtest.function"
  > ##
  > ################################################################################
  > 
  > library(backtest)
  Loading required package: grid
  Loading required package: lattice
  > 
  > load("backtest.function.test.RData")
  > 
  > ## save(x, truth.1, truth.2, truth.3, truth.4.A, truth.4.B, file = "backtest.function.test.RData", compress = TRUE)
  > 
  > bt.1 <- backtest(x, in.var = "in.var.1", ret.var = "ret.var.1", by.period = FALSE)
  > bt.2 <- backtest(x, in.var = "in.var.1", ret.var = "ret.var.1", by.var = "country", by.period = FALSE)
  > bt.3 <- backtest(x, id.var = "id", in.var = "in.var.1", ret.var = "ret.var.1", date.var = "date", by.period = FALSE)
  > bt.4 <- backtest(x, in.var = c("in.var.1", "in.var.2"), ret.var = "ret.var.1", by.var = "country", by.period = FALSE)
  > bt.5 <- backtest(x, in.var = "in.var.1", ret.var = "ret.var.1", by.period = TRUE, date.var = "date", buckets = 2)
  > bt.6 <- backtest(x, in.var = "in.var.1", ret.var = "ret.var.1", by.period = TRUE, date.var = "date", natural = TRUE, id = "id", buckets = 2)
  > bt.7 <- backtest(x, id.var = "id", in.var = "in.var.1", ret.var = "ret.var.1", by.period = FALSE, date.var = "date", overlaps = 2)
  > 
  > stopifnot(
  +           all.equal(truth.1, as.numeric(bt.1@results[1,1 , , ,"means"])),
  +           all(mapply(all.equal, truth.2, bt.2@results[1,1 , , ,"means"])),
  +           all(mapply(all.equal, truth.3, bt.3@results[1,1 , , ,"means"])),
  +           all(mapply(all.equal, truth.4.A, bt.4@results["ret.var.1","in.var.1", , ,"means"])),
  +           all(mapply(all.equal, truth.4.B, bt.4@results["ret.var.1","in.var.2", , ,"means"])),
  +           all(mapply(all.equal, truth.5, bt.5@results[1,1 , , ,"means"])),
  +           all(mapply(all.equal, truth.6, bt.6@results[1,1 , , ,"means"]))
  +           )
  > 
  > 
  > proc.time()
     user  system elapsed 
     0.35    0.10    0.40 
Running the tests in 'tests/backtest.summary.test.R' failed.
Complete output:
  > ################################################################################
  > ##
  > ## $Id: backtest.summary.test.R 1300 2008-08-27 21:01:11Z zhao $
  > ##
  > ## Tests to make sure the summary method doesn't crash
  > ##
  > ################################################################################
  > 
  > library(backtest)
  Loading required package: grid
  Loading required package: lattice
  > 
  > load("backtest.summary.test.RData")
  > 
  > ## save(x, file = "backtest.summary.test.RData", compress = TRUE)
  > 
  > bt.1 <- backtest(x, in.var = "in.var.1", ret.var = "ret.var.1", by.period = FALSE)
  > bt.2 <- backtest(x, in.var = "in.var.1", ret.var = "ret.var.1", by.var = "country", by.period = FALSE)
  > bt.3 <- backtest(x, id.var = "id", in.var = "in.var.1", ret.var = "ret.var.1", date.var = "date", by.period = FALSE)
  > bt.4 <- backtest(x, in.var = c("in.var.1", "in.var.2"), ret.var = "ret.var.1", by.var = "country", by.period = FALSE)
  > bt.5 <- backtest(x, in.var = c("in.var.1", "in.var.2"), ret.var = c("ret.var.1", "ret.var.2"), by.period = FALSE)
  > bt.6 <- backtest(x, in.var = c("in.var.1"), ret.var = c("ret.var.1", "ret.var.2"), by.period = FALSE)
  > 
  > summary(bt.1)
  Backtest conducted with:
  
  1 in.var: in.var.1;
  1 ret.var: ret.var.1;
  and no by.var;
  do.spread: TRUE;
  by.period: FALSE.
  
                low         2          3         4       high     spread
  pooled -0.2204533 0.1969346 -0.1061004 0.4310313 -0.1926172 0.02783605
  
  > summary(bt.2)
  Backtest conducted with:
  
  1 in.var: in.var.1;
  1 ret.var: ret.var.1;
  and by.var: country;
  do.spread: TRUE;
  by.period: FALSE.
  
             low          2          3         4       high    spread
  ESP         NA         NA         NA 0.2304643         NA        NA
  GBR         NA         NA         NA        NA -2.3054923        NA
  HKG  0.6110058         NA         NA        NA         NA        NA
  JPN         NA  0.3607647  0.3485136 0.2946172         NA        NA
  NLD         NA         NA         NA        NA  0.6699653        NA
  SWE         NA -0.1483777         NA        NA         NA        NA
  USA -0.4976063  0.2876756 -0.2576383 0.5995219  0.4325291 0.9301354
  
  > summary(bt.3)
  Backtest conducted with:
  
  1 in.var: in.var.1;
  1 ret.var: ret.var.1;
  and no by.var;
  do.spread: TRUE;
  by.period: FALSE.
  
                    low          2          3          4       high    spread
  1995-01-31         NA -0.1483777  0.3485136 0.26254072         NA        NA
  1995-02-28  0.2107342         NA -0.2717032         NA  0.6699653 0.4592311
  1995-03-31         NA  0.6940432  0.8261898         NA -2.3054923        NA
  1995-04-30         NA -0.4519704 -1.3274016 0.01752902  0.2887523        NA
  1995-05-31 -0.6516407         NA         NA 1.18151475  0.5763059 1.2279465
  
  > summary(bt.4)
  Backtest conducted with:
  
  2 in.vars: in.var.1, in.var.2;
  1 ret.var: ret.var.1;
  and by.var: country;
  do.spread: TRUE;
  by.period: FALSE.
  
       in.var.1   in.var.2
  ESP        NA         NA
  GBR        NA         NA
  HKG        NA         NA
  JPN        NA  0.0122511
  NLD        NA         NA
  SWE        NA         NA
  USA 0.9301354 -0.1486387
  
  > summary(bt.5)
  Backtest conducted with:
  
  2 in.vars: in.var.1, in.var.2;
  2 ret.vars: ret.var.1, ret.var.2;
  and no by.var;
  do.spread: TRUE;
  by.period: FALSE.
  
               in.var.1     in.var.2
  ret.var.1  0.02783605 -0.002010991
  ret.var.2 -1.27419914  0.946719893
  
  > summary(bt.6)
  Backtest conducted with:
  
  1 in.var: in.var.1;
  2 ret.vars: ret.var.1, ret.var.2;
  and no by.var;
  do.spread: TRUE;
  by.period: FALSE.
  
                   low         2           3          4        high      spread
  ret.var.1 -0.2204533 0.1969346 -0.10610035  0.4310313 -0.19261721  0.02783605
  ret.var.2  1.3006149 1.5996118 -0.05232886 -1.2450415  0.02641577 -1.27419914
  
  > 
  > proc.time()
     user  system elapsed 
     0.29    0.17    0.40 
Running the tests in 'tests/bucketize.test2.R' failed.
Complete output:
  > ##############################################################
  > ##
  > ## Another test for function "bucketize"
  > ##
  > ##############################################################
  > 
  > library(backtest)
  Loading required package: grid
  Loading required package: lattice
  > 
  > load("bucketize.test2.RData")
  > 
  > 
  > ## save(tmp.2, tmp.2.x, tmp.2.y, truth.2, file = "bucketize.test2.RData")
  > 
  > ## Find result from a bucketize test
  > 
  > result.2 <- backtest:::bucketize(tmp.2, tmp.2.x, tmp.2.y, compute = mean)
  > 
  > ## Did the test case work?
  > 
  > stopifnot(
  +           isTRUE(all.equal(result.2, truth.2))
  +           )
  > 
  > proc.time()
     user  system elapsed 
     0.28    0.07    0.32 
Running the tests in 'tests/categorize.test.R' failed.
Complete output:
  > ################################################################################
  > ##
  > ## $Id: categorize.test.R 1300 2008-08-27 21:01:11Z zhao $
  > ##
  > ## Tests for function "categorize"
  > ##
  > ################################################################################
  > 
  > library(backtest)
  Loading required package: grid
  Loading required package: lattice
  > 
  > load("categorize.test.RData")
  > 
  > ## save(tmp.1, tmp.1.n, truth.1, tmp.2, truth.2, file = "categorize.test.RData", compress = TRUE)
  > 
  > result.1 <- backtest:::categorize(tmp.1, n = tmp.1.n)
  > result.2 <- backtest:::categorize(tmp.2)
  > 
  > stopifnot(
  +           isTRUE(all.equal(result.1, truth.1)),
  +           isTRUE(all.equal(result.2, truth.2))
  +         )
  > 
  > proc.time()
     user  system elapsed 
     0.25    0.06    0.29