Skip to content

Commit

Permalink
Merge branch 'feature/r-41' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
ygeunkim committed Dec 23, 2024
2 parents 4cab969 + eaa04d4 commit ecef14b
Show file tree
Hide file tree
Showing 25 changed files with 426 additions and 597 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: bvhar
Type: Package
Title: Bayesian Vector Heterogeneous Autoregressive Modeling
Version: 2.1.2.9014
Version: 2.1.2.9015
Authors@R:
c(person(given = "Young Geun",
family = "Kim",
Expand Down Expand Up @@ -50,6 +50,6 @@ LinkingTo:
RcppThread
VignetteBuilder: knitr
Depends:
R (>= 4.0.0)
R (>= 4.1.0)
Roxygen: list(markdown = TRUE)
Config/testthat/edition: 3
2 changes: 0 additions & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@ S3method(summary,normaliw)
S3method(summary,ssvsmod)
S3method(summary,varlse)
S3method(summary,vharlse)
export("%>%")
export(FPE)
export(HQ)
export(VARtoVMA)
Expand Down Expand Up @@ -320,7 +319,6 @@ importFrom(lifecycle,deprecate_soft)
importFrom(lifecycle,deprecate_warn)
importFrom(lifecycle,deprecated)
importFrom(lifecycle,is_present)
importFrom(magrittr,"%>%")
importFrom(optimParallel,optimParallel)
importFrom(posterior,as_draws_df)
importFrom(posterior,as_draws_matrix)
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# bvhar (development version)

* Requires `R >= 4.1` following [tidyverse R version support schedule](https://www.tidyverse.org/blog/2019/04/r-version-support/)

* Use `spdlog` (using `RcppSpdlog`) logger instead of custom progress bar (`bvharprogress`).

* Use `RcppThread` to make the logger thread-safe ([eddelbuettel/rcppspdlog#22](https://github.com/eddelbuettel/rcppspdlog/issues/22))
Expand Down
66 changes: 33 additions & 33 deletions R/criteria.R
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ logLik.bvharmn <- function(object, ...) {
#' @importFrom stats AIC
#' @export
AIC.varlse <- function(object, ...) {
object %>%
logLik() %>%
object |>
logLik() |>
AIC()
}

Expand All @@ -178,8 +178,8 @@ AIC.varlse <- function(object, ...) {
#' @param ... not used
#' @export
AIC.vharlse <- function(object, ...) {
object %>%
logLik() %>%
object |>
logLik() |>
AIC()
}

Expand All @@ -188,8 +188,8 @@ AIC.vharlse <- function(object, ...) {
#' @param ... not used
#' @export
AIC.bvarmn <- function(object, ...) {
object %>%
logLik() %>%
object |>
logLik() |>
AIC()
}

Expand All @@ -198,8 +198,8 @@ AIC.bvarmn <- function(object, ...) {
#' @param ... not used
#' @export
AIC.bvarflat <- function(object, ...) {
object %>%
logLik() %>%
object |>
logLik() |>
AIC()
}

Expand All @@ -208,8 +208,8 @@ AIC.bvarflat <- function(object, ...) {
#' @param ... not used
#' @export
AIC.bvharmn <- function(object, ...) {
object %>%
logLik() %>%
object |>
logLik() |>
AIC()
}

Expand Down Expand Up @@ -265,40 +265,40 @@ FPE.vharlse <- function(object, ...) {
#' @importFrom stats BIC
#' @export
BIC.varlse <- function(object, ...) {
object %>%
logLik() %>%
object |>
logLik() |>
BIC()
}

#' @rdname vhar_lm
#' @export
BIC.vharlse <- function(object, ...) {
object %>%
logLik() %>%
object |>
logLik() |>
BIC()
}

#' @rdname bvar_minnesota
#' @export
BIC.bvarmn <- function(object, ...) {
object %>%
logLik() %>%
object |>
logLik() |>
BIC()
}

#' @rdname bvar_flat
#' @export
BIC.bvarflat <- function(object, ...) {
object %>%
logLik() %>%
object |>
logLik() |>
BIC()
}

#' @rdname bvhar_minnesota
#' @export
BIC.bvharmn <- function(object, ...) {
object %>%
logLik() %>%
object |>
logLik() |>
BIC()
}

Expand Down Expand Up @@ -351,40 +351,40 @@ HQ.logLik <- function(object, ...) {
#' Quinn, B.G. (1980). *Order Determination for a Multivariate Autoregression*. Journal of the Royal Statistical Society: Series B (Methodological), 42: 182-185.
#' @export
HQ.varlse <- function(object, ...) {
object %>%
logLik() %>%
object |>
logLik() |>
HQ()
}

#' @rdname HQ
#' @export
HQ.vharlse <- function(object, ...) {
object %>%
logLik() %>%
object |>
logLik() |>
HQ()
}

#' @rdname HQ
#' @export
HQ.bvarmn <- function(object, ...) {
object %>%
logLik() %>%
object |>
logLik() |>
HQ()
}

#' @rdname HQ
#' @export
HQ.bvarflat <- function(object, ...) {
object %>%
logLik() %>%
object |>
logLik() |>
HQ()
}

#' @rdname HQ
#' @export
HQ.bvharmn <- function(object, ...) {
object %>%
logLik() %>%
object |>
logLik() |>
AIC()
}

Expand Down Expand Up @@ -427,8 +427,8 @@ compute_dic.bvarmn <- function(object, n_iter = 100L, ...) {
bmat_gen <- rand_gen$coefficients
covmat_gen <- rand_gen$covmat
log_lik <-
object %>%
logLik() %>%
object |>
logLik() |>
as.numeric()
obs <- object$obs
m <- object$m
Expand All @@ -446,7 +446,7 @@ compute_dic.bvarmn <- function(object, n_iter = 100L, ...) {
)
) / 2
}
) %>%
) |>
unlist()
eff_num <- 2 * (log_lik - mean(post_mean))
-2 * log_lik + 2 * eff_num
Expand Down
Loading

0 comments on commit ecef14b

Please sign in to comment.