# Compare data and model prediction by computing residuals

When sigma is given in the data, it always has priority over the sigma in the error model

dMod_res(data, out, err = NULL)

## Arguments

data data.frame with name (factor), time (numeric), value (numeric) and sigma (numeric) output of ode(), optionally augmented with attributes "deriv" (output of ode() for the sensitivity equations) and "parameters" (character vector of parameter names, a subsest of those contained in the sensitivity equations). If "deriv" is given, also "parameters" needs to be given. output of the error model function

## Value

data.frame with the original data augmented by columns "prediction" ( numeric, the model prediction), "residual" (numeric, difference between prediction and data value), "weighted.residual" (numeric, residual devided by sigma). If "deriv" was given, the returned data.frame has an attribute "deriv" (data.frame with the derivatives of the residuals with respect to the parameters).

Other dMod interface: convert2dMod_IQRdata(), dMod_nlmeEst2dModFrame(), dMod_sysProject_computations()