On Tue, 30 Jun 2020 13:53:10 +0200
Luigi Marongiu <marongiu.lu...@gmail.com> wrote:

> function(a, b, x) {
>   y = (a * x^2) / (b^2 + x^2)
>   return(y)
> }

Take a look at the examples in ?nls.lm. The first argument of the
function must be the parameter list/vector; the rest of the arguments
are passed from ... in nls.lm call. This is _unlike_ do.call, which can
be used to "unpack" a list of arguments into function arguments.

To make it more concrete, change your function to:

function(par) (par$a * par$x^2) / (par$b^2 + par$x^2)

Then it should work.

-- 
Best regards,
Ivan

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.

Reply via email to