forecast: Forecasting with VAR, DSGE, and DSGE-VAR Models.

Description Usage Arguments Value Author(s) Examples

View source: R/Classes.R

Description

Compute forecasts using VAR, DSGE, and DSGE-VAR models.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
forecast(obj,...)

## S3 method for class 'Rcpp_bvarm'
forecast(obj,periods=20,shocks=TRUE,plot=TRUE,
         var_names=NULL,percentiles=c(.05,.50,.95),use_mean=FALSE,
         back_data=0,save=FALSE,height=13,width=11,...)
## S3 method for class 'Rcpp_bvars'
forecast(obj,periods=20,shocks=TRUE,plot=TRUE,
         var_names=NULL,percentiles=c(.05,.50,.95),use_mean=FALSE,
         back_data=0,save=FALSE,height=13,width=11,...)
## S3 method for class 'Rcpp_bvarw'
forecast(obj,periods=20,shocks=TRUE,plot=TRUE,
         var_names=NULL,percentiles=c(.05,.50,.95),use_mean=FALSE,
         back_data=0,save=FALSE,height=13,width=11,...)
## S3 method for class 'Rcpp_cvar'
forecast(obj,periods=20,shocks=TRUE,plot=TRUE,
         var_names=NULL,percentiles=c(.05,.50,.95),use_mean=FALSE,
         back_data=0,save=FALSE,height=13,width=11,...)

## S3 method for class 'Rcpp_dsge_gensys'
forecast(obj,periods=20,shocks=TRUE,plot=TRUE,
         var_names=NULL,percentiles=c(.05,.50,.95),use_mean=FALSE,
         back_data=0,save=FALSE,height=13,width=11,...)
## S3 method for class 'Rcpp_dsge_uhlig'
forecast(obj,periods=20,shocks=TRUE,plot=TRUE,
         var_names=NULL,percentiles=c(.05,.50,.95),use_mean=FALSE,
         back_data=0,save=FALSE,height=13,width=11,...)

## S3 method for class 'Rcpp_dsgevar_gensys'
forecast(obj,periods=20,shocks=TRUE,plot=TRUE,
         var_names=NULL,percentiles=c(.05,.50,.95),use_mean=FALSE,
         back_data=0,save=FALSE,height=13,width=11,...)
## S3 method for class 'Rcpp_dsgevar_uhlig'
forecast(obj,periods=20,shocks=TRUE,plot=TRUE,
         var_names=NULL,percentiles=c(.05,.50,.95),use_mean=FALSE,
         back_data=0,save=FALSE,height=13,width=11,...)

Arguments

obj

An object of one of the above classes.

periods

The forecast horizon.

shocks

Whether to include uncertainty about future shocks when calculating the forecasts.

plot

Whether to plot the forecasts.

var_names

Variable names.

percentiles

The percentiles of the conditional posterior distribution of forecasts to use for plotting.

use_mean

Whether to use the mean of the forecast distribution rather than the middle value in ‘percentiles’.

back_data

How many 'real' data points to plot before plotting the forecast. A broken line will indicate whether the ‘real’ data ends and the forecast begins.

save

Whether to save the plots.

height

If save=FALSE, use this to set the height of the plot.

width

If save=FALSE, use this to set the width of the plot.


...

Additional arguments (not used).

Value

The function returns a plot of the forecast with user-selected percentiles, as well as the values used to create the plot; see the vignette for more details on the values returned.

Author(s)

Keith O'Hara

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
## Not run: 
data(BMRVARData)
bvar_data <- data.matrix(USMacroData[,2:4])

#

coef_prior <- c(0.9,0.9,0.9)
XiBeta <- 4
XiSigma <- 1
gamma = 4

bvar_obj <- new(bvarw)

#

bvar_obj$build(bvar_data,TRUE,4)
bvar_obj$prior(coef_prior,XiBeta,XiSigma,gamma)
bvar_obj$gibbs(10000,5000)

forecast(bvar_obj,shocks=TRUE,var_names=colnames(bvar_data),back_data=10,save=FALSE)

## End(Not run)

kthohr/BMR documentation built on May 20, 2019, 7:04 p.m.