PKanalix
Auto Light Dark
Auto Light Dark

Cost, AIC and BIC

Cost function

The cost function that is minimized in the optimization performed during CA is described here. The cost is reported in the result tables after running CA, as individual cost in the table of individual parameters, and as total cost in a separate table, together with the likelihood and additional criteria.

Formulas for the cost function used in PKanalix are derived in the framework of generalized least squares described in the publication Banks, H. T., & Joyner, M. L. (2017). AIC under the framework of least squares estimation. Applied Mathematics Letters, 74, 33-45, with an additional scaling to put the same weight on different observation types.

The total cost function, shown in the cost table in the results, is a sum of individual costs per occasion (that is, summed over id-occ):

Formula for the total cost. Cost equals the sum over id-occs of X scaling times the sum over observation types with data for that id-occ of 1 over N obs for that id-occ and obstype, times the sum over time points j of res j divided by w j, squared. The inner part, boxed in green, is the individual cost shown and minimized in individual fits.

where in the above formula:

  • denotes the number of observations for one individual, one occasion and one observation type (i.e., one model output mapped to data, such as parent and metabolite, or PK and PD, see here).

  • are residuals at measurement times , where are the predictions for each time point  , and are the observations from the dataset at that time.

  • are weights, selected from the following: , , , , , depending on denominator of the selection in CA task > Settings > Calculations, as explained in this tutorial video.

PKanalix CA Calculations panel with the Cost function dropdown open. Options are the squared residual Ypred minus Yobs alone, or divided by Yobs, Ypred, Yobs squared, Ypred squared, or absolute Ypred times Yobs, which is selected.

is a scaling parameter given by:

Formula for X scaling, equal to the sum over id-occs of the number of observation types for each id-occ, divided by the sum over id-occs and observation types of 1 over N obs for that id-occ and obstype.

where is the number of observation IDs mapped to a model output for one individual and one occasion. Note that if there is only one observation type (corresponding to one observation ID), and the cost function is a simple sum of squares over all observations, weighted by the weights .

Likelihood

The likelihood is not directly used in the optimization for CA, but it is possible to derive it based on the optimal cost obtained with the following formula (details in Banks et al.):

Formula for minus 2LL, equal to 1 plus ln of 2 pi, times N tot, plus 2 times the sum over data points j of ln w j, plus N tot times ln of Cost divided by N tot.

where

  • stands for ,

  • is the total number of observations for all individuals, all occasions and all mapped model outputs,

  • are the weights as defined above.

Additional Criteria

Additional information criteria are the Akaike Information Criteria (AIC) and the Bayesian Information Criteria (BIC). They can be used to compare models. They penalize -2LL by the number of parameters estimated, including the number of model parameters used for the optimization, , the total number of observations, , and the number of observations for every subject-occasion, . This penalization enables comparing models with different levels of complexity. Indeed, with more parameters, a model can easily fit better (lower -2LL), but with too many parameters, a model loses predictive power and confidence in the parameter estimates. If not only the -2LL, but also the AIC and BIC criteria decrease after changing a model, it means that the increased likelihood is worth increasing the model complexity.

Formulas for individual fits. AIC equals minus 2LL plus 2 times, N param times N idocc plus 1. BIC equals minus 2LL plus ln N tot plus N param times the sum over id-occs of ln N obs for each id-occ.

This formula simplifies if the “pooled fit” option is selected in the calculation settings of the CA task:

Formulas for pooled fit. AIC equals minus 2LL plus 2 times, N param plus 1. BIC equals minus 2LL plus ln N tot times, N param plus 1.

AIC derivation in the case of individual fits

The total AIC for all individuals penalizes -2LL with 2 x the number of parameters used in the optimization. For the structural model, we estimate parameters, where is the number of parameters in the structural model and is the number of subject-occasions (since there is a set of parameters estimated for each id#occ). For the statistical model, we also implicitly estimate a parameter , which is the variance of the residual error model shared by all individuals (it is derived using the sum of squares of residuals as described in Banks et al.). Therefore, AIC penalizes -2LL by .

BIC derivation in the case of individual fits

The total BIC penalizes -2LL by (number of parameters) x ln(number of data points). In this case, we should distinguish between the data for each id#occ, which is used to estimate parameters, and the data for all individuals, which is used together to estimate the residual variance . To penalize each individual’s data in the estimation of , we add the term for each id#occ. To penalize the estimation of the error model parameter with all the observations (substitution of as described in Banks et al.), we add the term .

Last updated: