Hi all,

I've got a problem with the nls function.
I have an adjustment which works when I fix one of the argument of my function (Xo=150) :


*Xo*=150
f<- function (tt*,Xo*,a,b)    ifelse(tt<*Xo*,a*exp(-b**Xo*),a*exp(-b*tt))
ajust<-nls(RER~f(tt,*Xo*,a,b),data=data.frame(tt=Ph2[,2*k],RER=Ph2[,2*k+1]),start=list(a=0.5,b=0.014))

But, when I use it as a "normal" parameter (and even if I do not I use it in the equation of my "f" function), it does not work :

f<- function (tt,*Xo*,a,b) ifelse(tt<150,a*exp(-b*tt),a*exp(-b*tt))
or : f<- function (tt,*Xo*,a,b) ifelse(tt<*Xo*,a*exp(-b**Xo*),a*exp(-b*tt)) #it is this equation I would like to resole
ajust<-nls(RER~f(tt,*Xo*,a,b),data=data.frame(tt=Ph2[,2*k],RER=Ph2[,2*k+1]),start=list(a=0.5,b=0.014,*Xo*=150))
/Error in nlsModel(formula, mf, start) : singular gradient matrix at initial parameter estimates/




Would you have any idea to help me.

Thanks a lot

Karine Chenu

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to