Household and investment (unique start and end months) as units of observation. This
is a file derived from tstm_invest, considering only unique investment spans.
Format
Household and investment (unique start and end) file
- id
Household ID
- hh_inv_ctr
Unique household investment span counter
- mth_inv_start
Start time of unique investment span
- mth_inv_end
End time of unique investment span
- thres_inv_mgap
Month gap allowed to merge investment jump together as one investment
- thres_inv_dfds
Standard deviation threshold for counting investment jump
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).
Unique spans across kept ivars only.
See also issue-1, step 2.
Details
Benchmark file with benchmark investment standard deviation, and investment gap allowance parameters. Multiple alternative investment variables are jointly considered and unique investment windows from across investment variables are found. Within household, investment spans can overlap due to them coming from different investment variable definitions.
Examples
data(tstm_invdates_uniq)
ffp_preview_dataset(tstm_invdates_uniq)
#>
#> ── tstm_invdates_uniq ──────────────────────────────────────────────────────────
#> Dimensions: 3066 rows × 6 columns(181.9 Kb)
#>
#> ── Column names (6) ──
#>
#> • 1. thres_inv_mgap
#> • 2. thres_inv_dfsd
#> • 3. id
#> • 4. hh_inv_ctr
#> • 5. mth_inv_start
#> • 6. mth_inv_end
#>
#> ── Summary statistics (all variables) ──
#>
#> thres_inv_mgap thres_inv_dfsd id hh_inv_ctr
#> Min. :2 Min. :2.326 Min. :1003 Min. : 1.000
#> 1st Qu.:2 1st Qu.:2.326 1st Qu.:3108 1st Qu.: 2.000
#> Median :2 Median :2.326 Median :5486 Median : 3.000
#> Mean :2 Mean :2.326 Mean :5449 Mean : 3.108
#> 3rd Qu.:2 3rd Qu.:2.326 3rd Qu.:7701 3rd Qu.: 4.000
#> Max. :2 Max. :2.326 Max. :9996 Max. :13.000
#> mth_inv_start mth_inv_end
#> Min. : 1.00 Min. : 1.00
#> 1st Qu.: 39.00 1st Qu.: 39.00
#> Median : 75.00 Median : 75.00
#> Mean : 75.81 Mean : 75.91
#> 3rd Qu.:112.00 3rd Qu.:112.00
#> Max. :160.00 Max. :160.00
#> ── Sample rows (first 6) ──
#>
#> # A tibble: 6 × 6
#> # Groups: id [3]
#> thres_inv_mgap thres_inv_dfsd id hh_inv_ctr mth_inv_start mth_inv_end
#> <dbl> <dbl> <int> <int> <dbl> <dbl>
#> 1 2 2.33 1003 1 1 1
#> 2 2 2.33 1031 1 9 9
#> 3 2 2.33 1031 2 71 71
#> 4 2 2.33 1031 3 80 80
#> 5 2 2.33 1031 4 154 154
#> 6 2 2.33 1046 1 1 1