sfcr_multis {sfcr} | R Documentation |
Simulate multiple SFC models at the same time
Description
The sfcr_multis()
function is used to simulate multiple models
at the same time, returning a list of sfcr_tbl
s.
Usage
sfcr_multis(expanded, fixed, periods, ...)
Arguments
expanded |
A |
fixed |
A |
periods |
A number specifying the total number of periods of the model to be simulated. |
... |
Additional arguments to pass to the underlying implementation of the
|
Details
The sfcr_multis()
function takes an expanded
object and
a fixed
to simulate multiple models that will share the content
of fixed
but vary on the expanded
.
This function is a generic, which means that its implementation
depends on the class of the expanded
argument.
The available methods for the sfcr_multis()
function depends
on the expanded
argument. There are three possible methods:
-
sfcr_mlt_set
: When thesfcr_multis()
takes ansfcr_mlt_set
class as the input ofexpanded
, it must take a list of equations of thesfcr_set
class as thefixed
input. This method simulates many baseline models that accept the same set of equations and vary on the external variables supplied with theexpanded
argument. -
sfcr_mlt_shock
: When thesfcr_multis()
takes ansfcr_mlt_shock
class as the input ofexpanded
, it must also take an object ofsfcr_tbl
class as the input offixed
. It will simulate multiple scenario models that takes the same baseline model and diverge on the content of the multiple shocks provided with theexpanded
argument that are applied to it. -
sfcr_mlt
: When thesfcr_multis()
function takes asfcr_mlt
class object as the input of theexpanded
argument, asfcr_shock
object must be supplied with thefixed
argument. This method simulates multiple scenario models that applies the same shock to a varying number of baseline models.
Author(s)
João Macalós
Examples
eqs <- sfcr_set(
TX_s ~ TX_d,
YD ~ W * N_s - TX_s,
C_d ~ alpha1 * YD + alpha2 * H_h[-1],
H_h ~ YD - C_d + H_h[-1],
N_s ~ N_d,
N_d ~ Y / W,
C_s ~ C_d,
G_s ~ G_d,
Y ~ C_s + G_s,
TX_d ~ theta * W * N_s,
H_s ~ G_d - TX_d + H_s[-1]
)
external <- sfcr_set(G_d ~ 20, W ~ 1, alpha1 ~ 0.6, alpha2 ~ 0.4, theta ~ 0.2)
shock <- sfcr_shock(
variables = sfcr_set(
alpha2 ~ 0.3
),
start = 1,
end = 3
)
baseline <- sfcr_baseline(eqs, external, periods = 5)
# Example 1: Many external sets, 1 set of equations:
expanded1 <- sfcr_expand(external, alpha1, c(0.7, 0.8))
multis1 <- sfcr_multis(expanded = expanded1, fixed = eqs, periods = 5)
# Example 2: Many shocks, 1 baseline model:
expanded2 <- sfcr_expand(shock, alpha2, c(0.1, 0.2))
multis2 <- sfcr_multis(expanded = expanded2, fixed = baseline, periods = 5)
# Example 3: Many baseline models, 1 shock:
multis3 <- sfcr_multis(expanded = multis1, fixed = shock, periods = 5)