# [S] RE: Fitting an exponential given areas (SUMMARY)

Mon, 23 Feb 1998 22:09:15 -0600

Yesterday, I described a dataset involving collection of an excreted
catabolite. The assay prevented continued nutrition of the organisms, and
as a result, excretion seemed to fall off exponentially after food was
discontinued:
> f(x) = a * b^t, {a > 0, 0 < b < 1 }.
which means the expected amount of catabolite collected between times t1
and t2 should be the integral
catab = a * (b^t2 - b^t1) / log(b).

I asked for recommendations on how to estimate a and b from catab, t1 and t2.

Patrick Connolly suggested I take the logarithm and do linear regression.
Log transformation was also mentioned by Bill Venables for use if the
errors are of a multiplicative type. Karl Broman wondered also if the data
might be heteroscedastic. Karl and Bill both wrote wonderfully detailed
descriptions of a nonlinear regression approach using nlm(),also mentioned
by Duncan Murdoch along with ms(). I'll quote Karl:

>Consider the model where the ti are known without error and
>catab = a*(b^t2-b^t1)/log(b) + epsilon, where the epsilon are iid
>normal(0,sigma^2). Then you can fit this using the function "nls"
>as follows:
>
>out<-nls(catab~a*(b^t2-b^t1)/log(b),data=x,start=list(a=0.5,b=0.1),trace=T)

Bill Venables then went on to show an approach to my next step,

> > I want to estimate coefficients a and b. Later, I'll use them
> > to sweep out effects of t1 and t2 from excretion measures in
> > another larger dataset with yet a fourth column, "treatment".
>
>When you come to the treatment model, the call to nls is much the
>same. Now you need a vector of starting values for a[1], a[2],
>..., a[g] (if there are g treatment groups), suppose it is in a0,
>and b0 is the starting value for b. The call is then
>
>fm <- nls(catab ~ a[treatment] * (b^t2 - b^t1) / log(b), data = dat.frm,
> start = list(a = a0, b = b0), trace = T)
>
> > In other words, I want to express excretion as "a", the
> > instantaneous rate at time zero (assuming "b" is invariant
> > with treatment), then to correlate "a" with treatment.
>
>If b also varies with treatment it would be equivalent to fitting
>separate models to each treatment group and pooling residual sums
>of squares to estimate the variance.

>You don't really want to "correlate" a with treatment, you want
>to fit a model where a depends on treatment. A bit picky, but
>worth it.

My sincere thanks Bill, Karl, Patrick, and Duncan!