Skip to content

Commit

Permalink
Merge pull request #23 from bsvars/3-include-data
Browse files Browse the repository at this point in the history
3 include data
  • Loading branch information
donotdespair authored Sep 21, 2024
2 parents 85cb99d + 33bef29 commit 5ce13b5
Show file tree
Hide file tree
Showing 35 changed files with 7,578 additions and 7,571 deletions.
14 changes: 7 additions & 7 deletions R/bvarPANELs-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -188,16 +188,16 @@
#' @examples
#' # Basic estimation and forecasting example
#' ############################################################
#' data(ilo_cubic_panel) # load the data
#' data(ilo_dynamic_panel) # load the data
#' set.seed(123)
#' specification = specify_bvarPANEL$new(ilo_cubic_panel) # specify the model
#' burn_in = estimate(specification, S = 10) # run the burn-in; use say S = 5000
#' specification = specify_bvarPANEL$new(ilo_dynamic_panel) # specify the model
#' 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
#' predictive = forecast(posterior, 2) # forecast the future
#'
#' # workflow with the pipe |>
#' set.seed(123)
#' ilo_cubic_panel |>
#' ilo_dynamic_panel |>
#' specify_bvarPANEL$new() |>
#' estimate(S = 20) |>
#' estimate(S = 20) |>
Expand All @@ -208,16 +208,16 @@
#' # Full estimation and forecasting example with
#' # exogenous variables and conditional forecasts
#' ############################################################
#' data(ilo_cubic_panel) # load the data
#' data(ilo_dynamic_panel) # load the data
#' data(ilo_exogenous_variables) # load the exogenous variables
#' data(ilo_exogenous_forecasts) # load the exogenous forecasts
#' data(ilo_conditional_forecasts) # load the conditional forecasts
#' set.seed(123)
#' specification = specify_bvarPANEL$new(
#' ilo_cubic_panel,
#' ilo_dynamic_panel,
#' exogenous = ilo_exogenous_variables
#' )
#' burn_in = estimate(specification, S = 10) # run the burn-in; use say S = 5000
#' 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
#' predictive = forecast(
#' posterior,
Expand Down
6 changes: 3 additions & 3 deletions R/compute_variance_decompositions.PosteriorBVARPANEL.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
#'
#' @examples
#' # upload data
#' data(ilo_cubic_panel)
#' data(ilo_dynamic_panel)
#'
#' # specify the model and set seed
#' set.seed(123)
#' specification = specify_bvarPANEL$new(ilo_cubic_panel, p = 1)
#' specification = specify_bvarPANEL$new(ilo_dynamic_panel, p = 1)
#'
#' # run the burn-in
#' burn_in = estimate(specification, 10)
Expand All @@ -46,7 +46,7 @@
#' # workflow with the pipe |>
#' ############################################################
#' set.seed(123)
#' ilo_cubic_panel |>
#' ilo_dynamic_panel |>
#' specify_bvarPANEL$new(p = 1) |>
#' estimate(S = 10) |>
#' estimate(S = 20) |>
Expand Down
6 changes: 3 additions & 3 deletions R/estimate.bvarPANEL.R
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@
#' @method estimate BVARPANEL
#'
#' @examples
#' data(ilo_cubic_panel) # load the data
#' data(ilo_dynamic_panel) # load the data
#' data(ilo_exogenous_variables) # load the exogenous variables
#' set.seed(123)
#' # specify the model
#' specification = specify_bvarPANEL$new(ilo_cubic_panel, exogenous = ilo_exogenous_variables)
#' burn_in = estimate(specification, 10) # run the burn-in; use say S = 5000
#' specification = specify_bvarPANEL$new(ilo_dynamic_panel, exogenous = ilo_exogenous_variables)
#' 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
#'
#' @export
Expand Down
14 changes: 7 additions & 7 deletions R/forecast.R
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,14 @@
#' @author Tomasz Woźniak \email{wozniak.tom@pm.me}
#'
#' @examples
#' data(ilo_cubic_panel) # load the data
#' data(ilo_dynamic_panel) # load the data
#' data(ilo_exogenous_variables) # load the exogenous variables
#' data(ilo_exogenous_forecasts) # load the exogenous forecast
#' set.seed(123)
#'
#' # specify the model
#' specification = specify_bvarPANEL$new(ilo_cubic_panel, exogenous = ilo_exogenous_variables)
#' burn_in = estimate(specification, 10) # run the burn-in; use say S = 5000
#' specification = specify_bvarPANEL$new(ilo_dynamic_panel, exogenous = ilo_exogenous_variables)
#' 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
#'
#' # forecast 6 years ahead
Expand All @@ -103,7 +103,7 @@
#' # workflow with the pipe |>
#' ############################################################
#' set.seed(123)
#' ilo_cubic_panel |>
#' ilo_dynamic_panel |>
#' specify_bvarPANEL$new() |>
#' estimate(S = 10) |>
#' estimate(S = 20) |>
Expand All @@ -114,16 +114,16 @@
#' # growth rate
#' ############################################################
#' data(ilo_conditional_forecasts) # load the conditional forecasts of dgdp
#' specification = specify_bvarPANEL$new(ilo_cubic_panel) # specify the model
#' burn_in = estimate(specification, 10) # run the burn-in; use say S = 5000
#' specification = specify_bvarPANEL$new(ilo_dynamic_panel) # 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
#' # forecast 6 years ahead
#' predictive = forecast(posterior, 6, conditional_forecast = ilo_conditional_forecasts)
#'
#' # workflow with the pipe |>
#' ############################################################
#' set.seed(123)
#' ilo_cubic_panel |>
#' ilo_dynamic_panel |>
#' specify_bvarPANEL$new() |>
#' estimate(S = 10) |>
#' estimate(S = 20) |>
Expand Down
9 changes: 4 additions & 5 deletions R/ilo_conditional_forecasts.R
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@

