[R] NLS bi exponential Fit

Peter Ehlers ehlers at ucalgary.ca
Thu Aug 23 17:50:47 CEST 2012


Have you checked help(SSbiexp) ?

Peter Ehlers

On 2012-08-23 04:54, vincent guyader wrote:
> Hi everyone,
>
> I'm trying to perform a bi exponential Fit with the package NLS. the
> plinear algorithm seems to be a good choice
>
> see:
>
> p<-3000
> q<-1000
> a<--0.03
> b<--0.02
> t<-seq(0:144);t
> y<-p*exp(a*t) + q*exp(b*t)+rnorm(t,sd=0.3*(p*
> exp(a*t) + q*exp(b*t)))
> fittA <- nls(y~cbind(exp(a*t), exp(b*t)),
> algorithm="plinear",start=list(a=-.1, b=-0.2), data=list(y=y, t=t),
> trace=FALSE);fittA
>
> #          a          b         .lin1      .lin2
> # -0.003074   -2.777     4512     -2399
>
> fittB <- nls(y~cbind(exp(a*t), exp(b*t)),
> algorithm="plinear",start=list(a=-.1, b=-0.3), data=list(y=y, t=t),
> trace=FALSE);fittB
>
> #        a              b          .lin1           .lin2
> #  -0.02248   -0.04684 2414.86017 2052.96601
>
>
> but
>
> 1 - the initial condition is very sensitive, is there any way to find a
> good start for the parameters?
> 2 - I would like to havre .lin1 >0 ans .lin2 >0 , is there a way to do that?
>
>
> thx a lot
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> 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