foreca {ForeCA} | R Documentation |
Forecastable Component Analysis
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
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 |
n.comp |
positive integer; number of components to be extracted.
Default: |
algorithm.control |
list; control settings for any iterative ForeCA
algorithm. See |
... |
additional arguments passed to available ForeCA algorithms. |
U |
a |
f.U |
multivariate spectrum of class |
spectrum.control |
list; control settings for spectrum estimation.
See |
entropy.control |
list; control settings for entropy estimation.
See |
keep.all.optima |
logical; if |
dewhitening |
optional; if provided (returned by |
plot |
logical; if |
Value
An object of class foreca
, which is similar to the output from princomp
,
with the following components (amongst others):
center
: sample mean\widehat{\mu}_X
of eachseries
,whitening
: whitening matrix of sizeK \times K
fromwhiten
:\mathbf{U}_t = (\mathbf{X}_t - \widehat{\mu}_X) \cdot whitening
; note that\mathbf{X}_t
is centered prior to the whitening transformation,weightvectors
: orthonormal matrix of sizeK \times n.comp
, which converts whitened data ton.comp
forecastable components (ForeCs)\mathbf{F}_t = \mathbf{U}_t \cdot weightvectors
,loadings
: combination of whitening\times
weightvectors to obtain the final loadings for the original data:\mathbf{F}_t = (\mathbf{X}_t - \widehat{\mu}_X) \cdot whitening \cdot weightvectors
; again, it centers\mathbf{X}_t
first,loadings.normalized
: normalized loadings (unit norm). Note though that if you use these normalized loadings the resulting signals do not have variance 1 anymore.scores
:n.comp
forecastable components\mathbf{F}_t
. They have mean 0, variance 1, and are uncorrelated.Omega
: forecastability score of each ForeC of\mathbf{F}_t
.
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(\lambda)
of a linear combination
y_t = \mathbf{X}_t \mathbf{w}
can be analytically computed from
the multivariate spectrum f_{\mathbf{X}}(\lambda)
by the
quadratic form
f_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
\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 \Omega
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
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)