sfcr_set: Define the formulas of the model

Description Usage Arguments Details Author(s) Examples

View source: R/sfcr_set.R

Description

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.

Usage

1
sfcr_set(..., exclude = NULL)

Arguments

...

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 sfcr_set_index().

Details

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().

Random variables can be created using the sfcr_random() function. See sfcr_random for further details.

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
# 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))

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