Equation Syntax Reference
equations.Rmd
Overview
This vignette describes the syntax for specifying stochastic and
identity equations, priors, and lags in the koma
package.
1. Stochastic Equations
Stochastic (regression) equations model a dependent variable with an error term. An intercept is included by default.
# With default intercept:
consumption ~ gdp + consumption.L(1)
# Without intercept:
consumption ~ gdp + consumption.L(1) - 1
# Explicit intercept:
consumption ~ 1 + gdp + consumption.L(1)
2. Identity Equations
Identity equations enforce exact relationships.
# Identity equations with explicitly defined weights:
# To aggregate the component growth rates into a growth rate for GDP we need to define weights.
# This is done by specifying the weights in the equation.
# You can, e.g. use the nominal level weights of the last observed period.
gdp == 0.7*consumption + 0.2*investment + 0.2*government - 0.1*net_exports
3. Injected Parameters & Constants
Known constants or parameters can be inserted via ()
in
any equation.
# Injected parameter s:
gdp == (s) * cons
# Ratios computed from data:
gdp == (nom_cons/nom_gdp) * cons
4. Lag Notation
Lags are specified with L()
or lag()
notation. Ranges and combinations are supported.