Skip to content

[R-sig-dyn-mod] parameter estimation with simecol FitOdeModel function when using lapply function with an odeModel?

Hi Zachary,

thank you for opening the discussion on this new mailing list --
congratulations! On the other hand, however, your mail consists of
several questions (some of them quite specific), so please don't expect
comprehensive answers or a fully functional code.

In general, it helps if you ask one question after another, together
with *minimal* and *reproducible* examples that isolate the problem.

The following short notes may help you to proceed step by step.
Thompson, Zachary wrote:
This is a rather specific idea, but yes, it is possible to create
something like a compound model object that consists of a series of
scenarios. However, I would not recommend this for your problem.
In principle yes, a "compound object", but I think it is much easier to
use optim directly or the optimization routines from the FME package.
No, the "observer" slot is intended for something totally different.
In principle yes. Then use standard optimizers (or FME routines as
described in the FME vignette) to fit the parameters.

You can convert the list of lists returned by lapply:

outsim <- lapply(x.all[c(2,17)], f2test)

with:

do.call(rbind, lapply(outsim, data.frame))

to a unique data frame.
This is not appropriate here. The main function in class odeModel is the
derivative of the ODE, and not intended to hold a series of different 
scenarios.

My suggestion, make it simple:

1) put the "lapply" as it is in a function that returns a data frame, 
matrix or even a vector of data corresponding to the structure of your 
measured data (see above).

2) write a second function "cost" that returns a goodness of fit 
criterion, e.g. sum of squares between simulation and data (or use 
modCost from FME).

3) use optim or nlminb (or the FME package) to fit your parameters by 
using this cost function.

Sometimes it may help to start with a toy example before working with 
your full model and data set.

Thomas P.