Running '00-auer.R' [168s]
Running the tests in 'tests/00-auer.R' failed.
Complete output:
  > #######################################################
  > library(PCDimension)
  Loading required package: ClassDiscovery
  Loading required package: cluster
  Loading required package: oompaBase
  > # simulate one unstructured dataset
  > suppressWarnings( RNGversion("3.5.0") )
  > set.seed(992500)
  > NC <- 15
  > NS <- 200
  > ranData <- matrix(rnorm(NS*NC, 6), ncol=NC)
  > # perform PCA and get the set of variances/eigenvectors
  > spca <- SamplePCA(ranData)
  > lam <- spca@variances[1:(NC-1)] # remove 0 eigenvalue
  > rg <- 0:(NC-2)
  > 
  > ######################################################
  > # Test some internal routines
  > 
  > # Theory says that fhat is non-decreasing
  > fh <- sapply(rg, PCDimension:::fhat, Lambda=lam)
  > all( diff(fh) >= 0 ) # should be 'TRUE'
  [1] TRUE
  > 
  > plot( rg, fh, type='b', pch=16 )
  > 
  > # Theory says that dhat is non-increasing
  > thetas <- seq(0, 0.2, by=0.01)
  > dset <- sapply(thetas, PCDimension:::dhat, Lambda=lam)
  > all( diff(dset) <= 0 ) # should be 'TRUE'
  [1] TRUE
  > 
  > plot(thetas, dset, type='l')
  > 
  > ######################################################
  > # test external interface on random data
  > 
  > # Auer-Gervini Bayesian method
  > obj <- AuerGervini(spca)
  > summary(obj)
  An 'AuerGervini' object that estimates the number of principal components to be 0.
  > agDimension(obj)
  [1] 0
  > 
  > plot(obj)
  > 
  > # broken-stick model
  > bs <- brokenStick(1:NC, NC)
  > bs0 <- brokenStick(1:(NC-1), (NC-1))
  > 
  > pts <- screeplot(spca, ylim=c(0, 0.2))
  > lines(pts, bs, type='b', col='blue', lwd=2, pch=16)
  > lines(pts[-NC], bs0, type='b', col='red', lwd=2, pch=16)
  > 
  > # randomization based model
  > rndLambdaF(ranData)
  rndLambda      rndF 
          0         0 
  > 
  > rm(spca)
  > ######################################################
  > # get the previously computed simulated SamplePCA object
  > data(spca)
  > 
  > vars <- spca@variances
  > obj <- AuerGervini(vars, dd=dim(spca@scores))
  > summary(obj)
  An 'AuerGervini' object that estimates the number of principal components to be 1.
  > 
  > plot(obj)
  > 
  > f <- makeAgCpmFun("Exponential")
  > agfuns <- list(twice=agDimTwiceMean,
  +                km=agDimKmeans, km3=agDimKmeans3, 
  +                tt=agDimTtest, tt2=agDimTtest2,
  +                cpt=agDimCPT, cpm=f)
  > plot(obj, agfuns)
  > 
  > compareAgDimMethods(obj, agfuns)
  twice    km   km3    tt   tt2   cpt   cpm 
      1     1     1     3     1     1     3 
  > 
  > proc.time()
     user  system elapsed 
     3.09    0.40    3.50