sfcr0.2.3 package

Simulate Stock-Flow Consistent Models

abortifnot

Abort if not

dot-abort_if_dup

Abort if duplicated variables

dot-abort_typo_code

Abort if typo on the codes of columns

dot-abort_water_leakc

Abort if column validation is not fulfilled

dot-abort_water_leakr

Abort if row validation is not fulfilled

dot-add_time_stamps

Find dependencies and order the equations

dot-add_time2

Find dependencies and order the equations

dot-all_equal

Check if all values in x are equal

dot-args_to_row

Take arguments and make them a row of a tibble

dot-broyden_solver

Broyden solver algorithm

dot-check_external_consistency

Check shocks for length consistency and warn about risks of using exog...

dot-check_shock_consistency

Check shocks for length consistency and warn about risks of using exog...

dot-check_symmetry

Check that symmetry condition is valid and fulfill missing entries

dot-eq_as_tb

Split the formulae into a tibble with the left-hand side and right-h...

dot-extend_baseline_matrix

Extend a baseline matrix

dot-fill_rows_and_cols

Fill all possible rows and columns and validate

dot-find_blocks

Find blocks of independent equations (wrapper around igraph function...

dot-find_names

Find names for display matrix

dot-get_matrix

Get numeric matrix for evaluation from balance-sheet or transactions-f...

dot-is_equal

Check if two values are equal

dot-make_matrix

Make the underlying matrix that will be modified in place by the solve...

dot-prep_broyden

Prep equations for Broyden and Newton solvers

dot-prep_equations

Re-wrote the equations with the correct matrix syntax that will be use...

dot-pvar

Pattern replacement var

dot-pvarlag

Pattern replacement lag

dot-return_loops

Find cyclical nodes

dot-scan_cols

Scan columns to fill whenever there's only one value missing.

dot-scan_rows

Scan rows to fill whenever there's only one value missing.

dot-sfcr_broyden

Broyden solver wrapper

dot-sfcr_eqs_check

Check for missing endogenous variables

dot-sfcr_find_adjacency

Find adjacency matrix for a system of equations

dot-sfcr_find_order

Place the equations in the correct order for estimation

dot-sfcr_gauss_seidel

Gauss Seidel algorithm

dot-sfcr_make_scenario_matrix

Make matrix for scenario calculations

dot-sfcr_newton

Newton-Raphson solver implemented with rootSolve::multiroot()

dot-to_latex_style

Transform entries into latex style

dot-validate_matrix

Validate a balance-sheet or transactions-flow matrix on the simulated ...

dot-validate_scan

Check that the portfolio matrix respect the horizontal and vertical ad...

new_sfcr_mlt_set

sfcr_mlt_set constructor

new_sfcr_mlt_shock

sfcr_mlt_shock constructor

new_sfcr_mlt

sfcr_mlt constructor

new_sfcr_set

sfcr_set constructor

new_sfcr_tbl

new_sfcr_tbl constructor

pipe

Pipe operator

sfcr_baseline

Simulate the baseline scenario of a stock-flow consistent model

sfcr_dag_blocks_plot

Plot the DAG with blocks and cycles information

sfcr_dag_blocks

Create a tbl_graph object blocks and cycles information

sfcr_dag_cycles_plot

Plot the DAG with cycles information

sfcr_dag_cycles

Create a tbl_graph object with cycles information

sfcr_expand

Expand variables to implement sensitivity analysis

sfcr_get_blocks

Get block structure of a sfcr_tbl object

sfcr_get_matrix

Get Matrix form of sfcr_tbl object

sfcr_matrix_display

Print matrix to screen

sfcr_matrix

Create balance-sheet or transactions-flow matrices

sfcr_multis

Simulate multiple SFC models at the same time

sfcr_portfolio

Find a valid matrix of portfolio parameters

sfcr_random

Generate random sequences inside sfcr_set()

sfcr_sankey

Plot Sankey's diagram representation of transactions-flow matrix

sfcr_scenario

Add scenarios to a sfcr model.

sfcr_set_index

Get names of endogenous vars and their index

sfcr_set

Define the formulas of the model

sfcr_shock

Create shock(s) to add to a sfcr_scenario().

sfcr_validate

Validate a transactions-flow or balance-sheet matrix

Routines to write, simulate, and validate stock-flow consistent (SFC) models. The accounting structure of SFC models are described in Godley and Lavoie (2007, ISBN:978-1-137-08599-3). The algorithms implemented to solve the models (Gauss-Seidel and Broyden) are described in Kinsella and O'Shea (2010) <doi:10.2139/ssrn.1729205> and Peressini and Sullivan (1988, ISBN:0-387-96614-5).

  • Maintainer: Joao Macalos
  • License: MIT + file LICENSE
  • Last published: 2025-10-09