Hi, I’ve been trying to perform a MLE procedure with JuMP but constantly run into an error. A snippet of my code is as follows:
using Distributions
using JuMP
norm_cdf(x) = cdf(Normal(), x) #where Normal() is from Distributions
norm_pdf(x) = exp(-(x^2)/2)/sqrt(2*pi)
norm_dpdf(x) = x*norm_pdf(x)
mod = Model()
JuMP.register(mod, :norm_dist, 1, norm_cdf, norm_pdf, norm_dpdf)
@variable( mod, α[i = 1:8] )
@NLobjective(
mod,
Max,
sum(
sum(
log( norm_dist(
q[t]*( α[1] + sum(α[j+1]*x[t,j] for j in 1:7) )
)) for t in (T[i]+1):T[i+1]
) for i in 1:I
)
)
where x is a DataFrame, T and q are Arrays.The error that I received after running @NLobjective is:
Unexpected object missing in nonlinear expression.
Stacktrace:
[1] error(::String) at .\error.jl:33
[2] parseNLExpr_runtime(::Model, ::Missing, ::Array{ReverseDiffSparse.NodeData,1}, ::Int64, ::Array{Float64,1}) at C:\Users\krenova\.julia\packages\JuMP\PbnIJ\src\parsenlp.jl:207
[3] top-level scope at C:\Users\krenova\.julia\packages\JuMP\PbnIJ\src\parseExpr_staged.jl:508
Wonder what went wrong.