Learn R Programming

beyondWhittle (version 1.3.0)

Bayesian Spectral Inference for Time Series

Description

Implementations of Bayesian parametric, nonparametric and semiparametric procedures for univariate and multivariate time series. The package is based on the methods presented in C. Kirch et al (2018) , A. Meier (2018) and Y. Tang et al (2023) . It was supported by DFG grants KI 1443/3-1 and KI 1443/3-2.

Copy Link

Version

Install

install.packages('beyondWhittle')

Monthly Downloads

502

Version

1.3.0

License

GPL (>= 3)

Maintainer

Renate Meyer

Last Published

November 25th, 2024

Functions in beyondWhittle (1.3.0)

bayes_factor

a generic method for bdp_dw_result class
bdp_dw_mcmc

MH sampler for BDP-DW method
bdp_dw_mcmc_params_gen

Generate a list of values for MCMC algorithm
bdp_dw_bayes_factor_k1

Estimating the Bayes factor of hypothesis "k1 = 1".
acvBlockMatrix

Build an nd times nd Block Toeplitz matrix from the (d times d) autocovariances gamma(0),...,gamma(n-1)
beyondWhittle-package

Bayesian spectral inference for time series
arma_conditional

Negative ARMA(p, q) log likelihood
betaBasis_k_dw

Construct Bernstein polynomial basis of degree k on omega
dbList

Construct Bernstein polynomial basises of degree up to kmax on omega
center

mean center a numerical vector
dbList_dw_Bern

Construct Bernstein polynomial bases of degree up to kmax on omega
coarsened_bernstein_i

Helping function for coarsened_bernstein
gibbs_bdp_dw

BDP-DW method: performing posterior sampling and calculating statistics based on the posterior samples
gibbs_ar

Gibbs sampler for an autoregressive model with PACF parametrization.
bdp_dw_est_post_stats

Calculating the estimated posterior mean, median and credible region (tv-PSD)
complexValuedPsd

Inverse function to realValuedPsd
dbList_dw_Bern_for_lambda

Construct Bernstein polynomial bases of degree up to kmax on omega for frequency parameter lambda
fourier_freq

Fourier frequencies
epsilon_var

epsilon process (residuals) of VAR model
genEpsARMAC

Get epsilon process (i.e. model residuals) for ARMA(p,q)
VARMAcov_muted

This is a nearly exact copy of the MTS::VARMAcov function, where the output commands at the end are removed. This has to be done because the function is called repeatedly within the MCMC algorithm. For future versions of the package, a better solution is intended.
fast_ft

Fast Fourier Transform
VAR_regressor_matrix

VAR regressor matrix, see Section 2.2.3 in Koop and Korobilis (2010)
bdp_dw_prior_params_gen

Generate a list of parameter values in prior elicitation
gibbs_npc

Gibbs sampler for Bayesian semiparametric inference with the corrected AR likelihood
cube_from_NumericVector

I/O: Only used within Rcpp Note: Same workaround as cx_cube_from_ComplexVector
get_f_matrix

Construct psd mixture
is_hpd

Check if a matrix is Hermitian positive definite
cx_cube_from_ComplexVector

I/O: Only used within Rcpp
betaBasis_k

Construct Bernstein polynomial basis of degree k on omega
get_U_cpp

Get U from phi, vectorized, cpp internal only
gibbs_vnp

Gibbs sampler for multivaiate Bayesian nonparametric inference with Whittle likelihood
gibbs_np

Gibbs sampler for Bayesian nonparametric inference with Whittle likelihood
densityMixture

Construct a density mixture from mixture weights and density functions.
llike_AR

Time domain AR(p) likelihood for nuisance/noise time series
coarsened_bernstein

Construct coarsened Bernstein polynomial basis of degree l on omega
gibbs_VAR_nuisance_intern

Gibbs sampling algorithm for VAR model
gibbs_AR_nuisance_intern

Gibbs sampler for Bayesian AR model in PACF parametrization, including support for TS to be a nuisance parameter
gibbs_multivariate_nuisance

Gibbs sampler for corrected parametric likelihood + Bernstein-Dirichlet mixture, including possibility of using time series as mere nuisance parameter Multivariate case
is_quadratic

Is l quadratic?
llike

Log corrected parametric AR likelihood (Gaussian)
gibbs_multivariate_nuisance_cpp

Gibbs sampler in Cpp
local_moving_FT_zigzag

Calculate the moving Fourier transform ordinates
fast_ift

Fast Inverse Fourier Transform
hasEigenValueSmallerZero

Does a matrix have an eigenvalue smaller than 0?
missingValues_str_help

Get string representation for missing values position from vector index
print.gibbs_psd

Print method for gibbs_psd class
print.bdp_dw_result

Print method for bdp_dw_result class
pFromV

Get p from v in Stick Breaking DP representation
pacf2AR

C++ function for computing AR coefficients from PACF. See Section III in Barndorff-Nielsen and Schou (1973)
psd_tvarma12

time-varying spectral density function of the tvARMA(1,2) processes for illustrations
plot.bdp_dw_result

Plot method for bdp_dw_result class
pacf_to_ar

Convert partial autocorrelation coefficients to AR coefficients.
mixtureWeight

Get mixture weights of Bernstein-Dirchlet-Mixtures
summary.bdp_dw_result

Summary method for bdp_dw_result class
fast_mean

Help function to compute the mean.
is_spd

Check if a matrix is symmetric positive definite
logDet_stickBreaking

Log determinant of stick breaking transformation V -> p
nll_norm

Negative log likelihood of iid standard normal observations [unit variance] Note: deprecated
omegaFreq

Fourier frequencies rescaled on the unit interval
lpost

