Description Usage Arguments Details Author(s) Examples
The sfcr_set()
function is used to create the lists of equations,
external variables, initial values, and also to modify the variables inside
the sfcr_shock()
function.
1 |
... |
The formulas used to define the equations and external values of the system |
exclude |
One or more indices of equations to be excluded. The
correct indices can be found with |
This function is a S3 generic that applicable to only two inputs: formula
and
sfcr_set
. It is used to create a new set of equations or to modify an existing
one.
Therefore, the equations must be written using the R formula syntax, i.e., the left-hand
side of each equation is separated from the right-hand side with a ~
("twiddle")
instead of a =
.
Furthermore, the sfcr_set()
function recognizes two symbols that are not
native to R language: [-1]
, and d()
.
If a variable defined with sfcr_set()
is followed by [-1]
, it will
be recognized as a lagged variable.
If a variable is defined inside d()
, the sfcr
engines will transform
them into a first difference equation. For example, d(Hh)
is internally transformed
into (Hh - Hh[-1])
.
Random variables can be created using the sfcr_random()
function. See
sfcr_random
for further details.
João Macalós
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # Endogenous set
equations <- sfcr_set(
TXs ~ TXd,
YD ~ W * Ns - TXs,
Cd ~ alpha1 * YD + alpha2 * Hh[-1],
Hh ~ YD - Cd + Hh[-1],
Ns ~ Nd,
Nd ~ Y / W,
Cs ~ Cd,
Gs ~ Gd,
Y ~ Cs + Gs,
TXd ~ theta * W * Ns,
Hs ~ Gd - TXd + Hs[-1]
)
# Exogenous set
exogenous <- sfcr_set(alpha1 ~ 0.8, alpha2 ~ 0.15)
# Modify an existing set
equations2 <- sfcr_set(equations, Hh ~ Hh[-1] + d(Hs), exclude = 4)
# Add normal random variable
sfcr_set(Ra ~ sfcr_random("rnorm", mean=10, sd=2))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.