Apply calibration

iso_apply_calibration(dt, predict, calibration = last_calibration(dt),
  predict_range = NULL, calculate_error = FALSE,
  quiet = default(quiet))

Arguments

dt

nested data table with all_data and calibration columns (see iso_generate_calibration)

predict

which value to calculate, must be the regression's independent variable (regression is applied directly) or one of the independent variables (regression will be automatically inverted).

calibration

name of the calibration to apply, must match the name used in iso_generate_calibration (if any)

predict_range

vector of 2 numbers. Only relevant for predicting dependent variables (regression inversion). If provided will be used for finding the solution for the predict variable. By default uses the range observed in the calibration variables. Specifying the predict_range is usually only necessary if the calibration range must be extrapolated significantely.

calculate_error

whether to estimate the standard error from the calibration. Stores the result in the new predict_error column. If the predict variable is a dependent variable, will do so using the Wald method (as described in invest). Note that error calculation for dependent variables slows this function down a fair bit and is therefore disabled by default.

quiet

whether to display (quiet=FALSE) or silence (quiet = TRUE) information messages.

Value

the data table with the following columns added to the nested all_data \:

  • predict column with suffix _pred: the predicted value from applying the calibration

  • predict column with suffix _pred_se: the error of the predicated value propagated from the calibration. Only created if calculate_error = TRUE.

  • predict column with suffix _pred_in_range: reports whether a data entry is within the range of the calibration by checking whether ALL dependent and independent variables in the regression model are within the range of the calibration - is set to FALSE if any(!) of them are not - i.e. this column provides information on whether new values are extrapolated beyond a calibration model and treat the extrapolated ones with the appropriate care. Note that all missing predicted values (due to missing parameters) are also automatically flagged as not in range