foreca: Forecastable Component Analysis

Description Usage Arguments Value Warning References Examples

View source: R/foreca.R

Description

foreca performs Forecastable Component Analysis (ForeCA) on \mathbf{X}_t – a K-dimensional time series with T observations. Users should only call foreca, rather than foreca.one_weightvector or foreca.multiple_weightvectors.

foreca.one_weightvector is a wrapper around several algorithms that solve the ForeCA optimization problem for a single weightvector \mathbf{w}_i and whitened time series \mathbf{U}_t.

foreca.multiple_weightvectors applies foreca.one_weightvector iteratively to \mathbf{U}_t in order to obtain multiple weightvectors that yield most forecastable, uncorrelated signals.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
foreca(series, n.comp = 2, algorithm.control = list(type = "EM"), ...)

foreca.one_weightvector(
  U,
  f.U = NULL,
  spectrum.control = list(),
  entropy.control = list(),
  algorithm.control = list(),
  keep.all.optima = FALSE,
  dewhitening = NULL,
  ...
)

foreca.multiple_weightvectors(
  U,
  spectrum.control = list(),
  entropy.control = list(),
  algorithm.control = list(),
  n.comp = 2,
  plot = FALSE,
  dewhitening = NULL,
  ...
)

Arguments

series

a T \times K array with T observations from the K-dimensional time series \mathbf{X}_t. Can be a matrix, data.frame, or a multivariate ts object.

n.comp

positive integer; number of components to be extracted. Default: 2.

algorithm.control

list; control settings for any iterative ForeCA algorithm. See complete_algorithm_control for details.

...

additional arguments passed to available ForeCA algorithms.

U

a T \times K array with T observations from the K-dimensional whitened (whiten) time series \mathbf{U}_t. Can be a matrix, data.frame, or a multivariate ts object.

f.U

multivariate spectrum of class 'mvspectrum' with normalize = TRUE.

spectrum.control

list; control settings for spectrum estimation. See complete_spectrum_control for details.

entropy.control

list; control settings for entropy estimation. See complete_entropy_control for details.

keep.all.optima

logical; if TRUE, it keeps the optimal solutions of each random start. Default: FALSE (only returns the best solution).

dewhitening

optional; if provided (returned by whiten) then it uses the dewhitening transformation to obtain the original series \mathbf{X}_t and it uses that vector (normalized) as the initial weightvector which corresponds to the series \mathbf{X}_{t,i} with larges Omega.

plot

logical; if TRUE a plot of the current optimal solution \mathbf{w}_i^* will be shown and updated for each iteration i = 1, ..., n.comp of any iterative algorithm. Default: FALSE.

Value

An object of class foreca, which is similar to the output from princomp, with the following components (amongst others):

ForeCs are ordered from most to least forecastable (according to Omega).

Warning

Estimating Omega directly from the ForeCs \mathbf{F}_t can be different to the reported $Omega estimates from foreca. Here is why:

In theory f_y(λ) of a linear combination y_t = \mathbf{X}_t \mathbf{w} can be analytically computed from the multivariate spectrum f_{\mathbf{X}}(λ) by the quadratic form f_y(λ) = \mathbf{w}' f_{\mathbf{X}}(λ) \mathbf{w} for all λ (see spectrum_of_linear_combination).

In practice, however, this identity does not hold always exactly since (often data-driven) control setting for spectrum estimation are not identical for the high-dimensional, noisy \mathbf{X}_t and the combined univariate time series y_t (which is usually more smooth, less variable). Thus estimating \widehat{f}_y directly from y_t can give slightly different estimates to computing it as \mathbf{w}'\widehat{f}_{\mathbf{X}}\mathbf{w}. Consequently also Omega estimates can be different.

In general, these differences are small and have no relevant implications for estimating ForeCs. However, in rare occasions the obtained ForeCs can have smaller Omega than the maximum Omega across all original series. In such a case users should not re-estimate Ω from the resulting ForeCs \mathbf{F}_t, but access them via $Omega provided by 'foreca' output (the univariate estimates are stored in $Omega.univ).

References

Goerg, G. M. (2013). “Forecastable Component Analysis”. Journal of Machine Learning Research (JMLR) W&CP 28 (2): 64-72, 2013. Available at http://jmlr.org/proceedings/papers/v28/goerg13.html.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
XX <- diff(log(EuStockMarkets)) * 100
plot(ts(XX))
## Not run: 
ff <- foreca(XX[,1:4], n.comp = 4, plot = TRUE, spectrum.control=list(method="pspectrum"))
ff
summary(ff)
plot(ff)

## End(Not run)


## Not run: 
PW <- whiten(XX)
one.weight.em <- foreca.one_weightvector(U = PW$U,
                                        dewhitening = PW$dewhitening,
                                        algorithm.control =
                                          list(num.starts = 2,
                                               type = "EM"),
                                        spectrum.control =
                                          list(method = "mvspec"))
plot(one.weight.em)

## End(Not run)
## Not run: 

PW <- whiten(XX)
ff <- foreca.multiple_weightvectors(PW$U, n.comp = 2,
                                    dewhitening = PW$dewhitening)
ff
plot(ff$scores)

## End(Not run)

ForeCA documentation built on July 1, 2020, 7:50 p.m.