From fb3911b2e4faf7ae6de8ed42308270a2ffbd10ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Wo=C5=BAniak?= Date: Sat, 21 Sep 2024 15:53:16 +1000 Subject: [PATCH] change "rates" to "rate:" #21 --- R/bvarPANELs-package.R | 2 +- R/forecast.R | 10 +++++----- R/specify_bvarpanel.R | 10 +++++----- inst/tinytest/test_forecast.R | 6 +++--- man/bvarPANELs-package.Rd | 2 +- man/forecast.PosteriorBVARPANEL.Rd | 8 ++++---- man/specify_bvarPANEL.Rd | 2 +- man/specify_panel_data_matrices.Rd | 4 ++-- 8 files changed, 22 insertions(+), 22 deletions(-) diff --git a/R/bvarPANELs-package.R b/R/bvarPANELs-package.R index fd590f2..70a8031 100644 --- a/R/bvarPANELs-package.R +++ b/R/bvarPANELs-package.R @@ -223,7 +223,7 @@ #' specification = specify_bvarPANEL$new( #' ilo_dynamic_panel, #' exogenous = ilo_exogenous_variables, -#' type = c("real", rep("rates", 3)) +#' type = c("real", rep("rate", 3)) #' ) #' burn_in = estimate(specification, S = 10) # run the burn-in; use say S = 10000 #' posterior = estimate(burn_in, S = 10) # estimate the model; use say S = 10000 diff --git a/R/forecast.R b/R/forecast.R index c37588c..2ec1fee 100644 --- a/R/forecast.R +++ b/R/forecast.R @@ -52,10 +52,10 @@ #' of these exogenous variables in the argument \code{exogenous_forecast} of the #' \code{\link{forecast.PosteriorBVARPANEL}} function. #' -#' \strong{Truncated forecasts for variables of type 'rates'.} +#' \strong{Truncated forecasts for variables of type 'rate'.} #' The package provides the option to truncate the forecasts for variables of #' for which the corresponding element of argument \code{type} of the function -#' \code{specify_bvarPANEL$new()} is set to \code{"rates"}. The one-period-ahead +#' \code{specify_bvarPANEL$new()} is set to \code{"rate"}. The one-period-ahead #' predictive normal density for such variables is truncated to values from #' interval \eqn{[0,100]}. #' @@ -123,7 +123,7 @@ #' data(ilo_conditional_forecasts) # load the conditional forecasts of dgdp #' specification = specify_bvarPANEL$new( #' ilo_dynamic_panel, -#' type = c("real", rep("rates", 3)) +#' type = c("real", rep("rate", 3)) #' ) # specify the model #' burn_in = estimate(specification, 10) # run the burn-in; use say S = 10000 #' posterior = estimate(burn_in, 10) # estimate the model; use say S = 10000 @@ -134,7 +134,7 @@ #' ############################################################ #' set.seed(123) #' ilo_dynamic_panel |> -#' specify_bvarPANEL$new(type = c("real", rep("rates", 3))) |> +#' specify_bvarPANEL$new(type = c("real", rep("rate", 3))) |> #' estimate(S = 10) |> #' estimate(S = 20) |> #' forecast( @@ -205,7 +205,7 @@ forecast.PosteriorBVARPANEL = function( type = posterior$last_draw$data_matrices$type LB = rep(-Inf, N) UB = rep(Inf, N) - rates_id = which(type == "rates") + rates_id = which(type == "rate") if (length(rates_id) > 0) { LB[rates_id] = 0 UB[rates_id] = 100 diff --git a/R/specify_bvarpanel.R b/R/specify_bvarpanel.R index 4712dba..e765fb0 100644 --- a/R/specify_bvarpanel.R +++ b/R/specify_bvarpanel.R @@ -305,7 +305,7 @@ specify_panel_data_matrices = R6::R6Class( #' regressors, \eqn{\mathbf{X}_c}. X = list(), - #' @field type an \code{N} character vector with elements set to "rates" or "real" + #' @field type an \code{N} character vector with elements set to "rate" or "real" #' determining the truncation of the predictive density to \code{[0, 100]} and #' \code{(-Inf, Inf)} (no truncation) for each of the variables. type = character(), @@ -318,7 +318,7 @@ specify_panel_data_matrices = R6::R6Class( #' @param exogenous a list containing \code{(T_c+p)xd} matrices with #' country-specific of exogenous variables. This matrix should not include a #' constant term. - #' @param type an \code{N} character vector with elements set to "rates" or "real" + #' @param type an \code{N} character vector with elements set to "rate" or "real" #' determining the truncation of the predictive density to \code{[0, 100]} and #' \code{(-Inf, Inf)} (no truncation) for each of the variables. #' @return New data matrices DataMatricesBVARPANEL @@ -332,8 +332,8 @@ specify_panel_data_matrices = R6::R6Class( } stopifnot("Argument p must be a positive integer number." = p > 0 & p %% 1 == 0) - stopifnot("Argument type must include elements 'rates' or 'real'." - = all(unique(type) %in% c("rates", "real")) ) + stopifnot("Argument type must include elements 'rate' or 'real'." + = all(unique(type) %in% c("rate", "real")) ) stopifnot("Argument type must be of length corresponding to the numbers of variables." = length(type) == ncol(data[[1]]) ) @@ -443,7 +443,7 @@ specify_bvarPANEL = R6::R6Class( #' @param stationary an \code{N} logical vector - its element set to #' \code{FALSE} sets the prior mean for the autoregressive parameters of the #' \code{N}th equation to the white noise process, otherwise to random walk. - #' @param type an \code{N} character vector with elements set to "rates" or "real" + #' @param type an \code{N} character vector with elements set to "rate" or "real" #' determining the truncation of the predictive density to \code{[0, 100]} and #' \code{(-Inf, Inf)} (no truncation) for each of the variables. #' @return A new complete specification for the Bayesian Panel VAR model BVARPANEL. diff --git a/inst/tinytest/test_forecast.R b/inst/tinytest/test_forecast.R index 0012a9a..153c54d 100644 --- a/inst/tinytest/test_forecast.R +++ b/inst/tinytest/test_forecast.R @@ -141,20 +141,20 @@ expect_error( # truncated forecasts expect_identical( - class(specify_bvarPANEL$new(ilo_dynamic_panel, type = c("real",rep("rates",3))))[1], + class(specify_bvarPANEL$new(ilo_dynamic_panel, type = c("real",rep("rate",3))))[1], "BVARPANEL", info = "truncated forecast: good specification of argument type." ) expect_error( - specify_bvarPANEL$new(ilo_dynamic_panel, type = rep("rates",3)), + specify_bvarPANEL$new(ilo_dynamic_panel, type = rep("rate",3)), pattern = "length", info = "truncated forecast: wrong specification of argument type." ) set.seed(1) suppressMessages( - specification_no1 <- specify_bvarPANEL$new(ilo_dynamic_panel, type = c("real",rep("rates",3))) + specification_no1 <- specify_bvarPANEL$new(ilo_dynamic_panel, type = c("real",rep("rate",3))) ) run_no1 <- estimate(specification_no1, 3, 1, show_progress = FALSE) suppressMessages( diff --git a/man/bvarPANELs-package.Rd b/man/bvarPANELs-package.Rd index 6405fe2..cc9990c 100644 --- a/man/bvarPANELs-package.Rd +++ b/man/bvarPANELs-package.Rd @@ -184,7 +184,7 @@ set.seed(123) specification = specify_bvarPANEL$new( ilo_dynamic_panel, exogenous = ilo_exogenous_variables, - type = c("real", rep("rates", 3)) + type = c("real", rep("rate", 3)) ) burn_in = estimate(specification, S = 10) # run the burn-in; use say S = 10000 posterior = estimate(burn_in, S = 10) # estimate the model; use say S = 10000 diff --git a/man/forecast.PosteriorBVARPANEL.Rd b/man/forecast.PosteriorBVARPANEL.Rd index eba9649..50b9583 100644 --- a/man/forecast.PosteriorBVARPANEL.Rd +++ b/man/forecast.PosteriorBVARPANEL.Rd @@ -90,10 +90,10 @@ Forecasting with models for which specification argument of these exogenous variables in the argument \code{exogenous_forecast} of the \code{\link{forecast.PosteriorBVARPANEL}} function. -\strong{Truncated forecasts for variables of type 'rates'.} +\strong{Truncated forecasts for variables of type 'rate'.} The package provides the option to truncate the forecasts for variables of for which the corresponding element of argument \code{type} of the function -\code{specify_bvarPANEL$new()} is set to \code{"rates"}. The one-period-ahead +\code{specify_bvarPANEL$new()} is set to \code{"rate"}. The one-period-ahead predictive normal density for such variables is truncated to values from interval \eqn{[0,100]}. } @@ -127,7 +127,7 @@ ilo_dynamic_panel |> data(ilo_conditional_forecasts) # load the conditional forecasts of dgdp specification = specify_bvarPANEL$new( ilo_dynamic_panel, - type = c("real", rep("rates", 3)) + type = c("real", rep("rate", 3)) ) # specify the model burn_in = estimate(specification, 10) # run the burn-in; use say S = 10000 posterior = estimate(burn_in, 10) # estimate the model; use say S = 10000 @@ -138,7 +138,7 @@ predictive = forecast(posterior, 6, conditional_forecast = ilo_conditional_fo ############################################################ set.seed(123) ilo_dynamic_panel |> - specify_bvarPANEL$new(type = c("real", rep("rates", 3))) |> + specify_bvarPANEL$new(type = c("real", rep("rate", 3))) |> estimate(S = 10) |> estimate(S = 20) |> forecast( diff --git a/man/specify_bvarPANEL.Rd b/man/specify_bvarPANEL.Rd index a8a8d51..f113e07 100644 --- a/man/specify_bvarPANEL.Rd +++ b/man/specify_bvarPANEL.Rd @@ -120,7 +120,7 @@ with time series data.} \code{FALSE} sets the prior mean for the autoregressive parameters of the \code{N}th equation to the white noise process, otherwise to random walk.} -\item{\code{type}}{an \code{N} character vector with elements set to "rates" or "real" +\item{\code{type}}{an \code{N} character vector with elements set to "rate" or "real" determining the truncation of the predictive density to \code{[0, 100]} and \code{(-Inf, Inf)} (no truncation) for each of the variables.} } diff --git a/man/specify_panel_data_matrices.Rd b/man/specify_panel_data_matrices.Rd index 2c6642d..183dd7a 100644 --- a/man/specify_panel_data_matrices.Rd +++ b/man/specify_panel_data_matrices.Rd @@ -32,7 +32,7 @@ dependent variables, \eqn{\mathbf{Y}_c}.} \item{\code{X}}{a list with \code{C} elements with \code{T_c x K} matrices of regressors, \eqn{\mathbf{X}_c}.} -\item{\code{type}}{an \code{N} character vector with elements set to "rates" or "real" +\item{\code{type}}{an \code{N} character vector with elements set to "rate" or "real" determining the truncation of the predictive density to \code{[0, 100]} and \code{(-Inf, Inf)} (no truncation) for each of the variables.} } @@ -72,7 +72,7 @@ time series data.} country-specific of exogenous variables. This matrix should not include a constant term.} -\item{\code{type}}{an \code{N} character vector with elements set to "rates" or "real" +\item{\code{type}}{an \code{N} character vector with elements set to "rate" or "real" determining the truncation of the predictive density to \code{[0, 100]} and \code{(-Inf, Inf)} (no truncation) for each of the variables.} }