#' @title Data containing conditional projections for growth rate of GDP (dgdp)
#' @title Data containing conditional projections for the logarithm of GDP (gdp)
#' for 189 United Nations countries from 2024 to 2029
#'
#' @description For each of the countries a time series of 6 observations on
#' GDP growth rates (sgdp) #' formatted so they is provided to generate
#' GDP growth rates (gdp) formatted so they is provided to generate
#' conditional forecasts of labour market outcomes given the provided projected
#' paths of output.
#' Last data update was implemented on 2024-05-11.
#' Last data update was implemented on 2024-09-21.
#'
#' @usage data(ilo_conditional_forecasts)
#'
#' @format A list of 189 \code{ts} objects with time series of 6 observations
#' on 4 variables:
#' \describe{
#' \item{gdp}{logarithm of gross domestic product - contains projected values}
#' \item{UR}{unemployment rate - contains missing values}
#' \item{EPR}{annual employment rate - contains missing values}
#' \item{LFPR}{annual labour force participation rate - contains missing values}
#' \item{dgdp}{annual growth rate of gross domestic product - contains projected
#' values}
#' }
#'
#' @source
Expand Down
17 changes: 9 additions & 8 deletions R/ilo_cubic_panel.R → R/ilo_dynamic_panel.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,28 @@
#' for 189 United Nations countries from 1991 to 2023
#'
#' @description For each of the countries a time series of 33 observations on 4
#' variables including the unemployment rate (UR), employment rate (EPR), labour
#' force participation rate (LFPR) and the growth rate of GDP (dgdp) is provided.
#' The missing observations are filled using imputation method.
#' Last data update was implemented on 2024-05-11.
#' variables including the logarithm of Gross Domestic Product (gdp), as well as
#' the labour market outcomes including the unemployment rate (UR), employment
#' rate (EPR), labour force participation rate (LFPR). The missing observations
#' are filled using imputation method.
#' Last data update was implemented on 2024-09-21.
#'
#' @usage data(ilo_cubic_panel)
#' @usage data(ilo_dynamic_panel)
#'
#' @format A list of 189 \code{ts} objects with time series of 33 observations
#' on 4 variables:
#' \describe{
#' \item{gdp}{logarithm of gross domestic product}
#' \item{UR}{annual unemployment rate}
#' \item{EPR}{annual employment rate}
#' \item{LFPR}{annual labour force participation rate}
#' \item{dgdp}{annual growth rate of gross domestic product}
#' }
#'
#' @source
#' International Labour Organization. (2020). ILO modelled estimates database,
#' ILOSTAT [database]. Available from \url{https://ilostat.ilo.org/data/}.
#'
#' @examples
#' data(ilo_cubic_panel) # upload the data
#' data(ilo_dynamic_panel) # upload the data
#'
"ilo_cubic_panel"
"ilo_dynamic_panel"
8 changes: 4 additions & 4 deletions R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#' @author Tomasz Woźniak \email{wozniak.tom@pm.me}
#'
#' @examples
#' specification = specify_bvarPANEL$new(ilo_cubic_panel) # specify the model
#' specification = specify_bvarPANEL$new(ilo_dynamic_panel) # specify the model
#' burn_in = estimate(specification, 10) # run the burn-in
#' posterior = estimate(burn_in, 10) # estimate the model
#'
Expand All @@ -39,7 +39,7 @@
#' # workflow with the pipe |>
#' ############################################################
#' set.seed(123)
#' ilo_cubic_panel |>
#' ilo_dynamic_panel |>
#' specify_bvarPANEL$new() |>
#' estimate(S = 10) |>
#' estimate(S = 10) |>
Expand Down Expand Up @@ -115,7 +115,7 @@ plot.ForecastsPANEL = function(
#'
#' @examples
#' set.seed(123)
#' specification = specify_bvarPANEL$new(ilo_cubic_panel)
#' specification = specify_bvarPANEL$new(ilo_dynamic_panel)
#'
#' # run the burn-in
#' burn_in = estimate(specification, 10)
Expand All @@ -130,7 +130,7 @@ plot.ForecastsPANEL = function(
#' # workflow with the pipe |>
#' ############################################################
#' set.seed(123)
#' ilo_cubic_panel |>
#' ilo_dynamic_panel |>
#' specify_bvarPANEL$new() |>
#' estimate(S = 10) |>
#' estimate(S = 20) |>
Expand Down
40 changes: 20 additions & 20 deletions R/specify_bvarpanel.R
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,8 @@ specify_starting_values_bvarPANEL = R6::R6Class(
#' Bayesian Panel VAR model for all countries \eqn{c = 1, ..., C}.
#'
#' @examples
#' data(ilo_cubic_panel)
#' YX = specify_panel_data_matrices$new(data = ilo_cubic_panel, p = 4)
#' data(ilo_dynamic_panel)
#' YX = specify_panel_data_matrices$new(data = ilo_dynamic_panel, p = 4)
#' length(YX$Y); names(YX$Y)
#'
#' @export
Expand Down Expand Up @@ -364,8 +364,8 @@ specify_panel_data_matrices = R6::R6Class(
#' Returns the data matrices DataMatricesBVARPANEL as a \code{list}.
#'
#' @examples
#' data(ilo_cubic_panel)
#' YX = specify_panel_data_matrices$new(ilo_cubic_panel)
#' data(ilo_dynamic_panel)
#' YX = specify_panel_data_matrices$new(ilo_dynamic_panel)
#' YX$get_data_matrices()
#'
get_data_matrices = function() {
Expand All @@ -390,9 +390,9 @@ specify_panel_data_matrices = R6::R6Class(
#' Vector Autoregression.
#'
#' @examples
#' data(ilo_cubic_panel)
#' data(ilo_dynamic_panel)
#' spec = specify_bvarPANEL$new(
#' data = ilo_cubic_panel,
#' data = ilo_dynamic_panel,
#' p = 4
#' )
#'
Expand Down Expand Up @@ -456,9 +456,9 @@ specify_bvarPANEL = R6::R6Class(
#' Returns the data matrices as the DataMatricesBVARPANEL object.
#'
#' @examples
#' data(ilo_cubic_panel)
#' data(ilo_dynamic_panel)
#' spec = specify_bvarPANEL$new(
#' data = ilo_cubic_panel,
#' data = ilo_dynamic_panel,
#' p = 4
#' )
#' spec$get_data_matrices()
Expand All @@ -471,9 +471,9 @@ specify_bvarPANEL = R6::R6Class(
#' Returns the prior specification as the PriorBVARPANEL object.
#'
#' @examples
#' data(ilo_cubic_panel)
#' data(ilo_dynamic_panel)
#' spec = specify_bvarPANEL$new(
#' data = ilo_cubic_panel,
#' data = ilo_dynamic_panel,
#' p = 4
#' )
#' spec$get_prior()
Expand All @@ -486,9 +486,9 @@ specify_bvarPANEL = R6::R6Class(
#' Returns the starting values as the StartingValuesBVARPANEL object.
#'
#' @examples
#' data(ilo_cubic_panel)
#' data(ilo_dynamic_panel)
#' spec = specify_bvarPANEL$new(
#' data = ilo_cubic_panel,
#' data = ilo_dynamic_panel,
#' p = 4
#' )
#' spec$get_starting_values()
Expand All @@ -505,9 +505,9 @@ specify_bvarPANEL = R6::R6Class(
#' start adapting, the initial scaling rate
#'
#' @examples
#' data(ilo_cubic_panel)
#' data(ilo_dynamic_panel)
#' spec = specify_bvarPANEL$new(
#' data = ilo_cubic_panel,
#' data = ilo_dynamic_panel,
#' p = 4
#' )
#' spec$set_adaptiveMH(c(0.6, 0.4, 10, 0.1))
Expand Down Expand Up @@ -539,10 +539,10 @@ specify_bvarPANEL = R6::R6Class(
#'
#' @examples
#' # This is a function that is used within estimate()
#' data(ilo_cubic_panel)
#' data(ilo_dynamic_panel)
#' set.seed(123)
#' specification = specify_bvarPANEL$new(
#' data = ilo_cubic_panel,
#' data = ilo_dynamic_panel,
#' p = 4
#' )
#'
Expand Down Expand Up @@ -602,10 +602,10 @@ specify_posterior_bvarPANEL = R6::R6Class(
#' Returns a list containing Bayesian estimation output.
#'
#' @examples
#' data(ilo_cubic_panel)
#' data(ilo_dynamic_panel)
#' set.seed(123)
#' specification = specify_bvarPANEL$new(
#' data = ilo_cubic_panel,
#' data = ilo_dynamic_panel,
#' p = 4
#' )
#'
Expand All @@ -622,10 +622,10 @@ specify_posterior_bvarPANEL = R6::R6Class(
#' MCMC estimation using \code{estimate()}.
#'
#' @examples
#' data(ilo_cubic_panel)
#' data(ilo_dynamic_panel)
#' set.seed(123)
#' specification = specify_bvarPANEL$new(
#' data = ilo_cubic_panel,
#' data = ilo_dynamic_panel,
#' p = 4
#' )
#'
Expand Down
Loading

0 comments on commit 5ce13b5

Please sign in to comment.