sfcr_matrix: Create balance-sheet or transactions-flow matrices

Description Usage Arguments Note Author(s) Examples

View source: R/sfcr_matrix.R

Description

Create balance-sheet or transactions-flow matrices

Usage

1
sfcr_matrix(columns, codes, ...)

Arguments

columns

Vector containing the name of the columns in the matrix.

codes

A vector containing the abbreviation of the column names that is going to be used as a reference to build the rows. They must be provided in the same order as the columns.

...

Vectors that fill the rows of the matrix. The first element of each vector must be the name of the row in the respective matrix. The remaining elements of the vector must be name-value pairs that exactly matches the codes argument. See the examples for further details.

Note

This function can be used to generate a transactions- flow matrix as well as a balance-sheet matrix. If the user wishes to validate these matrices with the simulated data, please pay attention to the following details:

Author(s)

João Macalós, joaomacalos@gmail.com

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Balance-sheet matrix

bs_pc <- sfcr_matrix(
  columns = c("Households", "Firms", "Government", "Central bank", "sum"),
  codes = c("h", "f", "g", "cb", "s"),
  r1 = c("Money", h = "+Hh", cb = "-Hs"),
  r2 = c("Bills", h = "+Bh", g = "-Bs", cb = "+Bcb"),
  r3 = c("Balance", h = "-V", g = "+V")
)


# Transactions-flow matrix
tfm_pc <- sfcr_matrix(
  columns = c("Households", "Firms", "Government", "CB current", "CB capital"),
  codes = c("h", "f", "g", "cbc", "cbk"),
  c("Consumption", h = "-C", f = "+C"),
  c("Govt. Expenditures", f = "+G", g = "-G"),
  c("Income", h = "+Y", f = "-Y"),
  c("Int. payments", h = "+r[-1] * Bh[-1]", g = "-r[-1] * Bs[-1]", cbc = "+r[-1] * Bcb[-1]"),
  c("CB profits", g = "+r[-1] * Bcb[-1]", cbc = "-r[-1] * Bcb[-1]"),
  c("Taxes", h = "-TX", g = "+TX"),
  c("Ch. Money", h = "-(Hh - Hh[-1])", cbk = "+(Hs - Hs[-1])"),
  c("Ch. Bills", h = "-(Bh - Bh[-1])", g = "+(Bs - Bs[-1])", cbk = "-(Bcb - Bcb[-1])")
)

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