Announcement

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

  • ml maximize, technique(bhhh): option technique() not allowed

    Hello,

    I have some problems using the maximum likelihood command of Stata to estimate a probit model.
    Here is a simplified example of my problem: I am interested in estimating the effect of past experienced stock market returns of households on their stock market participation (controlling for other household characteristics).

    This is my likelihood function:
    -----------------------------------------------------------------------------------------------------
    capture program drop nlprobitlf_stock
    program nlprobitlf_stock
    version 11
    args lnfj xb b k
    tempvar xnl


    global lambda = `k'

    rmatcalc_stock

    quietly generate double `xnl' = w
    drop w

    quietly replace `lnfj' = lnnormal(`xb'+`b'*`xnl') if ($ML_y1 == 1)
    quietly replace `lnfj' = lnnormal(-`xb'-`b'*`xnl') if ($ML_y1 == 0)

    end

    ----------------------------------------------------------------------------------------------------
    where rmatcalc_stock is a function that calculates the weighted sum of the stock returns a household experienced during its lifetime. The weights depend on k, which should also be estimated within the probit model.

    This is my code for the optimization problem:
    --------------------------------------------------------------------------------------------------------------------------------
    ml model lf nlprobitlf_stock (`dependent_var' = `controls') /b /k [pweight = wgt]
    ml search /// search initial value
    ml maximize, difficult technique (bhhh) nonrtolerance

    ---------------------------------------------------------------------------------------------------------------------------------
    If I run this, I get the following error message:

    initial: log pseudolikelihood = -2.388e+08
    rescale: log pseudolikelihood = -3395333.6
    rescale eq: log pseudolikelihood = -3385030.8
    Iteration 0: log pseudolikelihood = -3385030.8
    Iteration 1: log pseudolikelihood = -2737459.7 (not concave)
    Iteration 2: log pseudolikelihood = -2685007.4
    Iteration 3: log pseudolikelihood = -2681058.8 (not concave)
    Iteration 4: log pseudolikelihood = -2680772 (not concave)
    Iteration 5: log pseudolikelihood = -2680771.5
    Iteration 6: log pseudolikelihood = -2680524.6
    Iteration 7: log pseudolikelihood = -2680520.2
    Iteration 8: log pseudolikelihood = -2680520.2 (backed up)
    option technique() not allowed

    Does anyone know where this error may come from? Thank you very much in advance!





  • #2
    While the ml maximize command allows you to specify options from the maximize command, only some of those options are available, and from the output of help ml (specifically, help ml##ml_maxopts ) we see that the technique() option is not among those that are allowed.

    maximize_options: difficult, iterate(#), [no]log, trace, gradient, showstep, hessian,
    showtolerance, tolerance(#), ltolerance(#), nrtolerance(#), and nonrtolerance; see
    [R] Maximize. These options are seldom used.

    Comment


    • #3
      Thank you William Lisowski,

      Thank you for your answer! However, I am using the code from a paper and they use this option technique(bhhh), so I find it weird that this option does not exist?

      Comment


      • #4
        I agree entirely with your assessment.

        I spent some time digging through "help whatsnew" files from the current and older versions of Stata, and they suggest that in the past the technique() option could be used with ml maximize, and does not turn up anything suggesting that there was a change to this.

        Unless another member can suggest an alternative explanation, I'd recommend you contact Stata Technical Services for their advice. If you do, please report back here with what you've learned.

        Comment


        • #5
          Hi Chi Hyun Kim and William,

          if you look at help ml, the technique() option shows up under model_options. If we go back to the top of the help file, we can see that model_options are to be specified with ml model. Here is an example:

          Code:
          . * Evaluator:
          . program probit_d2
            1.     version 16
            2.     args todo b lnfj g H
            3.     tempvar xb
            4.     mleval `xb' = `b'
            5.     mlsum `lnfj' = lnnormal(cond($ML_y1 == 1, `xb', -`xb'))
            6.     if (`todo' == 0) exit
            7.     tempname d1
            8.     tempvar d1ll
            9.     gen double `d1ll' = cond($ML_y1 == 1,               ///
          >                            normalden(`xb')/normal(`xb'),   ///             
          >                           -normalden(`xb')/normal(-`xb'))  
           10.     mlvecsum `lnfj' `d1' = `d1ll'
           11.     matrix `g' = (`d1')
           12.     if (`todo' == 1) exit
           13.     mlmatsum `lnfj' `H' = -`d1ll'*(`d1ll'+`xb'), eq(1,1)
           14. 
          . end
          
          . 
          . * Data:
          . set seed 123
          
          . set obs 1000
          number of observations (_N) was 0, now 1,000
          
          . gen double x1 = runiform()
          
          . gen double x2 = runiform()
          
          . gen double e  = rnormal()
          
          . gen double y  = (-1 + x1 + x2 + e) > 0
          
          . 
          . * Model:
          . ml model d2 probit_d2 (xb: y = x1 x2), technique(bfgs)
          
          . ml maximize
          
          initial:       log likelihood = -693.14718
          alternative:   log likelihood = -769.20123
          rescale:       log likelihood = -693.11674
          Iteration 0:   log likelihood = -693.11674  
          Iteration 1:   log likelihood = -686.62411  (backed up)
          Iteration 2:   log likelihood = -645.50395  (backed up)
          Iteration 3:   log likelihood = -644.95954  
          Iteration 4:   log likelihood = -639.33729  
          Iteration 5:   log likelihood = -638.27955  
          Iteration 6:   log likelihood = -638.27796  
          Iteration 7:   log likelihood = -638.27796  
          
                                                          Number of obs     =      1,000
                                                          Wald chi2(2)      =     103.13
          Log likelihood = -638.27796                     Prob > chi2       =     0.0000
          
          ------------------------------------------------------------------------------
                     y |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
          -------------+----------------------------------------------------------------
                    x1 |    1.07918   .1468312     7.35   0.000     .7913966    1.366964
                    x2 |   1.065277   .1414276     7.53   0.000     .7880843     1.34247
                 _cons |  -1.089052   .1139454    -9.56   0.000    -1.312381   -.8657236
          ------------------------------------------------------------------------------
          Best,
          Joerg

          Comment

          Working...
          X