Apply calibration

iso_apply_calibration(
  dt,
  predict,
  calibration = last_calibration(dt),
  predict_range = NULL,
  calculate_error = FALSE,
  predicted_value = suffix(enexpr(predict), "_pred"),
  predicted_error = suffix(sym(predicted_value), "_se"),
  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.

predicted_value

the name of the column for the predicted value. By default the name of the predict column with suffix _pred. Only needs to be set if this default is not suitable.

predicted_error

the name of the column for the predicted error. By default predicted_value with suffix _se, i.e. the name of the predict column with suffix _pred_se. Only needs to be set if this default is not suitable.

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 \:

  • predicted_value column, usually predict column name with suffix _pred: the predicted value from applying the calibration

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

See also