I‘m trying to estimate the parameters of a simple model, but I keep getting the same error message: „could not calculate numerical derivatives missing values encountered, flat or discontinuous region encountered“

program define logit_error1

*** args lnf q alpha beta mu

*** replace `lnf' = (1-`q')*(2-`beta')/`mu'-ln(exp((1-`q')*(2-`beta')/`mu')+exp((`q')*(1-`alpha')/`mu')) if chooseup==1

*** replace `lnf' = (`q')*(1-`alpha')/`mu'-ln(exp((1-`q')*(2-`beta')/`mu')+exp((`q')*(1-`alpha')/`mu')) if chooseup==0***

end

ml model lf logit_error1 (chooseup) (q: op_out_up) (alpha (beta (mu*

ml max

I simplified my program as much as possible to make it a bit more accessible. For your understanding: chooseup is my dependent binary variable, q is a probability 0≤q≤1. alpha, beta and mu are the parameters of interest.

Also, I tried to avoid singularities by excluding q=1, q=1, mu≤0, but that didn‘t really change anything...

Thanke you all in advance!

thafox