# Fitting Lotka-Volterra equation with unknown constants to data

I'm trying to model a predator-prey interaction scenario given 100 years worth of data. I have no idea what the constants are and have been told to guess until I get a solution that is approximately correct, however this is proving fruitless and I'm sure there is an easier way to do it, I'm guessing with curve fitting. I've searched but haven't found anything yet.

Has anyone any suggestions on software using to solve unknown constants in differential equations given a dataset? (Preferably linux compatible). Failing that, any better suggestions as to how to find the constants.

-
..Valentine? – Chris Taylor Feb 23 '12 at 22:13
I'm sorry, I don't quite understand your comment. Could you elaborate a little? – Will Feb 23 '12 at 22:32
Sorry, it's not a very helpful comment. Valentine is a character in the Tom Stoppard play 'Arcadia' who is struggling with the problem of fitting historical data of grouse populations to a population model. – Chris Taylor Feb 23 '12 at 23:11
I see, I read parts of the wikipedia page and thought that given the plot features population dynamics, Valentine might have been in a similar predicament! – Will Feb 23 '12 at 23:22

## 1 Answer

I once helped someone do something very similar in Matlab for chemostat models. The principle was the following:

Solve the equations for initial conditions (normally the data points at instant 0) using an ODE solver (ode45). From this, construct an error function, for instance, the quadratic deviation of your data from the solutions you just obtained. This error function will depend on the parameters of the model.

Now use this error function as the input for the fmincon function, which lets you look for the optimal fit over some parameter range, i.e. the parameter choice that leads to a solution minimizing the error function. (So, the method is just a least squares method.)

That's how it worked in principle. I'll try to look up the matlab files I used for that.

-