Skip to content
Prev 167259 / 398503 Next

Using "optim" with exponential power distribution

It looks to me like your optimising the _average_ of the differences  
between y and the function, so as long as positive and negative  
differences balance out you get a cost value of 0 (and you can make it  
even smaller if the fitted function is much larger than the actual y  
values, so all differences are negative).

You probably wanted to minimise the squared errors:

	sum((y - b/(2*pi*a^2*gamma(2/b))*exp(-(x/a)^b)))^2)




Best regards,
Stefan Evert

[ stefan.evert at uos.de | http://purl.org/stefan.evert ]