-
Notifications
You must be signed in to change notification settings - Fork 4
Custom primary models
Alberto Garre edited this page May 9, 2022
·
1 revision
This page shows how to define new functions as primary growth models. Please note that this is intended only for advanced users.
- Go to file predict_isothermal_growth.R (you could do it in a different file, but it is easier this way).
- Define the function for the primary model with any name (as long as it is not already within the package namespace).
- The first argument should be named
times
and represent the elapsed time as a numeric vector of any dimension. Additional arguments define the model parameters. - The function should return a numeric vector with logarithm (in log10 scale) of the population size with same length as
times
.
- Go to the file metainfo_primary.R
- Within the function primary_model_data(), extend
model_data
with the meta-data of the new model. - This information should be a named list with 5 entries:
identifier
(the model key),name
(the full name of the model),pars
(a character vector of model parameters),model
(the model function defined before),ref
(the paper where the model was first published).
- Go to file predict_isothermal_growth.R
- Go to function predict_isothermal_growth().
- Modify the definition of variable
logN
adding an additional option for theswitch
. - This new entry should be named with the same key defined in primary_model_data().
- Its value should be a call to the function defined in the first step. The first argument calling this function should be
times
. Then, as many additional arguments as model parameters, passed assimul_pars$
+ "parameter name".
- You would need to build the package locally using the functions included in devtools. Please check the documentation of that package for details on how to do that.
- After taking the steps above, the functions for prediction and model fitting should work.
- If they do not, feel free to contact us.
- We will gladly include your model in the next CRAN release of biogrowth. We would appreciate if you could send a pull request, so we can review your changes and include the new model.