- For: Micro models with 7 +-2 observation (`obs_stock`) parameterized with 5+-1 `est_param` on the hyperplane of assumed parameter. [This notebook](https://github.com/hyunjimoon/pysd/blob/stan-backend/test_scripts/demand_supply.ipynb) file includes a table that sets user-program interface. Assumed parameter is _specification by projecting_ while estimated parameter is _specification by regularizing_. | Step | Goal | Program, work, `command` (P-rows have `.function(input)`) | User's work | output format | | ---- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- | | U1 | Draft | `Vensim` assists U1.a() | a. Translate mental model to SD model | `.mdl` | | U2 | Classify | `PySD` assists U2.a() | a. Classify parameters `est_param`, `ass_param`, b. Select `obs_state` among stocks | `.json` | | P1 | relate | `PySD`, `.build_function_block`(U1.a) | | `relation.stan` | | U3 | Specify_project | | a. Supply value or series of `assmed_param`, b. Choose `family`(:= dist. of `msr_err_scale`) | `draws2data.stan` gq block, `data2draws.stan` model, gq block | | U4 | Specify_regularize | | a. Set {min, mode, max} of `est_param`'s prior param (optional) b. Choose `prior_family`(default: PERT Normal) | `draws2data.stan` gq block, `data2draws.stan` model, gq block | | P2 | predict | `draws2data.stan`, `fit_prior_data.sample()`, `fit_prior_data = (U2.ab, U3.ab, U4.ab)`: Prior predictive check (opt-out prior) | | | | P3 | infer to verify | `Stan`, `data2draws.stan`,`.create_stan_program`(U2.ab, U3.ab): Infer parameter from (synthetic) data: SBC | | Prior predictive check plot (summary stats.) | | U5 | Specify_tolerance | | a. Set precision with `iter_sampling` (:= # of samples), b. Select posterior approximator | $\gamma$ from SBC-graphics | | P4 | infer to validate | `Stan`, `fit_post_draws.sample()`, ` fit_post_draws = (P1, U3.ab, U4.ab, U5.ab)`: Posterior predictive check (opt-in prior) | | Posterior predictive check plot | - Key: More analyitic approach of the following compared to [[Flow2 (Method 3)]] - Basis function space construction e.g. Hierarchical Bayesian - Simulation-based Calibration - Prior specification (= regularization) - Optimization algorithm design is less emphasized compared to [[Flow2 (Method 3)]] as takes less than 10 mins to sample with `_draws2data.stan`. However, due to frustrating posterior geometry from Hierarchical Bayesian, parameterization (scale separation, auto-CP-NCP, invariant flow) and funnel-avoiding tricks are popular research topics. [[Hierarchical prior]] contains tips for setting prior for designing hierarchical model that converges (it probaby wouldn't in your first attempt).