Skip to contents

This page is a hand-curated cross-reference of the package’s R programs, datasets, data-raw build inputs, vignettes, and the GitHub issues that track them. It is the companion to the home page data-lineage diagrams and the Articles index. Issue numbers link to https://github.com/FanWangEcon/PrjThaiHFID/issues.

All shipped identifiers are anonymized (tmid_*); true household/geographic keys are never committed.

Table 1 — R programs

Exported functions grouped by role, the vignette(s) that call them, the data they help generate, and the data they consume.

R program (function) Vignettes using it Data generated Data used as input
ffp_hfid_loan_non_duplicate invest_loan_bridge, invest_return_bridge tstm_loans_pn_nd (via gateway) tstm_loans_panel
ffp_hfid_hook_pairs invest_loan_bridge tstm_loans_hooks (via gateway) tstm_loans_pn_nd
ffp_hfid_bridge_from_hook invest_loan_bridge tstm_loans_bridges_type (via gateway) tstm_loans_hooks
ffp_hfid_bridge_type invest_loan_bridge tstm_loans_bridges_type (via gateway) bridges from hooks
ffp_hfid_invest_jump invest_loan_bridge, invest_freq_sizes tstm_invest, tstm_invdates_uniq tstm_asset_loan
ffp_hfid_invest_unique_dura invest_loan_bridge tstm_invdates_uniq investment jumps
ffp_hfid_invest_combine invest_loan_bridge tstm_invest investment jumps
ffp_hfid_invest_gateway invest_freq_sizes tstm_invest, tstm_invdates_uniq tstm_asset_loan
ffp_hfid_invest_loan_bridge_roster invest_loan_bridge tstm_roster_invest_loan_linked (via gateway) invest + bridges
ffp_hfid_invest_loan_or_bridge_linker invest_loan_bridge tstm_roster_invest_loan_linked (via gateway) roster
ffp_hfid_invest_loan_linked invest_loan_bridge tstm_roster_invest_loan_linked (via gateway) roster
ffp_hfid_invest_loan_linked_abc_distinct invest_loan_bridge tstm_roster_invest2loan2bridge linked roster
ffp_hfid_invest_loan_linked_abc_bridge_char invest_loan_bridge, invest_return_bridge tstm_roster_invest2loan2bridge linked roster
ffp_hfid_invest_loan_linked_abc_investloan_char invest_loan_bridge, invest_return_bridge tstm_invest2loan2bridge_chars roster + bridge chars
ffp_hfid_invest_loan_linked_abc_investloan_char_gateway invest_loan_bridge, invest_return_bridge, bridge_timing all 8 gateway tstm_* tstm_loans_panel, tstm_asset_loan
ff_hfid_invest_window invest_freq_sizes, invest_return_bridge forward/backward windows tstm_invest, tstm_asset_loan
ff_hfid_invest_winstats invest_freq_sizes, invest_return_bridge tstm_invest_stats_bridgechar (return_bridge) window frames
ffs_hfid_path (support)
ffp_preview_dataset (all, for previews) any packaged dataset
ffp_save_res_table / ffp_save_res_figure (all, output saving) res/res_<topic>/ files (local) tables / ggplot objects

Table 2 — data/ datasets

Each packaged dataset, whether it is a vignette input or output, the program(s) that generate it, and the program(s)/vignettes that consume it.

data/ dataset Vignette role Generated by Used as input by
tstm_loans input (shipped source) loan_terms_dist, loan_terms_dist_comm, loan_overlap, gen_asset_loan
tstm_loans_panel input (shipped source) gateway (invest_loan_bridge, invest_return_bridge, bridge_timing)
tstm_asset_loan output of gen_asset_loan; input downstream gen_asset_loan loan_overlap, invest_freq_sizes, gateway, bridge_timing
tstm_loans_amount output of gen_asset_loan gen_asset_loan (gen_asset_loan internal)
tstm_hh_mthspan output of gen_asset_loan; input downstream gen_asset_loan invest_freq_sizes
tstm_loans_pn_nd gateway output invest_loan_bridge (gateway) gateway internals
tstm_loans_hooks gateway output invest_loan_bridge (gateway) gateway internals
tstm_loans_bridges_type gateway output; input to timing invest_loan_bridge (gateway) bridge_timing
tstm_invdates_uniq gateway output invest_loan_bridge (gateway) gateway internals
tstm_invest gateway output invest_loan_bridge (gateway) gateway internals
tstm_roster_invest_loan_linked gateway output invest_loan_bridge (gateway) gateway internals
tstm_roster_invest2loan2bridge gateway output; input to timing invest_loan_bridge (gateway) bridge_timing
tstm_invest2loan2bridge_chars gateway output invest_loan_bridge (gateway) (terminal characterization)
tstm_invest_stats_bridgechar output of invest_return_bridge invest_return_bridge (paper regressions)

Table 3 — data-raw/ build inputs

