simulate.qpm_solution: Simulate a solved model

View source: R/simulate.R

simulate.qpm_solutionR Documentation

Simulate a solved model

Description

Draws Gaussian shocks with the model's standard deviations and iterates the solved transition. Returns variables in levels (steady state plus simulated deviations). The final full state is stored as an attribute so a simulation can be handed straight to qpm_forecast().

Usage

## S3 method for class 'qpm_solution'
simulate(object, nsim = 40, seed = NULL, sigma = NULL, burn = 0, ...)

Arguments

object

A qpm_solution.

nsim

Number of quarters to simulate.

seed

Optional seed for reproducibility. The previous RNG state is restored on exit.

sigma

Optional named vector of shock standard deviations overriding the model's.

burn

Burn-in quarters discarded from the start.

...

Unused.

Value

A data frame of class qpm_sim (period plus one column per declared variable), with attributes state (final expanded state, deviations) and shocks (the drawn shocks).

Examples

sol <- qpm_solve(qpm_template("bkl"))
hist <- simulate(sol, nsim = 60, seed = 42, burn = 20)
head(hist)

qpmR documentation built on Sept. 29, 2026, 5:10 p.m.