Skip to content

Alpha Release | Iteration 3

Pre-release
Pre-release

Choose a tag to compare

@GongJr0 GongJr0 released this 20 Jan 01:16
· 1684 commits to main since this release
3db3817

Correlated Shock logic, Shock Processing, Extended Multivariate Shock infrastructure

This release iteration has a heavy focus on shock specifications and the much-needed multivariate distribution support.

Changes

  • Introduced spec notation for multivariate shock arrays:
# Two uncorrelated shocks (2 univariate generators)
spec1 = {'g': shock_gen(...), 'z': shock_gen(...)}

# Two correlated shocks, one multi-var generator. Cov matrix built at sim-time
spec2 = {'g,z': shock_gen(...)}

# Spec1: expects {"sig_g, sig_z"} available in calibration config.
# Spec2: expects {"sig_g, "sig_z", "rho_gz" | "rho_zg"} available in calibration config.
  • Reformatted the multivariate distributions to accept a cov parameter for an $(n\times n)$ covariance matrix (distributions used to compute the matrix from supplied model parameters)
  • Added _build_cov to SolvedModel to offload the matrix computations
  • Multivar distributions don't need/use a special generator signature. abstract_shock_array has beed restored as the true abstraction parent of all built-in shock generation due to multivar and univar shocks sharing signatures.
  • Added _shock_unpack to SolvedModel to parse and identify shock structure from specification input. _shock_unpack is now the owner of all shock construction processes, returning a (idx, shock_arr) to the sim method.
  • Introduced SymbolGetterDict; an extension on native dictionaries now used in the config. Allows using string varnames to index symbolic keys. (mySGD["var1"] == mySGD[sp.Symbol("var1")]). This lets users avoid converting config names to symbols in notebooks, etc. as long as they don't need the symbolic representations.