Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Convergence in MLE

    Dear Stata-Community,

    I am a Stata-Rookie and have just started using Stata to perform a ML estimation, in which I am trying to adapt the code used in a published paper (Coate & Conlin, 2004: https://www.aeaweb.org/articles?id=1...3052231&within[author]=on&journal=1&q=coate&from=j for the paper and the code).

    My likelihood function consists of several vectors (namely v w b x c) that each include independents and parameters to be estimated. With "ibeta(`v',`w',.5)" I want to implement the primitive function of the beta-function with shape parameters v and w at .5 .

    At the moment my code reads:

    program define vote
    args lnf be xe ce ve we
    tempvar v w b x c lnuj bvw bvws K eps neps

    * Assumptions for functional forms
    quietly gen double `v' = exp(`ve')
    quietly gen double `w' = exp(`we')
    quietly gen double `b' = exp(`be')
    quietly gen double `x' = exp(`xe')
    quietly gen double `c' = exp(`ce')

    * Further things that show up in the likelihood function
    quietly gen double `bvw'=exp(lngamma(`v'))*exp(lngamma(`w'))/exp(lngamma(`v'+`w'))
    quietly gen double `bvws'=exp(lngamma(`v'+1))*exp(lngamma(`w'))/exp(lngamma(`v'+1+`w'))
    quietly gen double `K' = ibeta(`v',`w',.5)-`bvws'/`bvw'-.5

    * Log of joint PDF - Part 1
    quietly gen double `lnuj' = `v'*ln(`x')+`w'*ln(`b')+(`v'-1)*ln($ML_y1)+(`w'-1)*ln($ML_y2)-(`v'+`w'+1)*ln($ML_y1*`b'+$ML_y2*`x')+ln($ML_y1+$M L_y2)-ln(`bvw')-.5*ln(2*_pi)

    * Log of joint PDF - preliminary Part 2
    quietly gen double `eps' = ln($ML_y1*`x'+$ML_y2*`b')-ln(`x'*`b')+ln(`c')-ln(2)+ln(`K')

    * Log of joint PDF - actual Part 2
    quietly gen double `neps' =-`eps'^2/2

    * Log of the joint PDF - Part 1 and Part 2 together
    quietly replace `lnf'= `neps'+`lnuj'

    end

    ml model lf vote (b: ffor fagainst=urban gdp loweduc res_for for_crime) (x:urban gdp loweduc res_for for_crime) (c:sun rain snow_m snow_e temp, noconst)(v:loweduc for_vote party_pro unempl) (w


    When running ml check , the program passes all tests. The commands ml search and ml maximize then get the maximization going just fine. However, even after many, many iterations, no convergence is reached. I have tried the technique option with different algorithms, but was not able to achieve convergence.

    What other things can I try to get results, where are the problems with my code?
    Any help is greatly appreciated. Thank you!

    Kind regards,
    Martin



Working...
X