Displaying 1 result from an estimated 1 matches for "nls_ab".
Did you mean:
nlab
2006 May 23
2
nls: formula error?
...first column has my bin numbers so -4 - +4
in 0.1 bin units. Then I have in the second column the frequency from some
data. I have plotted them and they look roughly Gaussian. So I want to fit
them/ find/optimize "mu", "sigma", and "A".
So I call the nls function :
nls_AB <- nls(x ~ (A/sig*sqrt(2*pi))* exp(-1*((x-mu)^2/(2*
sig^2))),data=temp, start= list(A=0.1, mu=0.01, sig=0.5), trace=TRUE)
Error in eval(expr, envir, enclos) : numeric 'envir' arg not of length one
Temp looks like this:
bin x
[1,] -4.0 0
[2,] -3.9 0
[3,] -3.8 0
...........