[R] picewise function in nls....

Ivan Krylov kry|ov@r00t @end|ng |rom gm@||@com
Fri Apr 19 12:29:08 CEST 2019


On Fri, 19 Apr 2019 10:12:06 +0000
akshay kulkarni <akshay_e4 using hotmail.com> 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 calculation of `fx`. If it were, it would
have to look like:

fx <- function(x1, x2, a) { ... }
nls(y ~ a*(sin(x2) + fx(x1, x2, a)), start = list(a = ...))

so that nls() would be able to check different values of `a`.

-- 
Best regards,
Ivan



More information about the R-help mailing list