R/approx_deriv.R
approx_deriv.Rd
approx_deriv
implements a crude approximation for the uncertainty
around the first derivatives. It should be used complementary to the
conditional bootstrap, if problems with GAMM fittings occur
(see calc_deriv
).
approx_deriv(init_tbl, mod_tbl, ci_prop_se)
init_tbl | The output tibble of the |
---|---|
mod_tbl | A model output tibble from |
ci_prop_se | A conversion factor for approximating derivative CIs in the `approx_deriv` method; it is multiplied with the ratio between s.e. and mean fitted values of the smoothing curve to represent some level of uncertainty around the slope proportional to the uncertainty in the smoothing curve. Default is 25, which is a compromise representing fairly well the results obtained for the GAMs from the conditional bootstrap. |
The function returns the input model tibble with the following 4 columns added
press_seq
A list-column with sequences of 100 evenly spaced pressure values (with the length of the time series).
deriv1
A list-column with the first derivatives of the indicator responses averaged across all bootstraps (for the 100 equally spaced pressure values).
deriv1_ci_up
A list-column with the upper confidence limit of the bootstrapped first derivatives(for the 100 equally spaced pressure values).
deriv1_ci_low
A list-column with the lower confidence limit of the bootstrapped first derivatives(for the 100 equally spaced pressure values).
In this approach derivatives are calculated for the original smoother and some level of uncertainty (not exactly the confidence intervals) is estimated based on the standard error (s.e.) of the smoother. The same proportion of error (estimated as the ratio s.e./fitted mean) is adopted for the maximal slope of the derivative and then kept constant across the entire curve. As this results in much smaller uncertainty ranges, a conversion (or multiplication) factor is implemented to allow modifications of the error proportion. The default of 25 is a compromise representing fairly well the results obtained for the GAMs from the conditional bootstrap.
the wrapper function calc_deriv