Hello, I am trying to fit a exponential power distribution
y = b/(2*pi*a^2*gamma(2/b))*exp(-(x/a)^b) to a bunch of data for x and y I have in a table. > data x y 1 25 27 2 75 59 3 125 219 ... 259 12925 1 260 12975 0 I know "optim" should do a minimisation, therefor I used as the optimisation function opt.power <- function(val, x, y) { a <- val[1]; b <- val[2]; sum(y - b/(2*pi*a^2*gamma(2/b))*exp(-(x/a)^b)); } I call: (with xm and ym the data from the table) a1 <- c(0.2, 100) opt <- optim(a1, opt.power, method="BFGS", x=xm, y=ym) but no optimisation of the parameter in a1 takes place. Any ideas? -- Ciao Ronald ______________________________________________ R-help@r-project.org mailing list 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.