Maximum likelihood optimization problem through Optim.jl

Jian_ZUO
Tue, 12 Jul 2022 09:38:55 +0000
Optimization (Mathematical)

Hi,
I am trying to solve a likelihood function in Optim as follows:
I have some increments which are gamma-distributed (Ga(a*t, β)):
det_x = [0.0175, 0.0055, 0.0059] # increments
det_t = [185, 163, 167] # corresponding time
I want to estimate parameters a, and b from the above data.
I used the following program:

using SpecialFunctions
using Distributions, LinearAlgebra, Statistics
using Optim, NLSolversBase
det_R = [0.0175, 0.0055, 0.0059] # increments
det_w = [185, 163, 167] # corresponding time
## density function for Gamma(a*t, β)
gamma_dens(x, a, β, t) = (x^(a*t-1)*exp(-x/β))/(β^(a*t)*gamma(a*t))
function L(x)
    log(gamma_dens(det_R[1], x[1], x[2], det_w[1])) +
    log(gamma_dens(det_R[2], x[1], x[2], det_w[2])) +
    log(gamma_dens(det_R[3], x[1], x[2], det_w[3]))
end
x0 = [1e-3, 1e-3]
opt = optimize(L, x0)

But I got error message saying:
Output exceeds the [size limit](command:workbench.action.openSettings?[). Open the full output data [in a text editor](command:workbench.action.openLargeOutput?81dfbb88-756a-4313-986f-379f044b325b)
DomainError with -0.0245: Exponentiation yielding a complex result requires a complex argument. Replace x^y with (x+0im)^y, Complex(x)^y, or similar.
How can I solve this optimization problem?
Thank you very much!

15 posts - 3 participants