Function to calculate investment thresholds and identify large deviation jumps
Source:R/ffp_invest.R
ffp_hfid_invest_jump.Rd
This function takes a data frame of asset loan data and calculates investment thresholds based on standard deviation. It then identifies large deviation jumps in the investment variables.
Usage
ffp_hfid_invest_jump(
df_asset,
fl_sd_ithres = stats::qnorm(0.99),
svr_hhid = "id",
svr_time = "month",
verbose = FALSE,
verbose_detail = FALSE,
it_verbose_detail_nrow = 100
)
Arguments
- df_asset
A data frame containing asset data
- fl_sd_ithres
Standard deviation threshold for investments
- svr_hhid
Variable name for household ID
- svr_time
Variable name for time
- verbose
Logical indicating whether to print verbose output (default is TRUE)
- verbose_detail
Logical indicating whether to print detailed verbose output (default is TRUE)
- it_verbose_detail_nrow
Number of rows to print for detailed verbose output (default is 100)
Author
Fan Wang, http://fanwangecon.github.io
Examples
df <- tstm_asset_loan
fl_sd_ithres <- stats::qnorm(0.99)
ffp_hfid_invest_jump(df, fl_sd_ithres = fl_sd_ithres)
#> # A tibble: 800,296 × 8
#> # Groups: id, ivars [5,607]
#> id month ivars value value_df value_df_sd bl_value_jump thres_inv_dfsd
#> <dbl> <dbl> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 70201 0 agg_BS_… 1.52e5 NA 187. 0 2.33
#> 2 70201 1 agg_BS_… 1.52e5 -21.9 187. 0 2.33
#> 3 70201 2 agg_BS_… 1.52e5 -21.5 187. 0 2.33
#> 4 70201 3 agg_BS_… 1.52e5 -21.1 187. 0 2.33
#> 5 70201 4 agg_BS_… 1.52e5 -20.7 187. 0 2.33
#> 6 70201 5 agg_BS_… 1.52e5 -20.4 187. 0 2.33
#> 7 70201 6 agg_BS_… 1.52e5 -20.0 187. 0 2.33
#> 8 70201 7 agg_BS_… 1.52e5 -19.7 187. 0 2.33
#> 9 70201 8 agg_BS_… 1.52e5 -19.3 187. 0 2.33
#> 10 70201 9 agg_BS_… 1.52e5 -19.0 187. 0 2.33
#> # ℹ 800,286 more rows