Routines for fitting kinetic models with one or more state