- add
pspectrum
from psd package as a replacement forsapa::SDF
. Not recommended for use in production yet sincepsd::psectrum
does not preserve spectrum estimates from multivariate spectrum to univariate, i.e., spectrum of linear combination does not equal linear combination (quadratic form) of spectrum.psd::pspectrum
an be used to compute univariate forecastability estimates based on a better (smoothed) estimates of periodogram compared to rawspec.pgram
.
-
remove all dependencies and calls to sapa R package. In particular this means no
"wosa"
,"multitaper"
, or"direct"
spectralmethod
argument anymore. Instead rely on"mvspec"
in the astsa package.This is (unfortunately) necessary since ifultools and all its dependencies were removed from CRAN by 2020-06-09. sapa was the workhorse package for ForeCA.
- make
ForeCA
compatible with R 4.0.0 - improve test coverage and error messages (move away from
expect_true
wherever possible)
- added an introductory R markdown vignette using knitr
quadratic_form
now computes the vector product with the transpose and conjugate of the vector, i.e., the Hermitian of the vector. Also added small speed up usingcrossprod
function.sqrt_matrix
did not work correctly for singular matrices (zero eigenvalue). Fixed issue with numerical precision errors testing for equality to zero. Now throws an error if matrix is not of full rank and the inverse is required.
fill_hermitian()
is now a public function (and added tests)- added
foreca.EM.E_and_M_step
as a wrapper forforeca.EM.E_step
followed byforeca.EM.M_step
. - add a
TRUE/FALSE
"normalized" attribute to objects of class mvspectrum. This speeds up computation and checks significantly sincecheck_mvspectrum_normalized
only needs to check the attribute, rather than computing the sum and comparing it to identity matrix. - removed
"lag window"
option formvspectrum
since it does not work well withnormalize_mvspectrum
. - added a
plot.mvspectrum
S3 method
normalize_mvspectrum()
normalizes by left and right multiplication of inverse square root of frequency total aggregate estimate. This fixes the issue with different results of normalization based on multivariate vs. univariate spectra estimation.- removed a
print()
statement when runningforeca()
(displayedOmega
scores of the final ForeCs) sqrt_matrix
threw an error if input matrix had complex-valued eigen-values (since it checked for negative values). Fixed now.- specify
nrow
indiag()
ifn.comp=1
inforeca.multiple_weightvectors
(otherwise it generated non-comformable arrays error).
- fixed real/imaginary problem with the eigenvalues of Hermitian matrices
in
test_mvspectrum()
- change tolerance level in EM convergence to
1e-6
(seecomplete_algorithm_control()
)
A bug-fix release and more modular, less repetitive coding under the hood; results in improved performance of the main algorithms.
Main notable change for users: to specify spectrum and entropy estimation use
spectrum.control
and entropy.control
. Otherwise no relevant visible
user-interface changes.
Also review the manual; it has been very thoroughly reviewed.
- a couple of new functions for more modular code and easier testing:
sqrt_matrix
complete_entropy_control
complete_spectrum_control
complete_algorithm_control
check_whitened
check_mvspectrum_normalized
weightvector2entropy_wcov
mvpgram
- a
print.foreca
S3 method Omega
and severalforeca.*
functions changed arguments:spectrum.conrol = list(...)
is the new way to specifyspectrum.method
,smoothing
.entropy.control = list(...)
is the new way to specifyentropy.method
,threshold
,prior.weight
.
- made
"mvfft"
default for spectrum estimation, usingmvfft
in R. This avoids the requirement to have sapa or astsa installed. - general
foreca.one_weightvector
andforeca.multiple_weightvectors
wrappers for more modular and less repititve coding. - By default entropy is smoothed by a mixture with a uniform prior
distribution with
prior.weight = 1e-03
in order to avoidlog(0)
throughout the computations. If you don't want this, you have to explicitly specifyprior.weight = 0
in theentropy.control
argument. - formally added tests using the testthat package
- added list of all available
spectrum.method
s for estimation of the spectrum/spectral density in thecomplete_spectrum_control
help page. - all
foreca.*()
functions only accept whitened time seriesU
, notseries
. Onlyforeca()
directly accepts the original (unwhitened)series
. UseU <- whiten(series)$U
to obtain the whitened series.
foreca.EM
: useforeca(..., algorithm.type = "EM")
directly.- dependency on R packages:
- R.utils:
R.utils::wrap
got replaced bybase::aperm
. - sapa and astsa: in its basic form the ForeCA package now runs
in base R! However, it is still highly recommended to use either the
sapa or astsa package (users can use their algorihms via the
method
argument in several functions.)
- R.utils:
spectral_entropy
now only works with a spectral density inputf.U
; not withseries
orspectrum.estimate
.
whiten()
(thanks to Bjoern Weghenkel for pointing this out):- forgot to center U; if data was centered to start with, then this didn't affect results.
- fixed dewhitening and whitening matrices
initialize_weightvector
used the minimum Omega vector, not maximum, formethod = "max"
.
- thourough revision of documentation:
- better explanations
- fixed typos or code / documentation mismatch
- more concise (hopefully)
mvspectrum
: the smooth univariate spectrum estimate (smoothing = TRUE
) uses an exponential distribution with a logarithmic link function in themgcv::gam
function.discrete_entropy
:- The uniform distribution is now added using a mixture type model, rather
than an absolute addition to original distribution and then renormalizing.
Thus the
prior.weight
is now between 0 and 1, not just greater than 0. can be done just with theprior.weight
argument. - Only
''MLE''
is a validmethod
now. If you want to use''smoothed''
, then this
- The uniform distribution is now added using a mixture type model, rather
than an absolute addition to original distribution and then renormalizing.
Thus the
- lower and upper limit arguments for
continuous_entropy
changed froma
andb
tolower
andupper
. eigen()
calls gotsymmetric = TRUE
. About 3x faster.- The random methods in
initialize_weightvector
have ther
prefix, i.e.,"rnorm"
instead of"norm"
. Same for"cauchy"
and"unif"
. foreca.EM.opt_weightvector
changed toforeca.EM.one_weightvector
.- the trace plots of the weights are always smooth curves (and don't jump betweeen +/- 1 times the weightvector).
- changed underscore (
_
) in argument names to dot (.
). E.g.,max_iter
tomax.iter
- cleaned up code for better readability
- changed
=
to<-
assignment operator (big thanks totidy.source()
) - removed unnecessary code (thanks
checkUsage()
)
- changed
- cleaned up
NEWS
file and edited to conform to proper markdown format - changed
method
argument inforeca()
toalgorithm.type
- moved function to initialize a weightvector from the
EM
class, to its own function (initialize_weightvector()
) - replaced AR spectrum estimation to
"burg"
inspec.ar()
- moved
tol
,nstart
, andmax.iter
inforeCA.EM()
into acontrol
list (wherenstart
becamenum.starts
) - improved display of
plot.foreca.EM.opt_weightvector
- fix bug in
mvspectrum2wcov()
- fix bug in
mvspectrum()
(setdetrend = FALSE
andfast = FALSE
inastsa::mvspec
) - make all spectral estimate functions return the same number of frequencies
(
T/2
+/- 1 depending on even/odd sample size) - fix bug in
fill_symmetric()
(double counting diagonal; only affectedSDF
type estimation)
- changed capitalized ForeCA names to lowercase (except for abbreviations such
as
EM
orMLE
). E.g.,ForeCA.EM
toforeca.EM
; - changed
foreca.one_weightvector()
toforeca.EM.opt_weightvector()
- added many additional functions in the package, including the main algorithm
ForeCA.EM
- changed to Roxygen2 documentation
- base functions to estimate (spectral) entropies and Omega for (multivariate) time series
- first draft of documentation
- simple examples in help files
First version 0.0.1 written by Georg M. Goerg on May 14, 2012.
- check what is the best way to store the 3D array spectrum
- frequency last or first?
data.table
package?
- include more spectrum estimators
- include a continuous estimator of spectral entropy; can be used, e.g., to compute entropy for a fitted AR spectrum
- compressed sensing type of sparsity in the spectrum; currently only by a heuristic thresholding rule
- nice plotting for 3D spectra?