Skip to content

Commit

Permalink
Automatically add constant for sv, if not specified.
Browse files Browse the repository at this point in the history
  • Loading branch information
franzmohr committed Dec 16, 2023
1 parent 1666b7f commit 838642a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions R/add_priors.bvarmodel.R
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,11 @@ add_priors.bvarmodel <- function(object,
if (object[[i]][["model"]][["sv"]]) {
object[[i]][["initial"]][["sigma"]][["h"]] <- log(matrix(u, nrow = NCOL(y), ncol = NROW(y), byrow = TRUE))
object[[i]][["initial"]][["sigma"]][["sigma_h"]] <- matrix(sigma[["sigma_h"]], NROW(y))

if (is.null(sigma[["constant"]])) {
warning("Argument 'sigma$constant' not specified. Using the value 0.0001.")
sigma[["constant"]] <- .0001
}
object[[i]][["initial"]][["sigma"]][["constant"]] <- matrix(sigma[["constant"]], NROW(y))
} else {
object[[i]][["initial"]][["sigma"]][["sigma_i"]] <- diag(1 / u, NROW(y))
Expand Down
5 changes: 5 additions & 0 deletions R/add_priors.bvecmodel.R
Original file line number Diff line number Diff line change
Expand Up @@ -706,6 +706,11 @@ add_priors.bvecmodel <- function(object,
if (object[[i]][["model"]][["sv"]]) {
object[[i]][["initial"]][["sigma"]][["h"]] <- log(matrix(u, nrow = NCOL(y), ncol = NROW(y), byrow = TRUE))
object[[i]][["initial"]][["sigma"]][["sigma_h"]] <- matrix(sigma[["sigma_h"]], NROW(y))

if (is.null(sigma[["constant"]])) {
warning("Argument 'sigma$constant' not specified. Using the value 0.0001.")
sigma[["constant"]] <- .0001
}
object[[i]][["initial"]][["sigma"]][["constant"]] <- matrix(sigma[["constant"]], NROW(y))
} else {
object[[i]][["initial"]][["sigma"]][["sigma_i"]] <- diag(1 / u, NROW(y))
Expand Down

0 comments on commit 838642a

Please sign in to comment.