R: [R] nls arguments
Vito Muggeo
vito.muggeo at giustizia.it
Mon Dec 15 11:39:32 CET 2003
Dear chenu,
I am not going to see your code with attention (also I do not understand the
`*' symbol you used), however it looks a changepoint-type problem.
The package segmented (on CRAN) uses a piecewise linear parameterization to
fit regression models with breakpoints.
Hope this helps,
best, vito
----- Original Message -----
From: chenu <chenu at ensam.inra.fr>
To: <R-help at stat.math.ethz.ch>
Sent: Monday, December 15, 2003 11:01 AM
Subject: [R] nls arguments
> 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
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
More information about the R-help
mailing list