Skip to content

Simulation and optimization

This section covers how to simulate mathematical models, the basics of improving the agreement between the model simulations and available experimental data using optimization methods, and how to test if the model should be rejected or not.

Fitting the model to experimental data

In this video we go from a formulated model to a model that has been fitted to data. This entails three steps: i) Simulation of the ODEs, ii) Formulation of a cost function, iii) Finding the optimal parameters using an optimization algorithm.

Regarding the cost function

In the video, the cost function is expressed as the square root of the summed weighted squared residuals. For the cost to be comparable to the \(\chi^2\)-test, the cost function should not take the square root. Furthermore, since we typically work with mean values from samples, the uncertainty should be the standard error of the mean (SEM). To summarize, the cost function should be expressed as:

\[V\left(p\right)=\ \sum_{t = 1}^{N}\frac{\left(y(t) -\ {\hat{y}}\left(t,p\right)\right)^2}{SEM(t)^2}\]

Or (equivalently), as in the computer exercises:

\[v\left(\theta\right)=\ \sum_{\forall t}\left(\frac{{y_t -\ {\hat{y}}_t\left(\theta\right)}}{{SEM}_t}\right)^2\]

Testing the fitted model

In this video, we at last ask the question: "Can we reject the fitted model?". This video describes three fundamental versions of this question: i) Is the model good enough (are the residuals too large or too correlated)? ii) Is another model significantly better?, and iii) Can the model describe independent validation data? In relation to this we encounter the chi-square test, the whiteness test, the likelihood ratio test, and the concept of over-fitting.