9 Uniform shocks
9.1 Overview
ems_uniform_shock() applies a homogeneous percentage change over an entire variable or a subset of its elements. The set arguments accepted in ... depend on the variable specified and the set mappings loaded in ems_data().
ems_uniform_shock(var, value, ...)| Argument | Type | Description |
|---|---|---|
var |
Character | Variable name as it appears in the model file |
value |
Numeric | Percentage change applied to all targeted elements |
... |
Named arguments | Set-index pairs for partial variable shocks (see Partial variable uniform shocks) |
9.2 Full variable uniform shocks
The most simple uniform shock is applied to a full variable, meaning that all combinations of sets associated with that variable are allocated the same exogenous value. In the example below all regions (as determined by selected region mappings) will by increased by 1%.
pop_shk <- ems_uniform_shock(var = "pop",
value = 1
)Here is an example of the usage above. Numeraire shocks (in static models) can be carried out using a uniform shock:
pfact_shk <- ems_uniform_shock(var = "pfactwld",
value = 1
)9.3 Partial variable uniform shocks
As with the syntax regarding swaps (link), the scope of a uniform shock may be determined by specifying elements within the sets associated with the shocked variable. For example, if we have a region “chn” and wish to allocate a shock specifically to this region:
partial <- ems_uniform_shock(var = "aoall",
REGr = "chn",
value = -1
)Here is an example of a partial variable swap followed by a partial variable uniform shock. If a full swap is followed by a partial variable shock (example), the unshocked elements will remain at 0.
In the case of intertemporal models, the shock year may be specified using a chronological or timestep format (see “Time step summary” output from ems_data()).
partial <- ems_uniform_shock(
var = "aoall",
REGr = "chn",
PROD_COMMj = "crops",
Year = 2017,
value = -1
)Here is a full example using chronological formats and a uniform shock.
Note that sets specified in this manner are identified by the model-specific concatenation of the standard set name plus the variable-specific index. Also note that exogenous components of a variable not allocated a shock (all other regions except “chn”) will not vary.
9.4 Multiple shocks and mixed swaps
Multiple uniform shocks of different scope can be combined in a list and passed to ems_deploy(). Swaps can also be mixed, combining partial ems_swap() objects with full variable strings:
partial <- ems_uniform_shock(
var = "qfd",
REGs = "usa",
PROD_COMMj = "crops",
value = -1
)
full <- ems_uniform_shock(
var = "yp",
value = 0.1
)
qfd <- ems_swap(
var = "qfd",
REGs = "usa",
PROD_COMMj = "crops"
)
tfd <- ems_swap(
var = "tfd",
REGr = "usa",
PROD_COMMj = "crops"
)
cmf_path <- ems_deploy(
.data = .data,
model = model,
shock = list(partial, full),
swap_in = list(qfd, "yp"),
swap_out = list(tfd, "dppriv")
)