Bookmark and Share

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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Capture failing on xtmixed


From   "Adrian Sayers" <[email protected]>
To   <[email protected]>
Subject   st: Capture failing on xtmixed
Date   Mon, 28 Jan 2013 14:25:21 -0000

Hi Nick,

I think you see why i  find it so strange.

Just to be clear the code sits in a loop
e.g. forvalues i = 1/1000 {
	capture xtmixed .....
				}
It just seems very odd that in this situation stata exits opposed to
skipping to the next line of code.

I am quite happy that xtmixed is unable to converge, i just dont want it to
kick me out of my loop.


To add some more detail to my problem, I have traced the code to try and
understand what is happening.

However i think this is one of those things that is a bit beyond me.

It seems like a proper bug, and perhaps its something that statacorp needs
to fix, but i am unclear about how to report this?

Thanks for any advice

bw
Adrian

 
-------------------------------------------------------------------------
begin mixed_ll ---
            - version 8.2
            - args todo b lnf
            - tempname s d err theta drho rho
            - scalar `s' = -1
            = scalar __00001F = -1
            - if $XTM_ctheta {
            = if 6 {
            - mat `theta' = `b'[1, 1..$XTM_ctheta]
            = mat __00001I = __00001A[1, 1..6]
            - }
            - else {
              mata: _xtm_null_rowvector("`theta'")
              }
            - if $XTM_res {
            = if 0 {
              mat `drho' = `b'[1, `=$XTM_ctheta+1'...]
              }
            - else {
            - mat `drho' = 0
            = mat __00001J = 0
            - }
            - mata: _xtm_drho_to_rho("`drho'", "`rho'", "`err'")
            = mata: _xtm_drho_to_rho("__00001J", "__00001K", "__00001H")
            - if scalar(`err') == 1 {
            = if scalar(__00001H) == 1 {
              scalar `lnf' = .
              }
            - mata: _xtm_theta_to_delta(`"`d'"',`"`theta'"',"`err'")
            = mata:
_xtm_theta_to_delta(`"__00001G"',`"__00001I"',"__00001H")
            - if scalar(`err') == 1 {
            = if scalar(__00001H) == 1 {
              scalar `lnf' = .
              }
            - else {
            - mata: _xtm_mixed_ll(`"`d'"',"`rho'","`s'",0)
            = mata: _xtm_mixed_ll(`"__00001G"',"__00001K","__00001F",0)
            - scalar `lnf' = r(ll)
            = scalar __00001B = r(ll)
            - }
 
---------------------------------------------------------------------------
end mixed_ll ---
Hessian is not negative semidefinite
 
--------------------------------------------------------------------------
end mopt.MaxMin ---
          }
 
----------------------------------------------------------------------------
- end mopt.Model ---
      - if c(rc) {
      - local rc = c(rc)
      - Clear
 
---------------------------------------------------------------------------
begin mopt.Clear ---
        - syntax [, NOTANOPTION]
        - capture drop $ML_w
        = capture drop __00000Y
        - capture drop $ML_samp
        = capture drop __00000Y
        - capture drop $ML_subv
        = capture drop 
        - capture drop $ML_grp
        = capture drop 
        - mata: Mopt_drop_external()
        - macro drop ML_*
 
----------------------------------------------------------------------------
- end mopt.Clear ---
      - exit `rc'
      = exit 430
        }
        exit
        }
 
----------------------------------------------------------------------------
--------- end mopt ---
      exit
      }
 
----------------------------------------------------------------------------
------------- end ml ---
  - if _rc | "`e(converged)'" == "0" {
  = if _rc | "" == "0" {
  - if _rc == 1 {
    exit 1
    }
  - local noconv noconv
  - mat `delta' = `deltaf'
  = mat __00000L = __00000M
  - mat `theta' = `thetaf'
  = mat __00000N = __00000O
  - }
  - tempname bb
  - mat `bb' = e(b)
  = mat __00000Y = e(b)
  - if $XTM_ctheta {
  = if 6 {
  - mat `theta' = `bb'[1,1..$XTM_ctheta]
  = mat __00000N = __00000Y[1,1..6]
conformability error
    }
    else {
    mata: _xtm_null_rowvector("`theta'")
    }
    if $XTM_res {
    mat `rho' = `bb'[1,`=$XTM_ctheta+1'...]
    }
    mata: _xtm_theta_to_delta("`delta'", "`theta'","`err'")
    local opt `e(opt)'
    local ml_method `e(ml_method)'
    local technique `e(technique)'
    }
    if $XTM_res {
    tempname rho2
    mata: _xtm_drho_to_rho("`rho'","`rho2'","`err'")
    mat `rho' = `rho2'
    }
    scalar `s' = -1
    mata: _xtm_mixed_ll("`delta'","`rho'","`s'",0)
    local ll_1 = r(ll)
    scalar `s' = r(mse)
    local ll_2 = `ll_1'
    mata: _xtm_theta_to_gamma("`gamma'","`theta'","`s'")
    tempname initfinal
    mat `initfinal' = `gamma'
    if $XTM_res {
    mat `initfinal' = `gamma', `rho'
    }
    if "`emonly'" == "" & "`stderr'" == "" {
    if _caller() >= 11 {
    mat `h' = e(ml_scale), 1
    }
    else {
    mat `h' = e(ml_d0_s), 1
    }
    local c = colsof(`theta')
    forvalues i = 1/`c' {
    mat `h'[1,`i'] = `h'[1,`i'] * abs(`gamma'[1,`i']/`theta'[1,`i'])
    }
    `q' di
    `q' di as txt "Computing standard errors:"
    `vv' cap ml model d0 mixed_ll_reparm `eqlist' /lnsig_e `reqlist', max
init(`initfinal',copy) search(
> off) iter(0) `dscale' collinear missing nopreserve `mlopts'
    if _rc {
    if _rc == 1 {
    exit 1
    }
    local nostd nostd
    local ll_2 = `ll_1'
    }
    else {
    local ll_2 = e(ll)
    if reldif(`ll_1',`ll_2') > 1e-10 {
    local nostd nostd
    }
    }
    if "`nostd'" != "" {
    di as err "standard-error calculation failed"
    if $XTM_res {
    ereturn clear
    error 430
    }
    }
    }
    mata: _xtm_mixed_ll("`delta'","`rho'","`s'",1)
    mata: _xtm_beta("`beta'","`Vbeta'","`s'")
    if "`emonly'"=="" & "`nostd'" == "" & "`stderr'"=="" {
    mat `gamma' = e(b)
    mat `V' = e(V)
    }
    else {
    local eqnames : subinstr local eqlist "/" "", all
    mat coleq `gamma' = `eqnames' lnsig_e
    mat colnames `gamma' = _cons
    local c = colsof(`gamma')
    mat `V' = J(`c',`c',0)
    }
    }
 
----------------------------------------------------------------------------
- end xtmixed.Estimate ---
- local rc = _rc
- ereturn local cmdline `"xtmixed `0'"'
= ereturn local cmdline `"xtmixed obs_ht  age_1 age_2 || id: age_1 age_2 ,
cov(unstruct)"'
- capture mata: _xtm_cleanup()
- capture mac drop XTM_*
- exit `rc'
= exit 503
----------------------------------------------------------------------------
------------ end xtmixed ---
r(503);






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


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index