Optimization with Optim gives different results each time

That’s what you’re doing wrong: to get reproducible results, you clearly need to run a different block of code.

To give you more precise advice than that, we’ll need to see the code you’re running, and some other things described here.

1 Like