At the investment level, categorize investments-loan and bridge relationship. Key categorical groupings loans with and without loan linkages and with and without hooked and bridged loan linkages. Also the relative sizes of investment, loan set A loans, loan set B loans, and loan set C loans.
Format
Investment-level file with investment-loan characteristics, linkage type and relative size
- hhid_Num
Household ID
- ivars
Capital-asset variable for finding investment jumps
- hh_inv_asset_ctr
Unique household + capital-asset investment counter
- il1_lgt
Define loan set A, contains informal only, formal only, or joint informal and formal.
mutate(il1_lgt = case_when(bl_m1t2_formal_avg == 0 ~ "s-inf", bl_m1t2_formal_avg == 1 ~ "s-for", (bl_m1t2_formal_avg > 0 & bl_m1t2_formal_avg < 1) ~ "s-fij", TRUE ~ NA))- il2_lgt
Define loan set B, contains informal only, formal only, or joint informal and formal.
mutate(il2_lgt = case_when(bl_p1t2_formal_avg == 0 ~ "s-inf", bl_p1t2_formal_avg == 1 ~ "s-for", (bl_p1t2_formal_avg > 0 & bl_p1t2_formal_avg < 1) ~ "s-fij", TRUE ~ NA))- il3_lgt
Define loan set C, contains informal only, formal only, or joint informal and formal.
mutate(il3_lgt = case_when(bl_p2t3_formal_avg == 0 ~ "s-inf", bl_p2t3_formal_avg == 1 ~ "s-for", (bl_p2t3_formal_avg > 0 & bl_p2t3_formal_avg < 1) ~ "s-fij", TRUE ~ NA))- ih1_lgt
Define loan set A + B joint structure, contains informal only, formal only, or joint informal and formal in A and B, or combinations of formal and informal in A and B.
mutate(ih1_lgt = case_when(bl_jnt_m1t2_p1t2_informal_avg == 1 ~ "h-inf", bl_jnt_m1t2_p1t2_formal_avg == 1 ~ "h-for", (bl_jnt_m1t2_p1t2_informal_avg == 0 & bl_jnt_m1t2_p1t2_formal_avg == 0) ~ "h-fij", ((bl_jnt_m1t2_p1t2_informal_avg > 0 & bl_jnt_m1t2_p1t2_informal_avg < 1) | (bl_jnt_m1t2_p1t2_formal_avg > 0 & bl_jnt_m1t2_p1t2_formal_avg < 1)) ~ "h-mfij", TRUE ~ NA))- ih2_lgt
Define loan set B +CB joint structure, contains informal only, formal only, or joint informal and formal in B and C, or combinations of formal and informal in B and C.
mutate(ih2_lgt = case_when(bl_jnt_p1t2_p2t3_informal_avg == 1 ~ "h-inf", bl_jnt_p1t2_p2t3_formal_avg == 1 ~ "h-for", (bl_jnt_p1t2_p2t3_informal_avg == 0 & bl_jnt_p1t2_p2t3_formal_avg == 0) ~ "h-fij", ((bl_jnt_p1t2_p2t3_informal_avg > 0 & bl_jnt_p1t2_p2t3_informal_avg < 1) | (bl_jnt_p1t2_p2t3_formal_avg > 0 & bl_jnt_p1t2_p2t3_formal_avg < 1)) ~ "h-mfij", TRUE ~ NA))- bl_ibr_single
BRIDGE-CATEGORY: Key bridge labeling variable, all components of A, B, and C elements of bridge from a single lender, boolean:
mutate(bl_ibr_single = case_when((bl_bri_only_baac_mean == 1) | (bl_bri_only_vilfund_mean == 1) | (bl_bri_only_quasi_mean == 1) | (bl_bri_only_informal_mean == 1) ~ TRUE, TRUE ~ FALSE))- st_ibr_single
BRIDGE-CATEGORY: Key bridge labeling variable, all components of A, B, and C elements of bridge from a single lender, string which lender:
mutate(st_ibr_single = case_when(bl_bri_only_baac_mean == 1 ~ "BAAC-Commercial", bl_bri_only_vilfund_mean == 1 ~ "Village-Fund", bl_bri_only_quasi_mean == 1 ~ "Quasi-formal", bl_bri_only_informal_mean == 1 ~ "Informal", TRUE ~ NA))- st_ibr_joint
BRIDGE-CATEGORY: Key bridge labeling variable, bridge structure from multiple lenders, formal lenders only, informal lenders only, formal and informal jointly, etc.
mutate(st_ibr_joint = case_when((bl_bri_has_baac_mean > 0) & (bl_bri_has_vilfund_mean > 0) & (bl_bri_has_quasi_mean == 0) & (bl_bri_has_informal_mean == 0) ~ "BAACComm-VilFund", (bl_bri_has_baac_mean == 0) & (bl_bri_has_vilfund_mean == 0) & (bl_bri_has_quasi_mean > 0) & (bl_bri_has_informal_mean > 0) ~ "Informal-Quasiformal", ((bl_bri_has_baac_mean > 0) | (bl_bri_has_vilfund_mean > 0)) & ((bl_bri_has_quasi_mean == 0) & (bl_bri_has_informal_mean > 0)) ~ "BAACorVilFUnd-Informal", ((bl_bri_has_baac_mean > 0) | (bl_bri_has_vilfund_mean > 0)) & ((bl_bri_has_quasi_mean > 0) & (bl_bri_has_informal_mean == 0)) ~ "BAACorVilFUnd-Qusiformal", ((bl_bri_has_baac_mean > 0) | (bl_bri_has_vilfund_mean > 0)) & ((bl_bri_has_quasi_mean > 0) & (bl_bri_has_informal_mean > 0)) ~ "BAACorVilFUnd-InfAndQuasiFor", ((bl_bri_has_baac_mean > 0) | (bl_bri_has_vilfund_mean > 0) | (bl_bri_has_quasi_mean > 0) | (bl_bri_has_informal_mean > 0)) ~ "Other-combo", TRUE ~ NA))- st_ibr_has_informal_bridge
BRIDGE-CATEGORY: Key bridge labeling variable, formal and informal joint bridge, if there is a linkage between one A, one B, and one C loans that contains informal in the middle B component, or informal anywhere:
mutate(st_ibr_has_informal_bridge = case_when(bl_bridge_informal_mean > 0 ~ "has-informal-bridge", ((bl_bri_has_quasi_mean > 0) | (bl_bri_has_informal_mean > 0)) ~ "has-informal-in-bridge", st_ibr_joint == "Informal-Quasiformal" ~ NA, TRUE ~ NA))- investloan_type_m4
INVESTMENT-LOAN-CATEGORY: Four types, no loan, single, hooked, and bridged:
mutate(investloan_type_m4 = case_when( is.na(hlin_m12_avg) & is.na(hlin_p12_avg) & is.na(hlin_p23_avg) ~ "1-investment-no-loan", !is.na(hlin_m12_avg) & is.na(hlin_p12_avg) & is.na(hlin_p23_avg) ~ "2-investment-loan-a", !is.na(hlin_m12_avg) & !is.na(hlin_p12_avg) & is.na(hlin_p23_avg) ~ "3-investment-loan-hook", !is.na(hlin_m12_avg) & !is.na(hlin_p12_avg) & !is.na(hlin_p23_avg) ~ "4-investment-loan-bridge", TRUE ~ "Should not be possible"))- investloan_type_brg_m5
INVESTMENT-LOAN-CATEGORY: Five types of bridges, single lender, formal combo, informal combo, joint formal informal with informal in set B of bridge, joint formal informal with informal in A or C of bridge:
mutate(investloan_type_brg_m5 = case_when( (!is.na(hlin_m12_avg) & !is.na(hlin_p12_avg) & !is.na(hlin_p23_avg)) & bl_ibr_single ~ "1-brg-single-lender", (!is.na(hlin_m12_avg) & !is.na(hlin_p12_avg) & !is.na(hlin_p23_avg)) & (st_ibr_joint == "BAACComm-VilFund") ~ "2-brg-baac-vilfund-combo", (!is.na(hlin_m12_avg) & !is.na(hlin_p12_avg) & !is.na(hlin_p23_avg)) & (st_ibr_joint == "Informal-Quasiformal") ~ "3-brg-informal-quasifor-combo", (!is.na(hlin_m12_avg) & !is.na(hlin_p12_avg) & !is.na(hlin_p23_avg)) & (st_ibr_has_informal_bridge == "has-informal-bridge") ~ "4-brg-has-informal-bridge", (!is.na(hlin_m12_avg) & !is.na(hlin_p12_avg) & !is.na(hlin_p23_avg)) & (st_ibr_has_informal_bridge == "has-informal-in-bridge") ~ "5-brg-has-informal-in-bridge", TRUE ~ "Not triply-bridged"))- investloan_type_m8
INVESTMENT-LOAN-CATEGORY: Eight types three non-bridge types from
investloan_type_m4and five bridge types frominvestloan_type_brg_m5:mutate(investloan_type_m8 = case_when( is.na(hlin_m12_avg) & is.na(hlin_p12_avg) & is.na(hlin_p23_avg) ~ "1-investment-no-loan", !is.na(hlin_m12_avg) & is.na(hlin_p12_avg) & is.na(hlin_p23_avg) ~ "2-investment-loan-a", !is.na(hlin_m12_avg) & !is.na(hlin_p12_avg) & is.na(hlin_p23_avg) ~ "3-investment-loan-hook", (!is.na(hlin_m12_avg) & !is.na(hlin_p12_avg) & !is.na(hlin_p23_avg)) & bl_ibr_single ~ "4-brg-single-lender", (!is.na(hlin_m12_avg) & !is.na(hlin_p12_avg) & !is.na(hlin_p23_avg)) & (st_ibr_joint == "BAACComm-VilFund") ~ "5-brg-baac-vilfund-combo", (!is.na(hlin_m12_avg) & !is.na(hlin_p12_avg) & !is.na(hlin_p23_avg)) & (st_ibr_joint == "Informal-Quasiformal") ~ "6-brg-informal-quasifor-combo", (!is.na(hlin_m12_avg) & !is.na(hlin_p12_avg) & !is.na(hlin_p23_avg)) & (st_ibr_has_informal_bridge == "has-informal-bridge") ~ "7-brg-has-informal-bridge", (!is.na(hlin_m12_avg) & !is.na(hlin_p12_avg) & !is.na(hlin_p23_avg)) & (st_ibr_has_informal_bridge == "has-informal-in-bridge") ~ "8-brg-has-informal-in-bridge", TRUE ~ "Not triply-bridged"))- investloan_type_hook_m4
INVESTMENT-LOAN-CATEGORY: Set A and B hook characteristics or not hooked:
mutate(investloan_type_hook_m4 = case_when( (!is.na(hlin_m12_avg) & !is.na(hlin_p12_avg) & is.na(hlin_p23_avg)) & !is.na(ih1_lgt) ~ ih1_lgt, (!is.na(hlin_m12_avg) & !is.na(hlin_p12_avg) & is.na(hlin_p23_avg)) & is.na(ih1_lgt) ~ "hook-unclassified", TRUE ~ "Not hooked"))- investloan_type_seta_m3
INVESTMENT-LOAN-CATEGORY: Set A loan characteristics or no single loan:
mutate(investloan_type_seta_m3 = case_when( (!is.na(hlin_m12_avg) & is.na(hlin_p12_avg) & is.na(hlin_p23_avg)) & !is.na(il1_lgt) ~ il1_lgt, (!is.na(hlin_m12_avg) & is.na(hlin_p12_avg) & is.na(hlin_p23_avg)) & is.na(il1_lgt) ~ "invest-singleloan-unclassified", TRUE ~ "Not single-loan"))- capital_prior
Capital-asset level prior to investment
- capital_end
Capital-asset level after investment
- capital_invest
Level of investment, difference of end and prior
- loan_principal_sum
Sum of loan principals for set A loans:
loan_principal_sum = sum(loan_principal, rm.na=TRUE)- loan_principal_last_sum
Sum of loan principals still owed in the last month prior to the final repayment/due date of each set A loan:
loan_principal_last_sum = sum(loan_principal_last, rm.na=TRUE)- r_group_weighted
Weighted interest rate of all set A loans, weighted by loan size times duration:
mutate( r_weight_i = loan_principal*(loan_end - loan_start + 1), r_weight_total = sum(r_weight_i), r_group_weighted = sum( loan_interest_monthly*(r_weight_i/r_weight_total)))- loan_principal_paired_1t2_sum
Sum of loan principals for set B loans:
loan_principal_paired_1t2_sum = sum(loan_principal_paired_1t2, rm.na=TRUE)- loan_principal_last_paired_1t2_sum
Weighted interest rate of all set B loans, weighted by loan size times duration:
loan_principal_last_paired_1t2_sum = sum(loan_principal_last_paired_1t2, rm.na=TRUE)- loan_principal_paired_2t3_sum
Sum of loan principals for set C loans:
loan_principal_paired_2t3_sum = sum(loan_principal_paired_2t3, rm.na=TRUE)- loan_principal_last_paired_2t3_sum
Weighted interest rate of all set C loans, weighted by loan size times duration:
loan_principal_last_paired_2t3_sum = sum(loan_principal_last_paired_2t3, rm.na=TRUE)- ratio_a_over_invest
The ratio of set A loan total principals divided by investment size:
ratio_a_over_invest = (loan_principal_sum/capital_invest)- ratio_b_over_a
The ratio of set B loan sum divided by sum of set A loans due in the last month prior to due date:
ratio_b_over_a = (loan_principal_paired_1t2_sum/loan_principal_last_sum)- ratio_c_over_b
The ratio of set C loans sum divided by set B loans sum:
ratio_c_over_b = (loan_principal_paired_2t3_sum/loan_principal_paired_1t2_sum)- ratio_c_over_a
The ratio of set C loans sum divided by set A loans sum:
ratio_c_over_a = (loan_principal_paired_2t3_sum/loan_principal_sum)
Source
Regenerated by
vignettes/ffv_invest_loan_bridge.qmd
via ffp_hfid_invest_loan_linked_abc_investloan_char_gateway()
(PrjThaiHFID-#32).
Set bl_replace_data_output <- TRUE in the vignette to overwrite data/*.rda.
MBF filters: investment months 14–144, fl_min_invest_size = 10000,
ar_st_vars_to_keep = c("agg_BS_1021", "agg_BS_1012", "agg_BS_1011").
Packaged inputs: tstm_loans_panel, tstm_asset_loan (see ?tstm_loans_panel).
Household IDs are anonymized tmid_hh (id or hhid_Num), aligned with tstm_asset_loan.
Three paper asset ivars only; hh_inv_ctr spans kept ivars (gateway early filter).
One row per investment passing typing thresholds.
Examples
data(tstm_invest2loan2bridge_chars)
ffp_preview_dataset(tstm_invest2loan2bridge_chars)
#>
#> ── tstm_invest2loan2bridge_chars ───────────────────────────────────────────────
#> Dimensions: 2990 rows × 31 columns(933.7 Kb)
#>
#> ── Column names (31) ──
#>
#> • 1. hhid_Num
#> • 2. ivars
#> • 3. hh_inv_asset_ctr
#> • 4. il1_lgt
#> • 5. il2_lgt
#> • 6. il3_lgt
#> • 7. ih1_lgt
#> • 8. ih2_lgt
#> • 9. bl_ibr_single
#> • 10. st_ibr_single
#> • 11. st_ibr_joint
#> • 12. st_ibr_has_informal_bridge
#> • 13. investloan_type_m4
#> • 14. investloan_type_brg_m5
#> • 15. investloan_type_m8
#> • 16. investloan_type_hook_m4
#> • 17. investloan_type_seta_m3
#> • 18. capital_prior
#> • 19. capital_end
#> • 20. capital_invest
#> • 21. loan_principal_sum
#> • 22. loan_principal_last_sum
#> • 23. r_group_weighted
#> • 24. loan_principal_paired_1t2_sum
#> • 25. loan_principal_last_paired_1t2_sum
#> • 26. loan_principal_paired_2t3_sum
#> • 27. loan_principal_last_paired_2t3_sum
#> • 28. ratio_a_over_invest
#> • 29. ratio_b_over_a
#> • 30. ratio_c_over_b
#> • 31. ratio_c_over_a
#>
#> ── Summary statistics (all variables) ──
#>
#> hhid_Num ivars hh_inv_asset_ctr il1_lgt
#> Min. :1031 Length :2990 Min. :1.00 Length :2990
#> 1st Qu.:3133 N.unique : 3 1st Qu.:1.00 N.unique : 3
#> Median :5593 N.blank : 0 Median :2.00 N.blank : 0
#> Mean :5466 Min.nchar: 11 Mean :2.08 Min.nchar: 5
#> 3rd Qu.:7681 Max.nchar: 11 3rd Qu.:3.00 Max.nchar: 5
#> Max. :9996 Max. :8.00
#>
#> il2_lgt il3_lgt ih1_lgt ih2_lgt
#> Length :2990 Length :2990 Length :2990 Length :2990
#> N.unique : 3 N.unique : 3 N.unique : 4 N.unique : 4
#> N.blank : 0 N.blank : 0 N.blank : 0 N.blank : 0
#> Min.nchar: 5 Min.nchar: 5 Min.nchar: 5 Min.nchar: 5
#> Max.nchar: 5 Max.nchar: 5 Max.nchar: 6 Max.nchar: 6
#>
#>
#> bl_ibr_single st_ibr_single st_ibr_joint st_ibr_has_informal_bridge
#> Mode :logical Length :2990 Length :2990 Length :2990
#> FALSE:2874 N.unique : 4 N.unique : 6 N.unique : 2
#> TRUE :116 N.blank : 0 N.blank : 0 N.blank : 0
#> Min.nchar: 8 Min.nchar: 11 Min.nchar: 19
#> Max.nchar: 15 Max.nchar: 28 Max.nchar: 22
#> NAs :2874 NAs : 874 NAs :1274
#>
#> investloan_type_m4 investloan_type_brg_m5 investloan_type_m8
#> Length :2990 Length :2990 Length :2990
#> N.unique : 4 N.unique : 6 N.unique : 8
#> N.blank : 0 N.blank : 0 N.blank : 0
#> Min.nchar: 19 Min.nchar: 18 Min.nchar: 19
#> Max.nchar: 24 Max.nchar: 29 Max.nchar: 29
#>
#>
#> investloan_type_hook_m4 investloan_type_seta_m3 capital_prior
#> Length :2990 Length :2990 Min. : 0
#> N.unique : 5 N.unique : 4 1st Qu.: 44207
#> N.blank : 0 N.blank : 0 Median : 232210
#> Min.nchar: 5 Min.nchar: 5 Mean : 1042034
#> Max.nchar: 10 Max.nchar: 15 3rd Qu.: 805296
#> Max. :141177726
#>
#> capital_end capital_invest loan_principal_sum
#> Min. : 10000 Min. : 10000 Min. : 101
#> 1st Qu.: 90703 1st Qu.: 21916 1st Qu.: 28001
#> Median : 328225 Median : 44661 Median : 66001
#> Mean : 1174642 Mean : 132607 Mean : 182450
#> 3rd Qu.: 954404 3rd Qu.: 99709 3rd Qu.: 169601
#> Max. :141635206 Max. :11555926 Max. :6670001
#> NAs :875
#> loan_principal_last_sum r_group_weighted loan_principal_paired_1t2_sum
#> Min. : 1 Min. :-1.000000 Min. : 501
#> 1st Qu.: 15601 1st Qu.: 0.002276 1st Qu.: 15181
#> Median : 41712 Median : 0.004492 Median : 40001
#> Mean : 109394 Mean :-0.006725 Mean : 118491
#> 3rd Qu.: 106001 3rd Qu.: 0.006601 3rd Qu.: 100001
#> Max. :6520001 Max. : 0.405000 Max. :15500001
#> NAs :874 NAs :875 NAs :1395
#> loan_principal_last_paired_1t2_sum loan_principal_paired_2t3_sum
#> Min. : 1 Min. : 501
#> 1st Qu.: 13001 1st Qu.: 23601
#> Median : 33001 Median : 52001
#> Mean : 104954 Mean : 144329
#> 3rd Qu.: 86501 3rd Qu.: 135301
#> Max. :15500001 Max. :15322001
#> NAs :1395 NAs :1607
#> loan_principal_last_paired_2t3_sum ratio_a_over_invest ratio_b_over_a
#> Min. : 1 Min. :2.614e-03 Min. : 0.01
#> 1st Qu.: 20001 1st Qu.:6.031e-01 1st Qu.: 0.30
#> Median : 42341 Median :1.308e+00 Median : 0.66
#> Mean : 122946 Mean :3.114e+00 Mean : 1628.31
#> 3rd Qu.: 120001 3rd Qu.:3.199e+00 3rd Qu.: 1.40
#> Max. :15322001 Max. :1.161e+02 Max. :670001.00
#> NAs :1607 NAs :875 NAs :1395
#> ratio_c_over_b ratio_c_over_a
#> Min. : 0.01563 Min. : 0.01675
#> 1st Qu.: 0.75001 1st Qu.: 0.36365
#> Median : 1.01675 Median : 0.71145
#> Mean : 2.59115 Mean : 1.07108
#> 3rd Qu.: 2.35689 3rd Qu.: 1.08013
#> Max. :79.92108 Max. :81.93540
#> NAs :1607 NAs :1607
#> ── Sample rows (first 6) ──
#>
#> # A tibble: 6 × 31
#> # Groups: hhid_Num, ivars, hh_inv_asset_ctr [6]
#> hhid_Num ivars hh_inv_asset_ctr il1_lgt il2_lgt il3_lgt ih1_lgt ih2_lgt
#> <int> <chr> <int> <chr> <chr> <chr> <chr> <chr>
#> 1 1031 agg_BS_1011 2 s-inf s-inf s-for h-inf h-fij
#> 2 1078 agg_BS_1011 1 s-inf s-inf s-inf h-inf h-inf
#> 3 1078 agg_BS_1012 1 s-inf s-inf s-inf h-inf h-inf
#> 4 1099 agg_BS_1011 1 s-inf s-inf s-inf h-inf h-inf
#> 5 1099 agg_BS_1011 2 s-fij s-fij s-fij h-mfij h-mfij
#> 6 1099 agg_BS_1012 1 s-fij s-fij s-fij h-mfij h-mfij
#> # ℹ 23 more variables: bl_ibr_single <lgl>, st_ibr_single <chr>,
#> # st_ibr_joint <chr>, st_ibr_has_informal_bridge <chr>,
#> # investloan_type_m4 <chr>, investloan_type_brg_m5 <chr>,
#> # investloan_type_m8 <chr>, investloan_type_hook_m4 <chr>,
#> # investloan_type_seta_m3 <chr>, capital_prior <dbl>, capital_end <dbl>,
#> # capital_invest <dbl>, loan_principal_sum <dbl>,
#> # loan_principal_last_sum <dbl>, r_group_weighted <dbl>, …