From: Luis Orlindo Tedeschi <luis.tedeschi_at_hotmail.com>

Date: Fri, 30 Nov 2007 08:25:16 -0600

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. Received on Fri 30 Nov 2007 - 14:30:10 GMT

Date: Fri, 30 Nov 2007 08:25:16 -0600

Folks; I have looked for this subject extensively using all the resources I have available and could not find a solution; therefore I am sending you this email seeking for help. I need to solve a discontinuous nonlinear function, but R 2.6 keeps giving me an error. Below is a simple example:

f <- function (t,k,l,u) { r0<-346.1 x<-t-l if (x<0) r0 else (r0-u)*exp(-k*x)+u }prof1<-read.table("c:\\data.txt", header=TRUE)results<-nls(y1~f1(t,k,l,u), data=prof1, start=list(k=0.05, l=4, u=154))

Errors I am getting are:

Error in qr(.swts * attr(rhs, "gradient")) : dims [product 3] do not match the length of object [10]In addition: Warning messages:1: In if (x < 0) r0 else (r0 - u) * exp(-k * x) + u : the condition has length > 1 and only the first element will be used2: In if (x < 0) r0 else (r0 - u) * exp(-k * x) + u : the condition has length > 1 and only the first element will be used3: In if (x < 0) r0 else (r0 - u) * exp(-k * x) + u : the condition has length > 1 and only the first element will be used4: In if (x < 0) r0 else (r0 - u) * exp(-k * x) + u : the condition has length > 1 and only the first element will be used5: In if (x < 0) r0 else (r0 - u) * exp(-k * x) + u : the condition has length > 1 and only the first element will be used6: In .swts * attr(rhs, "gradient") : longer object length is not a multiple of shorter object length Data file is this one

t y1

1 0 346.12 3 343.13 6 327.44 12 280.95 18 242.76 24 228.67 36 193.48 48 174.29 72 164.810 96 152.0

Any help?

PC_MediaCtr_bigscreen_102007

[[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. Received on Fri 30 Nov 2007 - 14:30:10 GMT

Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.

Archive generated by hypermail 2.2.0, at Fri 30 Nov 2007 - 15:30:16 GMT.

*
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help.
Please read the posting
guide before posting to the list.
*