this function can predict dependent variables (y) from calibration regressions as well as independent variables (xs) by regression inversion for single and multi-variate linear regressions

apply_regression(dt, predict, nested_model = FALSE,
calculate_error = FALSE, model_data = model_data,
model_name = model_name, model_fit = model_fit,
model_params = model_params, predict_value = pred,
predict_error = pred_se, predict_range = NULL)

Arguments

dt data table with calibrations 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). whether the model is nested, if TRUE, must also provide model_params 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. the nested model data column new column with the model formulae or names if supplied the new model objects column the nested model information (only relevant if nest_model = TRUE) the new column in the model_data that holds the predicted value the new column in the model_data that holds the error of the predicted value (always created but NA if calculate_error = FALSE) 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.