Running 'fts.dpca.R' [164s]
  Running 'plots.R' [157s]
  Running 'splines.R' [171s]
Running the tests in 'tests/fts.dpca.R' failed.
Complete output:
  > #install(".")
  > library("freqdom")
  Loading required package: mvtnorm
  Loading required package: matrixcalc
  
  Attaching package: 'freqdom'
  
  The following object is masked from 'package:base':
  
      %*%
  
  > library("freqdom.fda")
  Loading required package: fda
  Loading required package: splines
  Loading required package: fds
  Loading required package: rainbow
  Loading required package: MASS
  Loading required package: pcaPP
  Loading required package: RCurl
  Loading required package: deSolve
  
  Attaching package: 'fda'
  
  The following object is masked from 'package:graphics':
  
      matplot
  
  > data(pm10)
  > pm10 = center.fd(pm10)
  > X = center.fd(pm10)
  > q = 20
  > 
  > # res.dpca = list()
  > # res.dpca$spec.density = fts.spectral.density(X, q = q)
  > # res.dpca$filters = fts.dpca.filters(res.dpca$spec.density, q = q, Ndpc = 5)
  > # res.dpca$scores = fts.dpca.scores(X, res.dpca$filters)
  > # res.dpca$var = fts.dpca.var(res.dpca$spec.density)
  > # res.dpca$Xhat = fts.dpca.KLexpansion(X, res.dpca$filters)
  > 
  > res.dpca = fts.dpca(X, Ndpc = 1)
  > plot(res.dpca$Xhat)
  [1] "done"
  > fts.plot.filters(res.dpca$filters)
  > 
  > # Compute PCA with only one component
  > res.pca = prcomp(t(X$coefs), center = TRUE)
  > res.pca$x[,-1] = 0
  > 
  > # Compute empirical variance explained
  > var.pca = (1 - sum( (res.pca$x %*% t(res.pca$rotation) - t(X$coefs) )**2 ) / sum(X$coefs**2))*100
  > var.dpca = (1 - sum( (res.dpca$Xhat$coefs - X$coefs)**2 ) / sum(X$coefs**2))*100
  > 
  > cat("Variance explained by PCA (empirical):\t\t",var.pca,"%\n")
  Variance explained by PCA (empirical):		 72.34056 %
  > cat("Variance explained by PCA (theoretical):\t",(1 - (res.pca$sdev[1] / sum(res.pca$sdev)))*100,"%\n")
  Variance explained by PCA (theoretical):	 63.17286 %
  > cat("Variance explained by DPCA (empirical):\t\t",var.dpca,"%\n")
  Variance explained by DPCA (empirical):		 82.64177 %
  > cat("Variance explained by DPCA (theoretical):\t",(res.dpca$var[1])*100,"%\n")
  Variance explained by DPCA (theoretical):	 78.91448 %
  > 
  > # Plot filters
  > fts.plot.filters(res.dpca$filters)
  > 
  > # Plot spectral density (note that in case of these data it's concentrated around 0)
  > fts.plot.operators(res.dpca$spec.density,freq = c(-2,-3:3/30 * pi,2))
  > 
  > # Plot covariance of X
  > fts.plot.covariance(X)
  > 
  > # Compare values of the first PC scores with the first DPC scores 
  > plot(res.pca$x[,1],t='l',xlab = "Time",ylab="Score", lwd = 2.5)
  > lines(res.dpca$scores[,1], col=2, lwd = 2.5)
  > legend(0,4,c("first PC score","first DPC score"), # puts text in the legend
  +        lty=c(1,1),lwd=c(2.5,2.5), col=1:2)
  > 
  > proc.time()
     user  system elapsed 
    12.75    1.82   14.57 
Running the tests in 'tests/plots.R' failed.
Complete output:
  > library("freqdom.fda")
  Loading required package: mvtnorm
  Loading required package: fda
  Loading required package: splines
  Loading required package: fds
  Loading required package: rainbow
  Loading required package: MASS
  Loading required package: pcaPP
  Loading required package: RCurl
  Loading required package: deSolve
  
  Attaching package: 'fda'
  
  The following object is masked from 'package:graphics':
  
      matplot
  
  Loading required package: freqdom
  Loading required package: matrixcalc
  
  Attaching package: 'freqdom'
  
  The following object is masked from 'package:base':
  
      %*%
  
  > data("pm10")
  > 
  > ## Dynamic PCA ##
  > X = center.fd(pm10)
  > SD = fts.spectral.density(X,q=20)
  > XI.est = fts.dpca.filters(SD)  # finds the optimal filter
  > Y.est = fts.dpca.scores(X, dpcs = XI.est)
  > Xdpca.est = fts.dpca.KLexpansion(X, XI.est)
  > plot(Xdpca.est)
  [1] "done"
  > 
  > #X = fts.rar(100,d=11)
  > #fts.plot.operators(fts.cov.structure(X,lags=-2:2), cor = FALSE, grid = TRUE)
  > fts.plot.covariance(X, lags=-3:0)
  > fts.plot.operators(SD, freq=c(-0.2,0,0.45))
  > 
  > fts.plot.filters(XI.est, Ndpc = 3, lags = -1:1, lty = 1, lwd = 2, col= c(2,6,3), one.plot = TRUE)
  > 
  > proc.time()
     user  system elapsed 
     8.23    1.29    9.51 
Running the tests in 'tests/splines.R' failed.
Complete output:
  > library("freqdom.fda")
  Loading required package: mvtnorm
  Loading required package: fda
  Loading required package: splines
  Loading required package: fds
  Loading required package: rainbow
  Loading required package: MASS
  Loading required package: pcaPP
  Loading required package: RCurl
  Loading required package: deSolve
  
  Attaching package: 'fda'
  
  The following object is masked from 'package:graphics':
  
      matplot
  
  Loading required package: freqdom
  Loading required package: matrixcalc
  
  Attaching package: 'freqdom'
  
  The following object is masked from 'package:base':
  
      %*%
  
  > 
  > ## TEST spline basis
  > X = fts.rar(100)
  > 
  > SD = fts.spectral.density(X,q=20)
  > XI.est = fts.dpca.filters(SD)  # finds the optimal filter
  > Y.est = fts.dpca.scores(X, dpcs = XI.est)
  > fts.dpca.var(SD)
   [1] 0.391210491 0.227457615 0.147121482 0.094119244 0.054517788 0.035339062
   [7] 0.020976621 0.013183499 0.008166331 0.005089571 0.002818296
  > Xdpca.est = fts.dpca.KLexpansion(X, XI.est)
  > 
  > fts.plot.covariance(X)
  > fts.plot.operators(SD, freq=c(-0.2,0,0.45))
  > 
  > fts.plot.filters(XI.est, Ndpc = 3, lags = -2:2, lty = 1, lwd = 2, col= 1:3, one.plot = TRUE)
  > 
  > proc.time()
     user  system elapsed 
     9.78    0.82   10.64