On Wed, 1 Jul 2020 14:31:19 +0200
Luigi Marongiu <marongiu.lu...@gmail.com> wrote:

>  the optimization actually got a worse outcome than the original
>eyeball estimation

Could you elaborate on the function you are trying to fit to your data?
nls.lm takes a function returning a vector of residuals, that is,

fn <- function(parameters, input, actual.output) {
 calculate.output(parameters, input) - actual.output
}

...which means that you need a vector of input values and a vector of
output values of the same length. In your example,

> y = (p$a * x^2) / (p$b^2 + x^2)

a and b are parameters. x seems to be the dependent variable (i.e.
output of the process) and not the independent variable (i.e. input of
the model function) like I had initially assumed. What is the input of
your model function?

-- 
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