Skip to contents

A block is a documented, reusable bundle of variables, shocks, parameters and equations that adapts a template to a country. Blocks are how a technical-assistance engagement customizes the canonical model without forking it: add_block() applies one, qpm_diff() shows exactly what changed, and the result is an ordinary qpm_model.

Usage

qpm_block(
  name,
  variables = NULL,
  shocks = NULL,
  params = list(),
  sigma = NULL,
  equations = NULL,
  description = ""
)

Arguments

name

Block name, used in printing and in the model's history.

variables

New variables, from vars() (optional).

shocks

New shocks, from shocks() (optional).

params

Named list of new parameters (optional).

sigma

Named vector of standard deviations for the new shocks (optional; default 1).

equations

Equations, from eqs(): replacements for existing variables and definitions for new ones.

description

One-line description of what the block does.

Value

An object of class qpm_block.

Details

Equations whose left-hand side names a variable that already exists replace that variable's equation; equations for newly declared variables are appended. Left-hand sides must be bare variable names.

Examples

b <- qpm_block(
  name = "risk premium shifter",
  params = list(prem_extra = 0),
  equations = eqs(prem ~ rho_prem * prem[-1] +
                    (1 - rho_prem) * (prem_ss + prem_extra) + eps_prem)
)
m <- add_block(qpm_template("bkl"), b)