View source: R/header_replication.R

run_casestudy | R Documentation |

Run the case study in KLTG (2021), or a smaller version thereof

run_casestudy( data_df, burnin_size = 5000, max_mcmc_sample_size = 5000, nr_of_chains = 3, first_vint = "1996Q2", last_vint = "2014Q3", forecast_horizon = 1, random_seed = 816 )

`data_df` |
data frame in the same format as the gdp data set in this package. |

`burnin_size` |
length of the burn-in period used for each forecast. |

`max_mcmc_sample_size` |
maximal number of MCMC draws to consider (integer, must equal either 1000, 5000, 10000, 20000 or 40000). Defaults to 5000. |

`nr_of_chains` |
number of parallel MCMC for each forecast date (integer, defaults to 3). |

`first_vint, last_vint` |
first and last data vintage (= time point at which forecasts are made). Default to "19962Q2" and "2014Q3", respectively. |

`forecast_horizon` |
forecast horizon to be analyzed (integer, defaults to 1). |

`random_seed` |
seed for random numbers used during the MCMC sampling process. Defaults to 816. |

The full results in Section 5 of KLTG (2021) are based on the following setup: `burnin_size = 10000`

,
`max_mcmc_sample_size = 50000`

, `nr_of_chains = 16`

, `data_df = gdp`

, `first_vint = "1996Q2"`

,
`last_vint = "2014Q3"`

, and `forecast_horizon = 1`

. Since running this full configuration is very
time consuming, the default setup offers the possibility to run a small-scale study which reproduces the
qualitative outcomes of the analysis. Running the small-scale study implied by the defaults of `run_study`

as well as the GDP data (`data_df = gdp`

) takes about 40 minutes on an Intel i7 processor.

Object of class "casestudy", containing the results of the analysis. This object can be passed to `plot`

for plotting, see the documentation for plot.casestudy.

Fabian Krueger

Krueger, F., Lerch, S., Thorarinsdottir, T.L. and T. Gneiting (2021): ‘Predictive inference based on Markov chain Monte Carlo output’, *International Statistical Review* 89, 274-301. doi: 10.1111/insr.12405

plot.casestudy produces a summary plot of the results generated by run_casestudy run_casestudy uses ar_ms to fit a Bayesian Markov Switching model, recursively for several time periods.

## Not run: data(gdp) cs <- run_casestudy(data_df = gdp, last_vint = "1999Q4") plot(cs) ## End(Not run)

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.