Description Usage Arguments Details Value See Also Examples
View source: R/mvspectrum2wcov.R
mvspectrum2wcov
computes a (weighted) covariance matrix estimate
from the frequency spectrum (see Details).
weightvector2entropy_wcov
computes the weighted covariance
matrix using the negative entropy of the univariate spectrum (given the
weightvector) as kernel weights. This matrix is the objective matrix
for many foreca.*
algorithms.
1 2 3 4  mvspectrum2wcov(mvspectrum.output, kernel.weights = 1)
weightvector2entropy_wcov(weightvector = NULL, f.U, f.current = NULL,
entropy.control = list())

mvspectrum.output 
an object of class 
kernel.weights 
numeric; weights for each frequency. By default uses
weights that average out to 
weightvector 
numeric; weights \mathbf{w} for y_t = \mathbf{U}_t \mathbf{w}. Must have unit norm in \ell^2. 
f.U 
multivariate spectrum of class 
f.current 
numeric; spectral density estimate of
y_t=\mathbf{U}_t \mathbf{w} for the current estimate
\widehat{\mathbf{w}}_i (required for

entropy.control 
list; control settings for entropy estimation.
See 
The covariance matrix of a multivariate time series satisfies the identity
Σ_{X} \equiv \int_{π}^{π} S_{X}(λ) d λ.
A generalized covariance matrix estimate can thus be obtained using a weighted average
\tilde{Σ}_X = \int_{π}^{π} K(λ) S_{X}(λ) d λ,
where K(λ) is a kernel symmetric around 0 which averages out to 1 over the interval [π, π], i.e., \frac{1}{2 π} \int_{π}^{π} K(λ) d λ = 1. This allows one to remove or amplify specific frequencies in the covariance matrix estimation.
For ForeCA mvspectrum2wcov
is especially important as we use
K(λ) = \log f_y(λ),
as the weights (their average is not 1!). This particular kernel
weight is implemented as a wrapper in weightvector2entropy_wcov
.
A symmetric n \times n matrix.
If kernel.weights
≥q 0, then it is positive semidefinite;
otherwise, it is symmetric but not necessarily positive semidefinite.
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  nn < 50
YY < cbind(rnorm(nn), arima.sim(n = nn, list(ar = 0.9)), rnorm(nn))
XX < YY %*% matrix(rnorm(9), ncol = 3) # random mix
XX < scale(XX, scale = FALSE, center = TRUE)
# sample estimate of covariance matrix
Sigma.hat < cov(XX)
dimnames(Sigma.hat) < NULL
# using the frequency spectrum
SS < mvspectrum(XX, "wosa")
Sigma.hat.freq < mvspectrum2wcov(SS)
layout(matrix(1:4, ncol = 2))
par(mar = c(2, 2, 1, 1))
plot(c(Sigma.hat/Sigma.hat.freq))
abline(h = 1)
image(Sigma.hat)
image(Sigma.hat.freq)
image(Sigma.hat / Sigma.hat.freq)
# examples for entropy wcov
XX < diff(log(EuStockMarkets)) * 100
UU < whiten(XX)$U
ff < mvspectrum(UU, 'wosa', normalize = TRUE)
ww0 < initialize_weightvector(num.series = ncol(XX), method = 'rnorm')
weightvector2entropy_wcov(ww0, ff,
entropy.control =
list(prior.weight = 0.1))

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.