Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# st: What is the maximum dimension for the Hessian in ML?

 From <[email protected]> To <[email protected]> Subject st: What is the maximum dimension for the Hessian in ML? Date Fri, 2 Mar 2012 10:47:17 -0500

```Hello all,

This is my second post on this issue, maybe my first one was unclear.

I am modelling a non-linear discrete labour supply model with the ml command.  My approach is similar to Daniele Pacifico's 2009 paper A Behavioural microsimulation model with discrete labour supply for Italian couples, although I only look at singles for now.

I started with a simple version of the model and I added I complexity with time to ensure everything works fine (I always use ml check, d1debug, and d2debug).

With a quadratic utility function and taking into account fixed-cost of working, I estimate 7 equations and I have a 7 by 7 Hessian.  Everything run smoothly at that point.

When I introduce unobserved heterogeneity in my model, as done by Hann and Uhlendorff (Stata Journal 2006), and use a simulated ml approach, both my d0 and d1 method works but d2 stop working.

At that point, I have a 8 by 8 Hessian.

Ml check provides this output:

. ml check

Test 1:  Calling LS_singles_quad_fx2_het_d2 to check if it computes log likelihood and
does not alter coefficient vector...
Passed.

Test 2:  Calling LS_singles_quad_fx2_het_d2 again to check if the same log likelihood value
is returned...
Passed.

Test 3:  Calling LS_singles_quad_fx2_het_d2 to check if 1st derivatives are computed...
Passed.

Test 4:  Calling LS_singles_quad_fx2_het_d2 again to check if the same 1st derivatives are
returned...
Passed.

Test 5:  Calling LS_singles_quad_fx2_het_d2 to check if 2nd derivatives are computed...

(...)

- matrix `negH' =(`dy_dy', `dy_dh', `dy_dysq', `dy_dhsq', `dy_dyh', `dy_dfcw', `dy_dfcwft', `dy_drl11' \ `dh_dy'', `dh_dh', `dh_dysq', `dh_dhsq', `dh_dyh', `dh_dfcw', `dh_dfcwft', `dh_drl11
> ' \ `dysq_dy'', `dysq_dh'', `dysq_dysq', `dysq_dhsq', `dysq_dyh', `dysq_dfcw', `dysq_dfcwft', `dysq_drl11' \ `dhsq_dy'', `dhsq_dh'', `dhsq_dysq'', `dhsq_dhsq', `dhsq_dyh', `dhsq_dfcw', `dhsq_dfcwft', `
> dhsq_drl11' \ `dyh_dy'', `dyh_dh'', `dyh_dysq'', `dyh_dhsq'', `dyh_dyh', `dyh_dfcw', `dyh_dfcwft', `dyh_drl11' \ `dfcw_dy'', `dfcw_dh'', `dfcw_dysq'', `dfcw_dhsq'', `dfcw_dyh'', `dfcw_dfcw', `dfcw_dfcw
> ft', `dfcw_drl11' \ `dfcwft_dy'',`dfcwft_dh'',`dfcwft_dysq'',`dfcwft_dhsq'',`dfcwft_dyh'',`dfcwft_dfcw'',`dfcwft_dfcwft', `dfcwft_drl11' \ `drl11_dy'' ,`drl11_dh'', `drl11_dysq'', `drl11_dhsq'', `drl11
> _dyh'', `drl11_dfcw'', `drl11_dfcwft'', `drl11_drl11')

= matrix ML_V =(__0000D0, __0000D1, __0000D2, __0000D3, __0000D4, __0000D5, __0000D6, __0000D7 \ __0000D9', __0000DA, __0000DB, __0000DC, __0000DD, __0000DE, __0000DF, __0000DG \ __0000DI',
>  __0000DJ', __0000DK, __0000DL, __0000DM, __0000DN, __0000DO, __0000DP \ __0000DR', __0000DS', __0000DT', __0000DU, __0000DV, __0000DW, __0000DX, __0000DY \ __0000E0', __0000E1', __0000E2', __0000E3',
> __0000E4, __0000E5, __0000E6, __0000E7 \ __0000E9', __0000EA', __0000EB', __0000EC', __0000ED', __0000EE, __0000EF, __0000EG \ __0000EI',__0000EJ',__0000EK',__0000EL',__0000EM',__0000EN',__0000EO, __00
> 00EP \ __0000ER' ,__0000ES', __0000ET', __0000EU', __0000EV', __0000EW', __0000EX', __0000EY)
too many literals

I've tried simplifying my formulas, but because of non-linearity this is a real challenge and it provided to be an unsuccessful attempt.

As d2 is typically much faster an reliable, I'd like to know is there is a way to get around this issue? Is an 8 by 8 Hessian the biggest Hessian STATA can take?

Would MATA allow me to get over this issue?

Regards,
Jean-François Bertrand

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```