Skip to contents

Create and manipulate a system of equations.

Usage

system_of_equations(equations = vector(), exogenous_variables = vector(), ...)

Arguments

equations

A character string or vector containing the system of equations. If a single string, equations should be separated by commas.

exogenous_variables

A character vector of exogenous variables.

...

Additional arguments for future extensions.

Value

An object of class koma_seq with the following components:

  • equations: A character vector of the equations.

  • endogenous_variables: A character vector of endogenous variables.

  • stochastic_equations: A character vector of stochastic equations.

  • identities: A character vector of identity equations.

  • character_gamma_matrix: A gamma matrix in character form.

  • character_beta_matrix: A beta matrix in character form.

  • predetermined_variables: A character vector of lagged variables.

  • total_exogenous_variables: A character vector of combined constant, predetermined, and exogenous variables.

  • priors: A list of priors per equation.

Details

This function constructs an object of class koma_seq representing a system of equations, extracting and organizing key components like endogenous variables, gamma matrix, beta matrix, and more. Equations should be separated by commas if provided as a single string.

Equations

  • "epsilon" flags stochastic equations; equations without "epsilon" are treated as identity equations.

  • Lagged variables are denoted by X.L(x) for variable X and lag L(x) (e.g. .L(1), .L(2)).

  • To add an intercept, include "constant" in the equation.

Examples

equations <-
  "consumption ~ gdp + consumption.L(1) + consumption.L(2),
investment ~ gdp + investment.L(1) + real_interest_rate,
current_account ~ current_account.L(1) + world_gdp,
manufacturing ~ manufacturing.L(1) + world_gdp,
service ~ service.L(1) + population + gdp,
gdp == 0.4*manufacturing + 0.6*service"

exogenous_variables <- c("real_interest_rate", "world_gdp", "population")

system <- system_of_equations(equations, exogenous_variables)
print(system)
#> 
#> ── System of Equations ─────────────────────────────────────────────────────────
#>     consumption ~  constant + gdp + consumption.L(1) + consumption.L(2)
#>      investment ~  constant + gdp + investment.L(1) + real_interest_rate
#> current_account ~  constant + current_account.L(1) + world_gdp
#>   manufacturing ~  constant + manufacturing.L(1) + world_gdp
#>         service ~  constant + service.L(1) + population + gdp
#>             gdp == 0.4 * manufacturing + 0.6 * service