Skip to content

Commit

Permalink
verify_volatility methods for BSVAR and BSVARSV centered #26
Browse files Browse the repository at this point in the history
  • Loading branch information
donotdespair committed Nov 3, 2023
1 parent ba1c65f commit a8f597c
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions R/verify.R
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ verify_volatility <- function(posterior) {
#' @export
verify_volatility.PosteriorBSVARSV <- function(posterior) {

centred_sv = posterior$last_draw$centred_sv
stopifnot("There is not a known method of verifying heteroskedasticity using SDDR for a centered SV model.", !centred_sv)

# get the inputs to estimation
just_posterior = posterior$posterior
prior = posterior$last_draw$prior$get_prior()
Expand All @@ -131,3 +134,42 @@ verify_volatility.PosteriorBSVARSV <- function(posterior) {
class(sddr) = "SDDR"
return(sddr)
}



#' @inherit verify_volatility
#' @method verify_volatility PosteriorBSVAR
#' @inheritParams verify_volatility
#'
#' @description Displays information that the model is homoskedastic.
#'
#' @return Nothing. Just displays a message: The model is homoskedastic.
#'
#' @examples
#' # simple workflow
#' ############################################################
#' # upload data
#' data(us_fiscal_lsuw)
#'
#' # specify the model and set seed
#' specification = specify_bsvar$new(us_fiscal_lsuw, p = 1)
#' set.seed(123)
#'
#' # run the burn-in
#' posterior = estimate(specification, 5, thin = 1)
#'
#' # verify heteroskedasticity
#' sddr = verify_volatility(posterior)
#'
#' # workflow with the pipe |>
#' ############################################################
#' set.seed(123)
#' us_fiscal_lsuw |>
#' specify_bsvar$new(p = 1) |>
#' estimate(S = 5, thin = 1) |>
#' verify_volatility() -> sddr
#'
#' @export
verify_volatility.PosteriorBSVAR <- function(posterior) {
message("The model is homoskedastic.")
}

0 comments on commit a8f597c

Please sign in to comment.