# Bayesian engine

The goal of the bayesian engine is to calculate the maximum likelihood of the indivual parameters. It takes into account the observed concentration that is compared with the predicted concentration, and the population parameters compared with the calculated ones.

In order to do so, the calculation engine tries to find the best individual parameters that allow to minimize the following function:

$$\begin{eqnarray*}\label{eqn:logpmtot} \Phi & = & \sum_{i=n+1}^{n+m} \log \theta_{ind_i} +\\ & & \frac{(C_{obs}-C_{pred})^2}{2\sigma_{add}^2}+ \frac{(\log C_{obs} -\log C_{pred})^2}{2\sigma_{prop}^2}+ \\ & & \sum_{i=1}^{n} \frac{(\theta_{ind_i}-\theta_{pop_i})^2}{2\omega_i^2}+ \sum_{i=n+1}^{n+m} \frac{(\log \theta_{ind_i} -\log \theta_{pop_i})^2}{2\omega_i^2}\\ \end{eqnarray*}$$

Where:

• $$\theta_{pop_i}$$ are the population parameters. They correspond to the parameters of a typical patient.
• $$\theta_{ind_i}$$ are the individual parameters. They are the output of this computation, and will serve to generate a patient curve if some drug measurements are available.
• $$C_{obs}$$ is the observed concentration
• $$C_{pred}$$ is the predicted concentration, calculated from the individual parameters $$\theta_{ind_i}$$
• $$\omega_i$$ are the standard deviates of the parameters
• $$\sigma_{add}$$ is the additive error on the observations
• $$\sigma_{prop}$$ is the proportional error on the observations
• $$n$$ is the number of parameters following a Normal distribution
• $$m$$ is the number of parameters following a LogNormal distribution