Dear STATA experts,
Could you please look at my codes and see how should I solve this error? What should be the reason for this problem? I come across with this problem:
could not calculate numerical derivatives -- discontinuous region with missing values
encountered
Below is all my codes.
.
. local consvars=" AGELAST FAMS region* marital*"
.
. local partvars="AGELAST region* marital*"
.
. program doublehurdle_bvn
1. version 12
2. args lnf beta alpha_ lnsigma thetat
3. tempvar sigma F_eps_d F_eps_c f_eps F_u copula deriv_cop theta
4. qui gen double `theta'=tanh(`thetat')
5. qui gen double `sigma'=exp(`lnsigma')
6. qui gen double `F_eps_d'=normal(-`beta'/`sigma')
7. qui gen double `F_eps_c'=normal(($ML_y1-`beta')/`sigma')
8. qui gen double `f_eps'=normalden(($ML_y1-`beta')/`sigma')/`sigma'
9. qui gen double `F_u'=normal(-`alpha_')
10. qui gen double `copula'=binormal(invnormal(`F_eps_d'),invnormal(` F_u'),`thet
> a')
11. qui gen double `deriv_cop'=normal((1-`theta'^2)^(-1/2)*(invnormal(`F_u')-`th
> eta'*invnormal(`F_eps_c')))
12. qui replace `lnf'=log(1-binormal(`alpha_',`beta'/`sigma',`theta')) if $ML_y1
> ==0
13. qui replace `lnf'=log(normal((`alpha_'+`theta'/`sigma'*($ML_y1-`beta'))/sqrt
> (1-`theta'^2))*normalden(($ML_y1-`beta')/`sigma')/`sigma') if $ML_y1>0
14. end
.
. ml model lf doublehurdle_bvn (worked=`consvars') (everworked=`partvars') (lnsigma,nocon
> s) (theta,nocons)
note: region4 omitted because of collinearity
note: maritals5 omitted because of collinearity
note: region4 omitted because of collinearity
note: maritals5 omitted because of collinearity
. capture noisily ml maximize, iter(1000)
initial: log likelihood = -<inf> (could not be evaluated)
feasible: log likelihood = -32218.061
rescale: log likelihood = -3456.0122
rescale eq: log likelihood = -3425.1135
could not calculate numerical derivatives -- discontinuous region with missing values
encountered
. *outreg2 using myreg1.doc, replace addnote(1) e(all)
.
.
. program doublehurdle_gaussian1
1. version 12
2. args lnf beta alpha_ lnsigma thetat
3. tempvar sigma F_eps_d F_eps_c f_eps F_u copula deriv_cop theta
4. qui gen double `theta'=tanh(`thetat')
5. qui gen double `sigma'=exp(`lnsigma')
6. qui gen double `F_eps_d'=normal(-`beta'/`sigma')
7. qui gen double `F_eps_c'=normal(($ML_y1-`beta')/`sigma')
8. qui gen double `f_eps'=normalden(($ML_y1-`beta')/`sigma')/`sigma'
9. qui gen double `F_u'=normal(-`alpha_')
10. qui gen double `copula'=binormal(invnormal(`F_eps_d'),invnormal(` F_u'),`thet
> a')
11. qui gen double `deriv_cop'=normal((1-`theta'^2)^(-1/2)*(invnormal(`F_u')-`th
> eta'*invnormal(`F_eps_c')))
12. qui replace `lnf'=log(`F_eps_d'+`F_u'-`copula') if $ML_y1==0
13. qui replace `lnf'=log((1-`deriv_cop')*`f_eps') if $ML_y1>0
14. end
.
. ml model lf doublehurdle_gaussian1 (worked=`consvars') (everworked=`partvars') (lnsigma
> ,nocons) (aththeta,nocons)
note: region4 omitted because of collinearity
note: maritals5 omitted because of collinearity
note: region4 omitted because of collinearity
note: maritals5 omitted because of collinearity
. capture noisily ml maximize
initial: log likelihood = -<inf> (could not be evaluated)
feasible: log likelihood = -4534.5439
rescale: log likelihood = -3456.0122
rescale eq: log likelihood = -3425.1135
could not calculate numerical derivatives -- discontinuous region with missing values
encountered
. matrix A=(e(b),0,0)
last estimates not found
r(301);
end of do-file
r(301);
Could you please look at my codes and see how should I solve this error? What should be the reason for this problem? I come across with this problem:
could not calculate numerical derivatives -- discontinuous region with missing values
encountered
Below is all my codes.
.
. local consvars=" AGELAST FAMS region* marital*"
.
. local partvars="AGELAST region* marital*"
.
. program doublehurdle_bvn
1. version 12
2. args lnf beta alpha_ lnsigma thetat
3. tempvar sigma F_eps_d F_eps_c f_eps F_u copula deriv_cop theta
4. qui gen double `theta'=tanh(`thetat')
5. qui gen double `sigma'=exp(`lnsigma')
6. qui gen double `F_eps_d'=normal(-`beta'/`sigma')
7. qui gen double `F_eps_c'=normal(($ML_y1-`beta')/`sigma')
8. qui gen double `f_eps'=normalden(($ML_y1-`beta')/`sigma')/`sigma'
9. qui gen double `F_u'=normal(-`alpha_')
10. qui gen double `copula'=binormal(invnormal(`F_eps_d'),invnormal(` F_u'),`thet
> a')
11. qui gen double `deriv_cop'=normal((1-`theta'^2)^(-1/2)*(invnormal(`F_u')-`th
> eta'*invnormal(`F_eps_c')))
12. qui replace `lnf'=log(1-binormal(`alpha_',`beta'/`sigma',`theta')) if $ML_y1
> ==0
13. qui replace `lnf'=log(normal((`alpha_'+`theta'/`sigma'*($ML_y1-`beta'))/sqrt
> (1-`theta'^2))*normalden(($ML_y1-`beta')/`sigma')/`sigma') if $ML_y1>0
14. end
.
. ml model lf doublehurdle_bvn (worked=`consvars') (everworked=`partvars') (lnsigma,nocon
> s) (theta,nocons)
note: region4 omitted because of collinearity
note: maritals5 omitted because of collinearity
note: region4 omitted because of collinearity
note: maritals5 omitted because of collinearity
. capture noisily ml maximize, iter(1000)
initial: log likelihood = -<inf> (could not be evaluated)
feasible: log likelihood = -32218.061
rescale: log likelihood = -3456.0122
rescale eq: log likelihood = -3425.1135
could not calculate numerical derivatives -- discontinuous region with missing values
encountered
. *outreg2 using myreg1.doc, replace addnote(1) e(all)
.
.
. program doublehurdle_gaussian1
1. version 12
2. args lnf beta alpha_ lnsigma thetat
3. tempvar sigma F_eps_d F_eps_c f_eps F_u copula deriv_cop theta
4. qui gen double `theta'=tanh(`thetat')
5. qui gen double `sigma'=exp(`lnsigma')
6. qui gen double `F_eps_d'=normal(-`beta'/`sigma')
7. qui gen double `F_eps_c'=normal(($ML_y1-`beta')/`sigma')
8. qui gen double `f_eps'=normalden(($ML_y1-`beta')/`sigma')/`sigma'
9. qui gen double `F_u'=normal(-`alpha_')
10. qui gen double `copula'=binormal(invnormal(`F_eps_d'),invnormal(` F_u'),`thet
> a')
11. qui gen double `deriv_cop'=normal((1-`theta'^2)^(-1/2)*(invnormal(`F_u')-`th
> eta'*invnormal(`F_eps_c')))
12. qui replace `lnf'=log(`F_eps_d'+`F_u'-`copula') if $ML_y1==0
13. qui replace `lnf'=log((1-`deriv_cop')*`f_eps') if $ML_y1>0
14. end
.
. ml model lf doublehurdle_gaussian1 (worked=`consvars') (everworked=`partvars') (lnsigma
> ,nocons) (aththeta,nocons)
note: region4 omitted because of collinearity
note: maritals5 omitted because of collinearity
note: region4 omitted because of collinearity
note: maritals5 omitted because of collinearity
. capture noisily ml maximize
initial: log likelihood = -<inf> (could not be evaluated)
feasible: log likelihood = -4534.5439
rescale: log likelihood = -3456.0122
rescale eq: log likelihood = -3425.1135
could not calculate numerical derivatives -- discontinuous region with missing values
encountered
. matrix A=(e(b),0,0)
last estimates not found
r(301);
end of do-file
r(301);
Comment