| sfcr_expand {sfcr} | R Documentation |
Expand variables to implement sensitivity analysis
Description
The sfcr_expand() function is a s3 generic that takes
a list of external objects and returns a expanded set of these lists.
It has methods for sfcr_set objects and for sfcr_shock objects.
Usage
sfcr_expand(x, variable, values)
Arguments
x |
A external set created with |
variable |
the name of variable to be expanded. |
values |
a vector containing the new values of the external or shock variable. |
Details
There are two available methods for the sfcr_expand() function:
-
sfcr_set: Takes asfcr_setobject with external variables and creates a list of sets that inherits all the aspects of thexset supplied but set the values of thevariableto the each element ofvalue. The output is asfcr_mlt_setobject. -
sfcr_shock: Takes asfcr_shockobject and creates a list of shocks that inherits all the aspects of thexshock but set thevaluesof thevariableto each element ofvalue. The output of this method is asfcr_mlt_shockobject.
Author(s)
João Macalós
Examples
# 1. Expand a external set:
external <- sfcr_set(G_d ~ 20, W ~ 1, alpha1 ~ 0.6, alpha2 ~ 0.4, theta ~ 0.2)
sfcr_expand(external, alpha2, c(0.1, 0.2))
# 2. Expand a shock:
shock <- sfcr_shock(variables = sfcr_set(alpha1 ~ 0.8), start = 5, end = 50)
sfcr_expand(shock, alpha1, c(0.7, 0.8, 0.9))