Skip to contents

One row per household: first and last survey month with asset data, derived from tstm_asset_loan in vignettes/ffv_gen_asset_loan.qmd.

Usage

tstm_hh_mthspan

Format

Household start and end month file.

id

Anonymized household ID (tmid_hh). Matches id in tstm_asset_loan for households present in both files.

month_start

First survey month with asset data for this household

month_end

Last survey month with asset data for this household

month_n

Number of household-month rows in tstm_asset_loan for this id

Source

Regenerated by vignettes/ffv_gen_asset_loan.qmd (household span step; formerly data-raw/ffs_hfid_gen_b_data.R; PrjThaiHFID-#5). Same bl_replace_data_output workflow as tstm_asset_loan. Shipped as data/tstm_hh_mthspan.rda; the vignette also writes local-only CSV/DTA copies to inst/extdata/tstm_hh_mthspan.{csv,dta}, but that folder is git-ignored and excluded from the build (.Rbuildignore), so it is not shipped — installed users load via data(tstm_hh_mthspan). Anonymized in data-raw/id_anonymize/; true IDs in data-raw/id_anonymize/tstm_hh_mthspan_true_id.rda.

Downstream vignettes: household-span denominator for the investment frequency tables in ffv_invest_freq_sizes (issue #9).

Details

The packaged object stores anonymized household IDs: id holds tmid_hh from data-raw/tm_key_id.rda via data-raw/id_anonymize/ (same crosswalk as id in tstm_asset_loan). True IDs are backed up in data-raw/id_anonymize/tstm_hh_mthspan_true_id.rda.

Examples

data(tstm_hh_mthspan)
ffp_preview_dataset(tstm_hh_mthspan)
#> 
#> ── tstm_hh_mthspan ─────────────────────────────────────────────────────────────
#> Dimensions: 791 rows × 4 columns(19.8 Kb)
#> 
#> ── Column names (4) ──
#> 
#> • 1. id
#> • 2. month_start
#> • 3. month_end
#> • 4. month_n
#> 
#> ── Summary statistics (all variables) ──
#> 
#>        id        month_start       month_end        month_n     
#>  Min.   :1003   Min.   : 0.000   Min.   :  2.0   Min.   :  3.0  
#>  1st Qu.:3166   1st Qu.: 0.000   1st Qu.:160.0   1st Qu.:161.0  
#>  Median :5412   Median : 0.000   Median :160.0   Median :161.0  
#>  Mean   :5467   Mean   : 5.345   Mean   :146.8   Mean   :142.5  
#>  3rd Qu.:7706   3rd Qu.: 0.000   3rd Qu.:160.0   3rd Qu.:161.0  
#>  Max.   :9996   Max.   :94.000   Max.   :160.0   Max.   :161.0  
#> ── Sample rows (first 6) ──
#> 
#> # A tibble: 6 × 4
#>      id month_start month_end month_n
#>   <int>       <dbl>     <dbl>   <int>
#> 1  1003           0        35      36
#> 2  1015           0         2       3
#> 3  1031           0       160     161
#> 4  1046           0       160     161
#> 5  1059           0       160     161
#> 6  1078           0       160     161