PEtab-dev / libpetab-python

Python package for working with PEtab files
https://libpetab-python.readthedocs.io
MIT License
14 stars 6 forks source link

Feature to automate handling of replicate data #310

Open egeissen opened 2 weeks ago

egeissen commented 2 weeks ago

Hi all! I am wondering about a specific detail of setting up a parameter estimation problem and how it could be automated with petab. It is about how to make use of replicate data in the parameter estimation problem.

If replicates are available, I could think of at least 2 distinct scenarios of how to deal with this data:

  1. Use individual replicates to calculate their mean and standard error of the mean, at each time point. And then use those as the data points and time point specific noise parameter values of the error model, respectively, when evaluating the objective function for parameter estimation.

  2. Calculate the standard deviation of the individual replicates (for each time point) and use it as an error model parameter while using the individual replicates as individual data points when evaluating the objective function.

It would be great if petab could provide a feature to do this and choose between the different options.

I discussed this a bit with Dilan already and he asked me to assign him to the issue, but I don’t know how to do this. 😊

Thanks, everyone!

dilpath commented 2 weeks ago

Hi Eva, thanks, I'm happy to work on this, probably this month. I would probably add some method that can be used like

petab_problem_averaged = copy.deepcopy(petab_problem)
petab_problem_averaged.measurement_df = petab.measurements.average_from_replicates(
    petab_problem.measurement_df,
    average: str = "mean",
    noise: str = "standard_deviation",
)

with some warning that this will change the objective function.