Anonymized build inputs used to assemble the packaged datasets. True-key crosswalks (tm_key_id*.rda) stay local and are git-ignored.

data-raw/ file Vignette role Generated by Used as input by
whitem160aggregate_wthhhkey_loanamount.rda (anonymized) input data-raw/id_anonymize/fun_id_anonymize.R gen_asset_loan
tm_key_id_hh_anony.rda input data-raw/id_anonymize/01_build_tm_key_id_hh.R invest_return_bridge
tm_key_id_vil_anony.rda input data-raw/id_anonymize/01b_build_tm_key_id_vil.R (geo crosswalk)
census_vil_hh_structure_count.rda input (anonymized census) invest_return_bridge

Table 4 — Vignettes

Each vignette’s programs, data inputs, and data outputs, with its tracking issue.

Vignette Issue Programs used Data inputs Data outputs
ffv_gen_asset_loan #5 (ports ffs_hfid_gen_a/b_data) whitem...rda, tstm_loans tstm_asset_loan, tstm_loans_amount, tstm_hh_mthspan
ffv_loan_terms_dist #14 tstm_loans tables only
ffv_loan_terms_dist_comm #14 tstm_loans tables only
ffv_loan_overlap #36 tstm_asset_loan figures/tables only
ffv_invest_loan_bridge #32 ..._investloan_char_gateway (+ loan/hook/bridge/invest fns) tstm_loans_panel, tstm_asset_loan 8 gateway tstm_*
ffv_invest_freq_sizes #9 ffp_hfid_invest_gateway, ff_hfid_invest_window, ff_hfid_invest_winstats tstm_hh_mthspan, tstm_asset_loan tables only
ffv_invest_return_bridge #32/#2/#3 gateway, ff_hfid_invest_window, ff_hfid_invest_winstats tstm_loans_panel, tm_key_id_hh_anony.rda, census_vil_hh_structure_count.rda tstm_invest_stats_bridgechar
ffv_bridge_timing #34 gateway tstm_roster_invest2loan2bridge, tstm_loans_bridges_type, tstm_loans_panel, tstm_asset_loan figures only

Table 5 — Issues

GitHub issues and the R programs, data, and vignettes they cover.

Issue R programs Data Vignettes
#5 tstm_asset_loan, tstm_loans_amount, tstm_hh_mthspan ffv_gen_asset_loan
#14 tstm_loans ffv_loan_terms_dist, ffv_loan_terms_dist_comm
#36 tstm_asset_loan ffv_loan_overlap
#32 gateway + loan/hook/bridge/invest fns 8 gateway tstm_* ffv_invest_loan_bridge, ffv_invest_return_bridge
#9 ffp_hfid_invest_gateway, ff_hfid_invest_window/winstats tstm_invest, tstm_hh_mthspan ffv_invest_freq_sizes
#2 ff_hfid_invest_window window frames ffv_invest_return_bridge
#3 ff_hfid_invest_winstats tstm_invest_stats_bridgechar ffv_invest_return_bridge
#34 gateway tstm_roster_invest2loan2bridge, tstm_loans_bridges_type ffv_bridge_timing

Run-order hierarchy

Given the input/output dependencies above, the vignettes form five tiers. A vignette in a tier can only run after its upstream tier has produced the packaged data/ objects it consumes.

flowchart TD
  t1["Tier 1 — ffv_gen_asset_loan (#5)<br/>→ tstm_asset_loan, tstm_loans_amount, tstm_hh_mthspan"]
  t2a["Tier 2 — ffv_loan_terms_dist (#14)"]
  t2b["Tier 2 — ffv_loan_terms_dist_comm (#14)"]
  t2c["Tier 2 — ffv_loan_overlap (#36)"]
  t3["Tier 3 — ffv_invest_loan_bridge (#32)<br/>→ 8 gateway tstm_*"]
  t4a["Tier 4 — ffv_invest_freq_sizes (#9)"]
  t4b["Tier 4 — ffv_invest_return_bridge (#32/#2/#3)<br/>→ tstm_invest_stats_bridgechar"]
  t5["Tier 5 — ffv_bridge_timing (#34)"]
  t1 --> t2a
  t1 --> t2b
  t1 --> t2c
  t1 --> t3
  t1 --> t4a
  t1 --> t4b
  t3 --> t5

Ordered run sequence:

  1. ffv_gen_asset_loan (#5) — builds the base data/ objects.
  2. ffv_loan_terms_dist, ffv_loan_terms_dist_comm, ffv_loan_overlap (#14, #36) — loan descriptives on tstm_loans / tstm_asset_loan.
  3. ffv_invest_loan_bridge (#32) — runs the gateway, producing the 8 gateway datasets.
  4. ffv_invest_freq_sizes (#9) and ffv_invest_return_bridge (#32/#2/#3) — investment analyses (the latter re-runs the gateway inline).
  5. ffv_bridge_timing (#34) — consumes gateway outputs for timing figures.