Skip to content

Commit

Permalink
Manual specification of offset constant for stochvol
Browse files Browse the repository at this point in the history
  • Loading branch information
franzmohr committed Dec 11, 2023
1 parent ff90fa2 commit a18ef3a
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 30 deletions.
18 changes: 9 additions & 9 deletions R/RcppExports.R
Original file line number Diff line number Diff line change
Expand Up @@ -623,11 +623,11 @@ post_normal_sur <- function(y, z, sigma_i, a_prior, v_i_prior, svd = FALSE) {
#' y <- us_macrodata[, "r"]
#'
#' # Initialise log-volatilites
#' h_init <- log(var(y))
#' h <- rep(h_init, length(y))
#' h_init <- matrix(log(var(y)))
#' h <- matrix(rep(h_init, length(y)))
#'
#' # Obtain draw
#' stoch_vol(y - mean(y), h, .05, h_init, 0.0001)
#' stoch_vol(y - mean(y), h, matrix(.05), h_init, matrix(0.0001))
#'
#' @references
#'
Expand Down Expand Up @@ -681,11 +681,11 @@ stoch_vol <- function(y, h, sigma, h_init, constant) {
#' y <- us_macrodata[, "r"]
#'
#' # Initialise log-volatilites
#' h_init <- log(var(y))
#' h <- rep(h_init, length(y))
#' h_init <- matrix(log(var(y)))
#' h <- matrix(rep(h_init, length(y)))
#'
#' # Obtain draw
#' stochvol_ksc1998(y - mean(y), h, .05, h_init, 0.0001)
#' stochvol_ksc1998(y - mean(y), h, matrix(.05), h_init, matrix(0.0001))
#'
#' @references
#'
Expand Down Expand Up @@ -732,11 +732,11 @@ stochvol_ksc1998 <- function(y, h, sigma, h_init, constant) {
#' y <- us_macrodata[, "r"]
#'
#' # Initialise log-volatilites
#' h_init <- log(var(y))
#' h <- rep(h_init, length(y))
#' h_init <- matrix(log(var(y)))
#' h <- matrix(rep(h_init, length(y)))
#'
#' # Obtain draw
#' stochvol_ocsn2007(y - mean(y), h, .05, h_init, 0.0001)
#' stochvol_ocsn2007(y - mean(y), matrix(h), matrix(.05), h_init, matrix(0.0001))
#'
#' @references
#'
Expand Down
6 changes: 3 additions & 3 deletions man/stoch_vol.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions man/stochvol_ksc1998.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions man/stochvol_ocsn2007.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/stoch_vol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
//' y <- us_macrodata[, "r"]
//'
//' # Initialise log-volatilites
//' h_init <- log(var(y))
//' h <- rep(h_init, length(y))
//' h_init <- matrix(log(var(y)))
//' h <- matrix(rep(h_init, length(y)))
//'
//' # Obtain draw
//' stoch_vol(y - mean(y), h, .05, h_init, 0.0001)
//' stoch_vol(y - mean(y), h, matrix(.05), h_init, matrix(0.0001))
//'
//' @references
//'
Expand Down
6 changes: 3 additions & 3 deletions src/stochvol_ksc1998.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@
//' y <- us_macrodata[, "r"]
//'
//' # Initialise log-volatilites
//' h_init <- log(var(y))
//' h <- rep(h_init, length(y))
//' h_init <- matrix(log(var(y)))
//' h <- matrix(rep(h_init, length(y)))
//'
//' # Obtain draw
//' stochvol_ksc1998(y - mean(y), h, .05, h_init, 0.0001)
//' stochvol_ksc1998(y - mean(y), h, matrix(.05), h_init, matrix(0.0001))
//'
//' @references
//'
Expand Down
12 changes: 6 additions & 6 deletions src/stochvol_ocsn2007.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@
//' y <- us_macrodata[, "r"]
//'
//' # Initialise log-volatilites
//' h_init <- log(var(y))
//' h <- rep(h_init, length(y))
//' h_init <- matrix(log(var(y)))
//' h <- matrix(rep(h_init, length(y)))
//'
//' # Obtain draw
//' stochvol_ocsn2007(y - mean(y), h, .05, h_init, 0.0001)
//' stochvol_ocsn2007(y - mean(y), matrix(h), matrix(.05), h_init, matrix(0.0001))
//'
//' @references
//'
Expand Down Expand Up @@ -98,8 +98,8 @@ arma::mat stochvol_ocsn2007(arma::vec y, arma::vec h, double sigma, double h_ini
data("us_macrodata")
aud <- us_macrodata[, 1]
h_init <- log(var(aud))
h <- rep(h_init, length(aud))
stochvol_ocsn2007(aud - mean(aud), h, .05, h_init, 0.0001)
h_init <- matrix(log(var(aud)))
h <- matrix(rep(h_init, length(aud)))
stochvol_ocsn2007(aud - mean(aud), h, matrix(.05), h_init, matrix(0.0001))
***/

0 comments on commit a18ef3a

Please sign in to comment.