initialize_weightvector: Initialize weightvector for iterative ForeCA algorithms

View source: R/initialize_weightvector.R

initialize_weightvectorR Documentation

Initialize weightvector for iterative ForeCA algorithms

Description

initialize_weightvector returns a unit norm (in \ell^2) vector \mathbf{w}_0 \in R^K that can be used as the starting point for any iterative ForeCA algorithm, e.g., foreca.EM.one_weightvector. Several quickly computable heuristics are available via the method argument.

Usage

initialize_weightvector(
  U = NULL,
  f.U = NULL,
  num.series = ncol(U),
  method = c("rnorm", "max", "SFA", "PCA", "rcauchy", "runif", "SFA.slow", "SFA.fast",
    "PCA.large", "PCA.small"),
  seed = sample(1e+06, 1),
  ...
)

Arguments

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.

num.series

positive integer; number of time series K (determines the length of the weightvector). If num.series = 1 it simply returns a 1 \times 1 array equal to 1.

method

string; which heuristics should be used to generate a good starting \mathbf{w}_0? Default: "rnorm"; see Details.

seed

non-negative integer; seed for random initialization which will be returned for reproducibility. By default it sets a random seed.

...

additional arguments

Details

The method argument specifies the heuristics that is used to get a good starting vector \mathbf{w}_0:

"max"

vector with all 0s, but a 1 at the position of the maximum forecastable series in U.

"rcauchy"

random start using rcauchy(k).

"rnorm"

random start using rnorm(k, 0, 1).

"runif"

random start using runif(k, -1, 1).

"PCA.large"

first eigenvector of PCA (largest variance signal).

"PCA.small"

last eigenvector of PCA (smallest variance signal).

"PCA"

checks both small and large, and chooses the one with higher forecastability as computed by Omega..

"SFA.fast"

last eigenvector of SFA (fastest signal).

"SFA.slow"

first eigenvector of SFA (slowest signal).

"SFA"

checks both slow and fast, and chooses the one with higher forecastability as computed by Omega.

Each vector has length K and is automatically normalized to have unit norm in \ell^2.

For the 'SFA*' methods see sfa. Note that maximizing (or minimizing) the lag 1 auto-correlation does not necessarily yield the most forecastable signal, but it's a good start.

Value

numeric; a vector of length K with unit norm in \ell^2.

Examples

XX <- diff(log(EuStockMarkets))
## Not run: 
initialize_weightvector(U = XX, method = "SFA")

## End(Not run)
initialize_weightvector(num.series = ncol(XX), method = "rnorm")

ForeCA documentation built on Aug. 23, 2026, 9:09 a.m.