Re: [R] picewise function in nls....

2019-04-19 Thread Ivan Krylov
On Fri, 19 Apr 2019 10:12:06 + akshay kulkarni wrote: > But what do you mean by "since fx does not depend on any of the > parameters you optimize in the nls() call."? Can you give an example? By "parameters you optimize in the nls() call" I mean `a`. `a` does not seem to be used in the calcu

Re: [R] picewise function in nls....

2019-04-18 Thread Ivan Krylov
On Thu, 18 Apr 2019 10:36:10 + akshay kulkarni wrote: > fx <- (x1 <= -2)*(x1^2) + (x1 > -2 && x1 < 2)*(x1^3) + (x1 > = > 2)*(x1^4) > > Can I include fx in an nls call to create something like this: > > NLS1 <- nls(y ~ a*(sin(x2) + fx), start = list(a = 2)) ? For now, you can, since fx