# [R] question about model formula

Michael A. Miller mmiller3 at iupui.edu
Thu Mar 6 19:32:40 CET 2003

Dear R Gang,

I'm interested in using R and the nls package for fitting kinetic
models.  I'm having some difficulty getting a model specified for
nls though.  The math for the model that I want to fit is

dg(t)/dt = K1 f(t) - k2 g(t)

where g(t) and f(t) are measured data at a sequence of times t.
K1 and k2 are the parameters of the model.  If I solve this, the
solution is

g(t) = K1 \int_0^t f(t') \exp(-k2(t-t')) dt'

and I'm not sure how to write a formula in R that I can pass to
nls that will handle both the implicit loop over the data values
of t and the interpolation and numeric integration over t'.

Can anyone help me to get this properly coded for R?

Mike

--
Michael A. Miller                               mmiller3 at iupui.edu
Imaging Sciences, Department of Radiology, IU School of Medicine