calc_fit_mod() takes antibody kinetic parameter estimates and calculates
fitted and residual values. Fitted values correspond to the estimated assay
value (ex. ELISA units etc.) at time since infection (TSI). Residual values
are calculated as the difference between fitted and observed values.
Usage
calc_fit_mod(
modeled_dat,
original_data,
strat = NA,
min_value = 0.01,
decay_type = "power"
)Arguments
- modeled_dat
A data.frame of modeled antibody kinetic parameter values.
- original_data
A data.frame of the original input dataset.
- strat
A character string specifying the stratification variable name, or NA if no stratification is used.
- min_value
numeric; minimum value substituted in before taking
log10()offitted/observed values, to avoid-Inffromlog10(0)when computinglog_residual*.- decay_type
A character string specifying the decay function (
"power"or"exponential"). Passed through toab(). Default is"power".
Value
A data.frame attached as an attributes with the following values:
Subject = ID number specifying an individual
Iso_type = The modeled antigen_isotype
Stratification = The variable used to stratify the model (
"None"when no stratification is used)t = Time since infection
fitted = The median (across posterior draws) fitted value for a given
tresidual = The median (across posterior draws) residual, calculated as the difference between observed and fitted values for a given
tresidual_low, residual_high = The 2.5% and 97.5% quantiles (across posterior draws) of the residual, giving a precision interval around
residuallog_residual, log_residual_low, log_residual_high = As
residual,residual_low, andresidual_high, but computed on the log10 scale (i.e.log10(observed) - log10(fitted), with values floored atmin_valuebeforehand)