Skip to content

Commit

Permalink
version 1.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
reiemrednaxela authored and cran-robot committed Apr 4, 2022
1 parent 31cb660 commit 7f1e445
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 10 deletions.
10 changes: 5 additions & 5 deletions DESCRIPTION
@@ -1,8 +1,8 @@
Package: beyondWhittle
Type: Package
Title: Bayesian Spectral Inference for Stationary Time Series
Version: 1.1.2
Date: 2022-01-25
Version: 1.1.3
Date: 2022-04-03
Authors@R: c(
person("Alexander", "Meier", email="meier.alexander@posteo.de", role=c("aut", "cre")),
person("Claudia", "Kirch", email="claudia.kirch@ovgu.de", role="aut"),
Expand All @@ -11,16 +11,16 @@ Authors@R: c(
Maintainer: Alexander Meier <meier.alexander@posteo.de>
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) <doi:10.1214/18-BA1126> and A. Meier (2018) <https://opendata.uni-halle.de//handle/1981185920/13470>. It was supported by DFG grant KI 1443/3-1.
License: GPL (>= 3)
Imports: ltsa (>= 1.4.6), Rcpp (>= 0.12.5), MASS, MTS, forecast
Imports: ltsa (>= 1.4.6), Rcpp (>= 0.12.5), MASS, forecast
LinkingTo: Rcpp, RcppArmadillo, BH
RoxygenNote: 6.1.1
NeedsCompilation: yes
Packaged: 2022-01-25 13:43:37 UTC; alexandermeier
Packaged: 2022-04-03 13:05:14 UTC; alexandermeier
Author: Alexander Meier [aut, cre],
Claudia Kirch [aut],
Matthew C. Edwards [aut],
Renate Meyer [aut]
Repository: CRAN
Date/Publication: 2022-01-25 16:32:51 UTC
Date/Publication: 2022-04-04 11:00:02 UTC
Suggests: testthat (>= 3.0.0)
Config/testthat/edition: 3
6 changes: 3 additions & 3 deletions MD5
@@ -1,4 +1,4 @@
5e149a8285f402dbfeebb36ec209862d *DESCRIPTION
77f04223305a3db671e1f3246d28cd23 *DESCRIPTION
4367c6c56410d70835e641572f7f7178 *NAMESPACE
9d7dc024418c915c080ac1481def2477 *R/RcppExports.R
7008ac8998902ce9e6df733dba304119 *R/arma.R
Expand All @@ -20,7 +20,7 @@ a2b1be0525d69a5ce71624a21a353273 *R/nuisance_models.R
ce45c4c9a9671675370f8f1bf5ce2285 *R/psd_S3.R
48a9f68746ee7909b41c161d37c160a7 *R/scree_type.R
820ec489157d97c50228c6b29f838276 *R/unit_trace.R
8bbc1b9a8f5f236af70851d14482b3a1 *R/varma.R
9af842ca3ffec09e6053ccc9dda10677 *R/varma.R
c56752d4f29aa72d695e937082eeddd3 *man/Adj.Rd
d09d32ee94741aa75fcac2f9d0a5c7e9 *man/VARMAcov_muted.Rd
a9c9d190a6412288641d9d8ae6481f06 *man/VAR_regressor_matrix.Rd
Expand Down Expand Up @@ -132,7 +132,7 @@ baaefd0f768f381ea8ab44e8a14ec3e6 *src/RcppExports.cpp
5eb4042c51d797813c807dbe849a6f10 *src/a_gamma_process_prior.h
ae4e5afbfdf587dd190810bb710f478d *src/arma.cpp
bd18897eca1244a9b41a86f9b686d8b9 *src/arma.h
6da8364b561c0076ff71bdbf7705114d *src/bernstein_gamma_psd.cpp
a1787e63c54cd11aa529698acdf292e4 *src/bernstein_gamma_psd.cpp
b452551dc74633b233d0f450ce4e1330 *src/bernstein_gamma_psd.h
9145eba40194c71297692c2e10cda167 *src/beyondWhittle_types.h
b3ec39d3a79eedea0f5c625e3fe20efe *src/gibbs_np_help.cpp
Expand Down
63 changes: 62 additions & 1 deletion R/varma.R
Expand Up @@ -202,6 +202,67 @@ llike_var_full <- function(zt, ar, sigma) {
return(cll + mll)
}

#' 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.
#' @keywords internal
PSIwgt <- function(Phi=NULL,Theta=NULL,lag=12,plot=TRUE,output=FALSE){
### Compute the psi-weight matrices of a VARMA(p,q) model,
#### Phi=[phi1, phi2, ..., phip]
#### Theta=[theta1,theta2,...,thetaq]
#### Sigma= residual covariance matrix
q=0; p=0; k=0
if(length(Theta) > 0){
k=dim(Theta)[1]
k1=dim(Theta)[2]
q=floor(k1/k)
}
#
if(length(Phi) > 0){
k=dim(Phi)[1]
k1=dim(Phi)[2]
p=floor(k1/k)
}
#
if(k < 1) k=1
PSI=diag(k); WGT=c(PSI)
#
for (il in 1:lag){
ilk=il*k
tmp=matrix(0,k,k)
if((q > 0) && (il <= q))tmp=-Theta[,(ilk-k+1):ilk]
if(p > 0){
iend=min(il,p)
for (j in 1:iend){
jdx=(il-j)
kdx=j*k
tmp=tmp+Phi[,(kdx-k+1):kdx]%*%PSI[,(jdx*k+1):(jdx*k+k)]
}
## end of p > 0.
}
PSI=cbind(PSI,tmp)
WGT=cbind(WGT,c(tmp))
### end of il-loop
}
## print the output if needed
if(output){
for (i in 1:lag){
cat("Lag: ",i," psi-matrix","\n")
ist=i*k
print(round(PSI[,(ist+1):(ist+k)],5))
}
## end print
}
## plots the psi-weights
if(plot){
# Note: plotting functionality has been removed
# for compatibility reasons.
}
PSIwgt <- list(psi.weight=PSI,irf=WGT)
}

#' 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
Expand All @@ -210,7 +271,7 @@ llike_var_full <- function(zt, ar, sigma) {
#' @keywords internal
VARMAcov_muted <- function (Phi = NULL, Theta = NULL,
Sigma = NULL, lag = 12, trun = 120) {
m1 = MTS::PSIwgt(Phi = Phi, Theta = Theta, lag = trun, plot = FALSE)
m1 = PSIwgt(Phi = Phi, Theta = Theta, lag = trun, plot = FALSE)
Psi = m1$psi.weight
nc = dim(Psi)[2]
k = dim(Psi)[1]
Expand Down
2 changes: 1 addition & 1 deletion src/bernstein_gamma_psd.cpp
Expand Up @@ -84,7 +84,7 @@ void bernsteinGammaPsd::update_f() {
// Which k-segment does x in [0,1] belong to?
int bernsteinGammaPsd::get_j(double x) const {
const int res = std::ceil((double)k * x)-1;
assert (res >= 0);
// assert (res >= 0);
return res;
}

Expand Down

0 comments on commit 7f1e445

Please sign in to comment.