sfcr_multis: Simulate multiple SFC models at the same time

Description Usage Arguments Details Author(s) Examples

View source: R/sfcr_multis.R

Description

The sfcr_multis() function is used to simulate multiple models at the same time, returning a list of sfcr_tbls.

Usage

1
sfcr_multis(expanded, fixed, periods, ...)

Arguments

expanded

A sfcr_mlt_set, sfcr_mlt_shock, or a sfcr_mlt object.

fixed

A sfcr_set, sfcr_tbl, or sfcr_shock object.

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 sfcr_baseline() or sfcr_scenario() functions.

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:

Author(s)

João Macalós

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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)

sfcr documentation built on Oct. 11, 2021, 9:09 a.m.