Dynamic Simulations of Autoregressive Relationships

Dynamic simulations and graphical depictions of autoregressive relationships.

Version 1.2.1 CRAN Version

Build Status

Christopher Gandrud,

Laron K Williams, and Guy D Whitten


The dynsim package implements Williams and Whitten's (2011, 2012)

method for dynamic simulations of autoregressive relationships in R.


There are four basic steps to use dynsim to create dynamic simulations of autoregressive relationships:

  1. Estimate your linear model using lm or similar functions.

  2. Set up starting values for simulation scenarios and (optionally) shock values at particular iterations (e.g. points in forecasted time).

  3. Simulate these scenarios based on the estimated model using the dynsim function.

  4. Plot the simulation results with the dynsimGG function.


For examples please visit http://christophergandrud.github.io/dynsim/.


dynsim is available on CRAN

You can also easily install the latest development version with the devtools package:



Version 1.2.1

  • Minor internal changes to work with ggplot2 2.0.0.

Version 1.2

  • Demo and vignette added.

  • Cleaner scenario builder now allows users to specify fitted values in a multiple row data frame.

Version 1.1

  • Depands on gridExtra >= 2.0.0. This allows users to specify the height of of each graph when shock values are plotted with the shockplot.heights argument.

  • Internal code improvements.

Version 1.0

----- Code Break -----

!!!!No longer relies on Zelig.

  • Solution: Before running dynsim simply estimate model with lm rather than zelig with model = "ls".

  • Fixed effect examples added.

Version 0.2.5

  • Internal improvements.

  • The result of dynsim is now both a data.frame and dynsim object. This enables the user to find easy nongraphical summaries.

Version 0.2.4

  • Warning and error improvements for dynsim.

  • Minor example formatting improvements.

Version 0.2.3

  • Internal: Travis CI added for build checks.

  • Minor documentation improvements.

Version 0.2.2

  • Simplified the syntax for shock plots (shockplot = TRUE is no longer necessary) and decreased the font size.

Version 0.2.1

  • Added a shockplot to dynsimGG. This allows you to include a plot of one shock variable's fitted values below the main prediction plot.

  • num argument added to dynsim allowing the user to specify how many simulations to run at each point in time.

  • Fixed simpler scen objects.

  • Minor documentation fixes.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


1.2.1 by Christopher Gandrud, 4 years ago


Report a bug at https://github.com/christophergandrud/dynsim/issues

Browse source code at https://github.com/cran/dynsim

Authors: Christopher Gandrud [aut, cre] , Laron K. Williams [aut] , Guy D. Whitten [aut]

Documentation:   PDF Manual  

GPL-3 license

Imports ggplot2, grid, gridExtra, MASS

Suggests DataCombine, knitr

See at CRAN