foreca {ForeCA}R Documentation

Forecastable Component Analysis

Description

foreca performs Forecastable Component Analysis (ForeCA) on Xt\mathbf{X}_t – a KK-dimensional time series with TT 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 wi\mathbf{w}_i and whitened time series Ut\mathbf{U}_t.

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

Usage

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×KT \times K array with T observations from the KK-dimensional time series Xt\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×KT \times K array with T observations from the KK-dimensional whitened (whiten) time series Ut\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 Xt\mathbf{X}_t and it uses that vector (normalized) as the initial weightvector which corresponds to the series Xt,i\mathbf{X}_{t,i} with larges Omega.

plot

logical; if TRUE a plot of the current optimal solution wi\mathbf{w}_i^* will be shown and updated for each iteration i=1,...,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 Ft\mathbf{F}_t can be different to the reported $Omega estimates from foreca. Here is why:

In theory fy(λ)f_y(\lambda) of a linear combination yt=Xtwy_t = \mathbf{X}_t \mathbf{w} can be analytically computed from the multivariate spectrum fX(λ)f_{\mathbf{X}}(\lambda) by the quadratic form fy(λ)=wfX(λ)wf_y(\lambda) = \mathbf{w}' f_{\mathbf{X}}(\lambda) \mathbf{w} for all λ\lambda (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 Xt\mathbf{X}_t and the combined univariate time series yty_t (which is usually more smooth, less variable). Thus estimating f^y\widehat{f}_y directly from yty_t can give slightly different estimates to computing it as wf^Xw\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 Ω\Omega from the resulting ForeCs Ft\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

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)

[Package ForeCA version 0.2.7 Index]