System of Equations Class
system_of_equations.RdCreate and manipulate a system of equations.
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
Stochastic equations use
~(e.g.y ~ x1 + x2).Identity equations use
==(e.g.y == 0.5*x1 + 0.5*x2).Lagged variables are denoted by
X.L(x)for variableXand lagL(x)(e.g..L(1),.L(2)).Intercept are included by default, you can also explicitly specify the constant by adding
constantto the equation (e.g.y ~ constant + x1). To exclude the intercept, add+0or-1to the equation (e.g.y ~ 0 + x1).
For more details on the equation syntax, see
vignette("equations").
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