[R] Using optim with exponential power distribution

2009-01-16 Thread Ronald Bialozyt
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 2527 2 7559 3125 219 ... 25912925 1 26012975

Re: [R] Using optim with exponential power distribution

2009-01-16 Thread Stefan Evert
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,