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.
sfcr_set(..., exclude = NULL)
| ... | 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
# 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))#> [[1]] #> Ra ~ sfcr_random("rnorm", mean = 10, sd = 2) #> <environment: 0xfb4a720> #> #> attr(,"class") #> [1] "sfcr_set" "list"