compare_thresholds is a helper function for thresh_gam. It test whether a specific threshold value leads to a new splitting of trainings observations in the threshold variable in comparison to the previous threshold value. Returns FALSE if the change in the t-t_val does not result in a new grouping of threshold values (above and below the t_val).

compare_thresholds(t_val, t_var)

Arguments

t_val

A vector with threshold values.

t_var

A vector with pressure values of the threshold variable.

Value

The function returns a tibble with one row for each t-val and two columns:

t_val

The input vector of threshold values.

change

logical; if TRUE, the respective threshold value lead to a new splitting of trainings observations in the threshold variable.

See also

Examples

t_var <- rnorm(20) lower <- stats::quantile(t_var, prob = .2, na.rm = TRUE) upper <- stats::quantile(t_var, prob = .8, na.rm = TRUE) t_val <- seq(from = lower, to = upper, by = (upper - lower) / 20) compare_thresholds(t_val, t_var)
#> # A tibble: 21 × 2 #> t_val change #> <dbl> <lgl> #> 1 -1.45 TRUE #> 2 -1.35 TRUE #> 3 -1.25 FALSE #> 4 -1.15 FALSE #> 5 -1.05 FALSE #> 6 -0.945 FALSE #> 7 -0.845 TRUE #> 8 -0.745 FALSE #> 9 -0.644 FALSE #> 10 -0.544 TRUE #> # … with 11 more rows