Log posterior = log prior + log corrected parametric likelihood
print_summary_gibbs_psd_help

Helping function for print and summary (both are quite similar)
llike_var_full

VAR(p) full likelihood
lprior_AR

Log prior for PACF (~Beta) and sigma2 (~InverseGamma), unnormalized
psd_varma_help

helping function for psd_varma
lprior_dw

Calculation of log prior
print_mcmc_state

Help function to print MCMC state
logfuller

Fuller Logarithm
plot.bdp_dw_tv_psd

Plot method for bdp_dw_tv_psd class
gibbs_var

Gibbs sampler for vector autoregressive model.
gibbs_nuisance

Gibbs sampler for corrected parametric likelihood + Bernstein-Dirichlet mixture, including possibility of using time series as mere nuisance parameter
qpsd

Compute normalized PSD in the Bernstein-Dirichlet parametrization.
psd_varma

VARMA(p,q) spectral density function
llike_var_partial

VAR(p) partial likelihood (unnormalized) Note: Fine for fixed p, but not suited for model comparison
transfer_polynomial

VARMA transfer polynomials
uci_help

Helping function for uci_matrix
psd_array

Convert psd vector to array (compatibility: to use plotMPsd for univariate functions as well)
lik_ar

Likelihood of an autoregressive time series model with i.i.d. normal innovations
psd_dummy_model

Time series model X_t=e_t, E[e_t]=0
mpdgrm

Compute Periodgram matrix from (complex-valued) Fourier coefficients
midft

Multivariate inverse discrete (fast) Fourier Transform
mdft

Multivariate discrete (fast) Fourier Transform
uci_matrix

Uniform credible intervals in matrix-valued case
uniformmax

Uniform maximum, as needed for uniform credible intervals
unit_trace_mu

Get mu vector, see (36) in Mittelbach et al. Helping function for unit_trace_runif
unit_trace_x_from_phi

Get x from phi, see (62) in Mittelbach et al.
unit_trace_nu

Get log(nu) vector, see (38) in Mittelbach et al. Helping function for unit_trace_runif
unit_trace_sigma2

Get sigma2 vector, see (70) in Mittelbach et al. Helping function for unit_trace_runif
plot.gibbs_psd

Plot method for gibbs_psd class
psd_arma

ARMA(p,q) spectral density function
my_rdirichlet

Generate a random samples from a Dirichlet distribution
phiFromBeta_normalInverseWishart

Convert vector parametrization (beta) to matrix-parametrization (phi), the latter as e.g. used in MTS::VAR()$ar
print_warn

Help function to print debugging messages
plotMPsd

Visualization of multivariate PSDs Used in plot.gibbs_psd
realValuedPsd

Store imaginary parts above and real parts below the diagonal
summary.gibbs_psd

Summary method for gibbs_psd class
vFromP

Get v from p (DP inverse stick breaking) Note: p is assumed to have length L, i.e. it does NOT contain p_0
unit_trace_q

Get q vector, see (68) in Mittelbach et al.
llike_dw

Calculating log likelihood
unrollPsd

Redundantly roll out a PSD from length N=floor(n/2) to length n
scree_type_ar

Negative log AR likelihood values for scree-type plots
sim_tvarma12

simulate from the tvARMA(1,2) process for illustration
rmvnorm

Simulate from a Multivariate Normal Distribution
sim_varma

Simulate from a VARMA model
sldmvnorm

sum of multivariate normal log densities with mean 0 and covariance Sigma, unnormalized
lpost_AR

Log Posterior = Log Prior + (conditional) Log Likelihood
unit_trace_I_l

Range intervals I_l, see (63) in Mittelbach et al.
unit_trace_p

Get p vector, see (67) in Mittelbach et al.
llike_var

VAR(p) likelihood
lprior

Log prior of Bernstein-Dirichlet mixture and parametric working model -- all unnormalized
unit_trace_L_from_x

Get L (lower triangular Cholesky) from x Called U^* in Mittelbach et al, see (60) there
unit_trace_log_d

Get log(d) vector, see (39) in Mittelbach et al, adjusted to complex case Helping function for unit_trace_runif
varma_transfer2psd

Get VARMA PSD from transfer polynomials Helping function for psd_varma
unit_trace_log_f_l

Get log(f_l), see (66) in Mittelbach et al. Helping function for unit_trace_runif
qpsd_dw.tilde_zigzag_cpp_expedited

Evaluation of normalized time-varying spectral density function (for MCMC algorithm)
qpsd_dw

Evaluation of normalized time-varying spectral density function (based on posterior samples)
uniformmax_help

Helping function for uci_matrix
uniformmax_multi

Helping function for uci_matrix
unit_trace_runif_single

Obtain one uniform draw from d times d Hpd matrices with unit trace See Algorithm 2 in Mittelbach et al. (adjusted to complex case)
unit_trace_log_c

Get log(c) vector, see (70) in Mittelbach et al. Helping function for unit_trace_runif
unit_trace_U_from_phi

Get U (Hpd with unit trace) matrix from phi (hyperspherical coordinates) vector.
unit_trace_runif

Draw uniformly from Hpd matrices with unit trace
Adj

adjoint of complex matrix
PSIwgt

Psi-weight calculation for a VARMA model. NOTE: This is an exact copy of the MTS::PSIwgt function (only with the plot functionality removed, as not needed). This has to be done because the MTS package has been removed from CRAN in April 2022.
bayes_factor.bdp_dw_result

Extracting the Bayes factor of k1=1 from bdp_dw_result class
acvMatrix

Build an n times n Toeplitz matrix from the autocovariance values gamma(0),...,gamma(n-1)
acceptanceRate

Computing acceptance rate based on trace Note: Only use for traces from continous distributions!