# Find the maximum of a multivariable (arbitrary) function

**URL:** <https://discourse.julialang.org/t/find-the-maximum-of-a-multivariable-arbitrary-function/34578>\
**Category:** General Usage\
**Tags:** question\
**Created:** [February 13, 2020, 2:38pm UTC](https://discourse.julialang.org/t/find-the-maximum-of-a-multivariable-arbitrary-function/34578 "2020-02-13T14:38:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![samantp](https://avatars.discourse-cdn.com/v4/letter/s/f475e1/32.png) [@samantp](https://discourse.julialang.org/u/samantp)\
**Post date:** [February 13, 2020, 2:38pm UTC](https://discourse.julialang.org/t/find-the-maximum-of-a-multivariable-arbitrary-function/34578/1 "2020-02-13T14:38:35Z")

</div>

Does anyone know of some helpful functions in a stats package somewhere that can help me solve the following optimization problem?

So, I have 2 datasets, DVH1 and DVH2.  
I also have a function, NTCP, this is a known function with some adjustable parameters (contained in the vector a), and an argument (DVH)

and I want to find parameters (a) that maximize the following logliklihood ![Screenshot from 2020-02-13 14-32-47](https://global.discourse-cdn.com/julialang/original/3X/0/a/0afccc4970dae697f0d53a05a073be7864ddeaef.png)  
I will have some initial guess of the parameters in a.

Where i is over the dataset DVH1 and j is over the dataset DVH2.  
I know of some functions _called_ loglikihood in the Distributions.jl package, but I am not sure how to use this to solve my problem. Is there a function in Stats or Distributions or some other package that allows me to find a local maximum of logliklihood for any arbitrary function given some parameters to fit?

Note: I hope I am being clear enough but happy to elaborate further on my specific problem. It is outlined in this paper: [https://www.sciencedirect.com/science/article/pii/S0360301611005244?via%3Dihub](https://www.sciencedirect.com/science/article/pii/S0360301611005244?via%3Dihub) , equation 8, for those of you with elsevier access.

Thanks,

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [February 13, 2020, 8:03pm UTC](https://discourse.julialang.org/t/find-the-maximum-of-a-multivariable-arbitrary-function/34578/2 "2020-02-13T20:03:47Z")

</div>

I usually use the following packages for optimization:

> **[GitHub - JuliaNLSolvers/Optim.jl: Optimization functions for Julia](https://github.com/JuliaNLSolvers/Optim.jl)**
>
> Optimization functions for Julia. Contribute to JuliaNLSolvers/Optim.jl development by creating an account on GitHub.

> **[GitHub - JuliaOpt/NLopt.jl: Package to call the NLopt nonlinear-optimization...](https://github.com/JuliaOpt/NLopt.jl)**
>
> Package to call the NLopt nonlinear-optimization library from the Julia language - GitHub - JuliaOpt/NLopt.jl: Package to call the NLopt nonlinear-optimization library from the Julia language
