Skip to content

Commit

Permalink
Hide redundant docs, tiny v fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikolas Kuschnig committed Apr 25, 2019
1 parent b5745fa commit 93cde79
Show file tree
Hide file tree
Showing 44 changed files with 66 additions and 609 deletions.
6 changes: 3 additions & 3 deletions R/10_bvar.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#' iterations. The number of saved iterations will be calculated as
#' \code{(n_draw - n_burn) / n_thin}.
#' @param priors \code{bv_priors} object. See \code{\link{bv_priors}}.
#' @param mh \code{bv_metropolis} object. See \code{\link{bv_metropolis}}.
#' @param mh \code{bv_metropolis} object. See \code{\link{bv_mh}}.
#' @param fcast \code{bv_fcast} object. See \code{\link{bv_fcast}}.
#' @param irf \code{bv_irf} object. See \code{\link{bv_irf}}.
#' @param verbose Logical scalar. Whether to print intermediate results and
Expand Down Expand Up @@ -52,7 +52,7 @@
#' @importFrom stats optim runif
#'
#' @examples
#' # Get data com \code{\link{fred_qd}} dataset and transform it
#' # Access the fred_qd dataset and transform it
#' data("fred_qd")
#' data <- fred_qd[, c("CPIAUCSL", "UNRATE", "FEDFUNDS")]
#' data[5:nrow(data), 1] <- diff(log(data[, 1]), lag = 4) * 100
Expand Down Expand Up @@ -324,7 +324,7 @@ bvar <- function(

if(verbose) {
close(pb)
cat("Finished after ", format(timer), ".", sep = "")
cat("Finished after ", format(timer), ".\n", sep = "")
}


Expand Down
6 changes: 6 additions & 0 deletions R/11_input.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#' @param msg String fed to \code{\link[base]{stop}} if an error occurs.
#'
#' @return Returns fun(x).
#'
#' @noRd
num_check <- function(
x, min = 0, max = Inf,
msg = "Please check the integer parameters.",
Expand Down Expand Up @@ -41,6 +43,8 @@ int_check <- function(
#' @importFrom stats arima
#'
#' @return Returns a list with the modes, minimum, and maximum values for psi.
#'
#' @noRd
auto_psi <- function(x, lags) {

out <- list()
Expand Down Expand Up @@ -69,6 +73,8 @@ auto_psi <- function(x, lags) {
#'
#' @examples
#' bvar:::quantile_check(c(0.1, 0.16))
#'
#' @noRd
quantile_check <- function(conf_bands) {

if(any(!is.numeric(conf_bands), conf_bands > 1, conf_bands < 0)) {
Expand Down
10 changes: 10 additions & 0 deletions R/12_aux.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#'
#' @return Returns an \eqn{N * (M * lags)} matrix with consecutive lags at the
#' right.
#'
#' @noRd
lag_var <- function(x, lags) {

x_rows <- nrow(x)
Expand All @@ -32,6 +34,8 @@ lag_var <- function(x, lags) {
#' @param sd Numeric scalar.
#'
#' @return Returns a list with shape \emph{k} and scale paramter \emph{theta}.
#'
#' @noRd
gamma_coef <- function(mode, sd) {

mode_sq <- mode ^ 2
Expand All @@ -56,6 +60,8 @@ gamma_coef <- function(mode, sd) {
#' @examples
#' bvar:::name_pars(c("lambda", "alpha"))
#' bvar:::name_pars(c("lambda", "psi"), M = 3)
#'
#' @noRd
name_pars <- function(x, M) {

out <- Reduce(c, sapply(x, function(y) {if(y == "psi") {
Expand All @@ -78,6 +84,8 @@ name_pars <- function(x, M) {
#'
#' @examples
#' # set_gray(3)
#'
#' @noRd
set_gray <- function(P) {

n_gray <- if(P %% 2 == 0) {0} else {P %/% 2}
Expand Down Expand Up @@ -107,6 +115,8 @@ set_gray <- function(P) {
#'
#' # Get the full set
#' bvar:::get_var_set(NULL, M = 3)
#'
#' @noRd
get_var_set <- function(vars, variables, M) {

if(is.null(vars)) {
Expand Down
2 changes: 2 additions & 0 deletions R/20_ml.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
#' If opt is \code{TRUE} only the value of log_ml is returned.
#'
#' @importFrom stats dgamma
#'
#' @noRd
bv_ml <- function(
hyper, hyper_min = -Inf, hyper_max = Inf,
pars, priors, Y, X, K, M, N, lags,
Expand Down
2 changes: 2 additions & 0 deletions R/21_draw.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#' }
#'
#' @importFrom MASS mvrnorm
#'
#' @noRd
draw_post <- function(
X,
N = nrow(X), M = ncol(X), lags, b,
Expand Down
4 changes: 2 additions & 2 deletions R/30_metropolis.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
#'
#' @examples
#' # Only adjust the scale parameter
#' bv_metropolis(scale_hess = 10)
#' bv_mh(scale_hess = 10)
#'
#' # Turn on automatic scaling of the acceptance rate to [20, 40]
#' bv_metropolis(adjust_acc = TRUE, acc_lower = 0.2, acc_upper = 0.4)
#' bv_mh(adjust_acc = TRUE, acc_lower = 0.2, acc_upper = 0.4)
bv_mh <- function(
scale_hess = 0.01,
adjust_acc = FALSE,
Expand Down
2 changes: 1 addition & 1 deletion R/40_priors.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#' parameters "lambda", "alpha" and "psi" as well as the names of possible
#' dummy priors.
#' @param mn List of class "bv_minnesota". Options for the Minnesota prior,
#' set via \code{\link{bv_minnesota}}.
#' set via \code{\link{bv_mn}}.
#' @param ... Optional lists of class "bv_dummy" with options for possible
#' dummy priors. Must be assigned a name in the function call. Created with
#' \code{\link{bv_dummy}}
Expand Down
2 changes: 2 additions & 0 deletions R/42_dummy.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#' @param ... Other possible parameters such as sd or fun.
#'
#' @return Returns a list of class bv_dummy.
#'
#' @noRd
dummy <- function(
mode = 1,
min = 0.0001, max = 5,
Expand Down
2 changes: 2 additions & 0 deletions R/51_fcast_compute.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#' @return Returns a matrix containing forecasts for all variables in the model.
#'
#' @importFrom stats rnorm
#'
#' @noRd
compute_fcast <- function(
Y, K, M, N, lags,
horizon,
Expand Down
2 changes: 1 addition & 1 deletion R/60_irf.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#'
#' irf_signs <- bv_irf(sign_restr = signs)
#'
#' # bvar(data, lags = 5, irf = irf_signs)
#' bvar(data, lags = 5, irf = irf_signs)
bv_irf <- function(
horizon = 12,
fevd = FALSE,
Expand Down
2 changes: 2 additions & 0 deletions R/61_irf_compute.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
#' @return Returns impulse reponses using the posterior draws of the VAR
#' coefficients and the vcov-matrix of the model either to identified shocks,
#' using a Cholesky decomposition or sign restrictions, or unidentified ones.
#'
#' @noRd
compute_irf <- function(
beta_comp,
sigma, sigma_chol,
Expand Down
2 changes: 2 additions & 0 deletions R/62_sign_restr.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#' identified via sign restrictions.
#'
#' @importFrom stats rnorm
#'
#' @noRd
sign_restr <- function(sigma_chol, sign_restr, M) {

counter <- 0
Expand Down
2 changes: 2 additions & 0 deletions R/63_fevd.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#' @param horizon Integer scalar. Horizon of impulse responses and FEVDs.
#'
#' @return Returns a numeric matrix of FEVDs.
#'
#' @noRd
fevd <- function(irf_comp, M, horizon) {

fevd_comp <- aperm(apply(irf_comp * irf_comp, c(1, 3), cumsum), c(2, 3, 1))
Expand Down
6 changes: 6 additions & 0 deletions R/84_plot_hyper.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ bv_plot <- function(x, mar = c(2, 2, 2, 0.5), ...) {
#' @param ... Further \code{bvar} objects to include in the plot.
#'
#' @return Returns x invisibly.
#'
#' @noRd
plot_hyper <- function(x, name, fun = c(plot_trace, plot_dens), ...) {

if(!inherits(x, "bvar")) {stop("Please provide a `bvar` object.")}
Expand Down Expand Up @@ -132,6 +134,8 @@ bv_plot_density <- function(x, name, ...) {
#'
#' @importFrom graphics plot polygon lines abline
#' @importFrom stats density
#'
#' @noRd
plot_trace <- function(x, name = NULL, bounds = NULL, dots = list()) {

ylim <- c(min(vapply(dots, min, double(1)), x),
Expand All @@ -145,6 +149,8 @@ plot_trace <- function(x, name = NULL, bounds = NULL, dots = list()) {


#' @rdname plot_trace
#'
#' @noRd
plot_dens <- function(x, name = NULL, bounds = NULL, dots = list()) {

xlim <- c(min(vapply(dots, min, double(1)), x),
Expand Down
2 changes: 2 additions & 0 deletions R/85_plot_fcast.R
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ bv_plot_fcast <- function(
#'
#' @importFrom graphics par grid abline
#' @importFrom stats ts.plot
#'
#' @noRd
plot_fcast <- function(
x,
variables,
Expand Down
2 changes: 2 additions & 0 deletions R/86_plot_irf.R
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ bv_plot_irf <- function(
#'
#' @importFrom graphics par grid abline
#' @importFrom stats ts.plot
#'
#' @noRd
plot_irf <- function(
x,
variables,
Expand Down
2 changes: 2 additions & 0 deletions R/95_method_fcast.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ print.bvar_fcast <- function(x, ...) {
#'
#' @param x A \code{bv_fcast} object.
#' @param ... Not used.
#'
#' @noRd
print_fcast <- function(x, ...) {

cat("Horizon: ", x$horizon, "\n", sep = "")
Expand Down
2 changes: 2 additions & 0 deletions R/96_method_irf.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ print.bvar_irf <- function(x, ...) {
#'
#' @param x A \code{bv_irf} object.
#' @param ... Not used.
#'
#' @noRd
print_irf <- function(x, ...) {

cat("Horizon:", x$horizon)
Expand Down
20 changes: 0 additions & 20 deletions man/auto_psi.Rd

This file was deleted.

2 changes: 1 addition & 1 deletion man/bv_irf.Rd

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

4 changes: 2 additions & 2 deletions man/bv_mh.Rd

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

60 changes: 0 additions & 60 deletions man/bv_ml.Rd

This file was deleted.

10 changes: 8 additions & 2 deletions man/bv_mn.Rd

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

2 changes: 1 addition & 1 deletion man/bv_priors.Rd

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

Loading

0 comments on commit 93cde79

Please sign in to comment.