# estimation parameters using maximum likelihood

#### thafox

##### New Member
Hi everyone!

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...

thafox

#### wangwang

##### New Member

******************************

capture program drop logit_error1
program define logit_error1
args lnf q alpha beta mu
replace lnf' = -(1-q')*(2-beta')-ln(exp(-(1-q')*(2-beta'))+exp(-(q')*(1-alpha'))) if chooseup==1
replace lnf' = -(q')*(1-alpha')-ln(exp(-(1-q')*(2-beta'))+exp(-(q')*(1-alpha'))) if chooseup==0
end

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

Note that alpha', beta' and mu' are redundant. There are infinite combinations of them to make the same inf'. I replace mu' by a minus sign in the expression.

Hi everyone!

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...