jamesbrandecon / FRAC.jl

This package estimates mixed logit demand models using the fast, "robust", and approximately correct (FRAC) approach developed by Salanie and Wolak (2019).
MIT License
20 stars 1 forks source link

negative float or complex number appearing in example code execution #1

Closed ShankarChavan closed 3 years ago

ShankarChavan commented 3 years ago

I have tried running the example code shared but I'm getting complex number error. Can you please help in same.

` julia> @time results = estimateFRAC(data = df, linear= "prices + x", nonlinear = "prices + x", by_var = "by_example", fes = "product_ids + dummy_FE", se_type = "robust", constrained = true)

ERROR: DomainError with -1.2665455088715354: log will only return a complex result if called with a complex argument. Try log(Complex(x)). Stacktrace: [1] throw_complex_domainerror(f::Symbol, x::Float64) @ Base.Math ./math.jl:33 [2] log(x::Float64) @ Base.Math ./special/log.jl:285 [3] _broadcast_getindex_evalf @ ./broadcast.jl:648 [inlined] `

jamesbrandecon commented 3 years ago

Thanks for making an issue. The example file runs for me using Julia v1.6. Are you running example1.jl exactly as-is?

ShankarChavan commented 3 years ago

Thanks James for updating, I tried the example file instead of running line by line and it worked.