I think your function has to return a Float64
instead of an Int
. Try this:
# These shouldn't be inside the function or you have to read the
# data frame _every_ time it gets called!!!
const df = CSV.read("data_estimation.csv", DataFrame; header=true)
const n = nrow(df)
function likelihood(ρ::T, α::T, fB::T, fS::T, fO::T, δ::T...) where {T}
sum = zero(T)
for i in 1:n
# ...
end
return -sum
end
Also: please read Please read: make it easier to help you. It’s easier to help if you post a minimal working example demonstrating the error.