We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.

Wan • 6 years ago

Hi Edward, nice read!

One question about the `optim` method argument which I believe your explanation is actually misleading.

It's true that when arg is NULL, match.arg will return the first element of choice.
But in the `optim` case, method is not null and the default method is set as c("Nelder-Mead", "BFGS", "CG", "L-BFGS-B", "SANN", "Brent"). (see formals(optim))

So what actually happens for `optim` is when `optim` calls match.arg(method), it checks formal arguments of method and set it as choice. When choice and method are both not null and identical, it returns the first element of choice. (See line 13-14 of match.arg source code.)

Let me know your thoughts,

Shu