Is there a way to maximize/minimize a custom function in R?

I’m trying to minimize a custom function. It should accept five parameters and the data set and do all sorts of calculations, producing a single number as an output. I want to find a combination of five input parameters which yields smallest output of my function.


I wrote a post listing a few tutorials using optim.

Here is a quote of the relevant section:

  • “The combination of the R function optim and a custom created objective
    function, such as a minus log-likelihood function provides a powerful tool for
    parameter estimation of custom models.

  • Attribution
    Source : Link , Question Author : user333 , Answer Author : Henrik

    Leave a Comment