[R] Biexponential Fit

Katharine Mullen kate at few.vu.nl
Thu Apr 9 16:16:17 CEST 2009


Using algorithm="plinear" as shown by example below makes
sum-of-exponentials fitting problems better conditioned.

A1 <- 1
A2 <- 2
k1 <- -.5
k2 <- -2
x <- seq(1,10,length=200)
y <- A1*exp(k1*x) + A2*exp(k2*x) + .001*rnorm(200)

aa <- nls(y~cbind(exp(k1*x), exp(k2*x)), algorithm="plinear",
      start=list(k1=-.1, k2=-6), data=list(y=y, x=x), trace=TRUE)

On Thu, 9 Apr 2009, Peter Dalgaard wrote:

> Jonas Weickert wrote:
> > Hi,
> >
> > I want to do a biexponential Fit, i.e.
> >
> > y ~ A1*exp(k1*x) + A2*exp(k2*x)
> >
> > Is this possible? I tried nls() but it stopped with several (different)
> > errors. I'm using y and x as simple vectors and the formula for nls()
> > exactly as mentioned above.
>
> Yes, it is possible, with some reservations. There is even a
> self-starting model for it (SSbiexp), at least if k1,k2 are negative.
>
> The reservations are that you need good data and good starting values
> for the fit. The model is theoretically unidentifiable because you can
> switch 1 and 2 and get the same model, which becomes an issue if you
> start too fra from the optimum. Worse, if k1 and k2 are similar, the
> whole system becomes ill-conditioned. There's a rule of thumb requiring
> a factor of 5 or more between k1 and k2, for pharmacokinetic applications.
>
> > Thanks a lot!
> >
> > Jonas
> >
> > ______________________________________________
> > R-help at r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> > http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>
>
> --
>     O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
>    c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
>   (*) \(*) -- University of Copenhagen   Denmark      Ph:  (+45) 35327918
> ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)              FAX: (+45) 35327907
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>




More information about the R-help mailing list