Announcement

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

  • Error with cmp command : r 503 "J(): 3900 function returned error initial vector conformability error"

    Hi everyone,

    I used the cmp command to estimate a system of 3 equations:
    - a linear regression (granted credit amount)
    - a probit model, which is also the selection condition for the first equation (acceptance or rejection of the application)
    - a linear regression (requested credit amount)

    here is my command:

    cmp (montantacc= montantdem x3 x4 x5 ....Branch : ) (Octroi= montantdem instr2 x3 x4 x 5.... || Branch : ) (montantdem= instr1 x2 x3 x4 x5.... || Branch : ), ind(Octroi*1 4 1) tech(dfp) nonrtol


    Then, the 3 individual models are fit but for the full model I receive this error message:

    "Fitting constant-only model for LR test of overall model fit.
    J(): 3900 unable to allocate real <tmp>[37875,6]
    cmp_lnL(): - function returned error
    <istmt>: - function returned error
    initial vector: matrix must be dimension 14
    conformability error
    conformability error"

    I guess the problem comes from the selection after the comma: ind(Octroi*1 4 1)

    Maybe it is an error syntax ?

    Thanks for your help !

    Last edited by Mathilde Bauwin; 04 Dec 2015, 07:19.

  • #2
    Ensure first that you have the latest version of cmp from SSC (ssc install cmp, replace or adoupdate cmp, update ssc)

    Code:
    . which cmp
    d:\home\stephenj\ado\stbplus\c\cmp.ado
    *! cmp 6.9.5 29 November 2015
    *! Copyright (C) 2007-15 David Roodman
    *! Version history at bottom
    If you continue to have problems after doing this, you'll probably have to provide additional information such as your version of Stata, platform, etc. You might also have to re-compile your Mata libraries, perhaps (but I'm only guessing about this, and I am ignorant of Mata details).

    Comment


    • #3
      ok so you mean that it should not be linked with this part of the command: "ind(Octroi*1 4 1)" ? because on the help cmp page, actually it is written to type: ind(Octroi 4 1), without the interaction Octroi*1, contrary to the case when both equations are probit. So I guessed that I should not type Octroi*1 because one equation is probit (the selection one) and the other one is continuous. But you do not think it should be the problem ?
      By the way my cmp command has been updated this morning !

      Comment


      • #4
        The error you got is "J(): 3900 unable to allocate real <tmp>[37875,6]", which means Stata tried to allocate memory for a matrix of size 37875 by 6 and failed. Given a matrix of size 37875 by 6 only takes less than 2MB memory, which is rather small, I would first check your memory usage before calling cmp, maybe you have a very large dataset loaded to the point Stata is almost run out memory. You can type memory in Stata command window to get the information of memory usage. Also, which version of Stata are you running, before or after Stata 12, 32bit or 64bit? You can get those information from the output of about.

        Comment


        • #5
          Hi, thank you very much, this should be the problem I guess.
          So I typed memory and here is what I get:
          Memory usage used allocated
          data 138,105,603 201,326,592
          Str Ls 0 0
          data & strLs 138,105,603 201,326,592
          var. names, %fmts, ... 42,785 73,903
          overhead 1,081,384 1,082,144
          Stata matrices 0 0
          ado-files 0 0
          stored results 0 0
          Mata matrices 0 0
          Mata functions 0 0
          set maxvar usage 1,431,736 1,431,736
          other 3,568 3,568
          grand total 140,662,676 203,917,943
          .

          Does it mean that Stata is almost run out of memory ?
          Here comes the information out of about:
          Stata/SE 13.0 for Windows (64-bit x86-64)
          Total physical memory: 4080796 KB
          Available physical memory: 2769576 KB

          What do you recommend I should do ?

          Thank you very much
          Last edited by Mathilde Bauwin; 05 Dec 2015, 05:33.

          Comment


          • #6
            The output from memory looks quite reasonable, you are using ~200MB of memory for data and you have access to ~2.7GB of total memory. Maybe -cmp- was using a large chunk of memory. One way to find out run you -cmp- again, wait till the error happens, then run -memory- to see the memory usage at that moment.

            Also, I noticed your Stata is out-of-date, I would suggest run -update all- to update Stata to see if it makes any difference.

            Comment


            • #7
              Dear listers,
              I am having "r3900" error but I am pretty sure it is not about my RAM. First I got this error both in Mac and Windows machines with 8GB RAM. Then I run it in EC2 machine with 60GB RAM. This is the cmp command:


              Code:
              cmp (eq1:ojs3 = x1 x2 x3 x4 i.x4  x6  x7)  ///
                  (sel:employed = x1 x2 x3 x4 i.x4  x6  x7 x8) , /// 
                      indicators("employed*$cmp_mprobit" $cmp_probit) nolr nonrtol
              This is the error message:

              Code:
              #:    3900    unable to allocate real    <tmp>[3486784401,1]
              halton2():    -    function returned error
              ghk2setup():    -    function returned error
              cmp_model::cmp_init():    -    function returned error
              <istmt>:    -    function returned error
              Mata run-time error
              r(3900);
              This is the memory just after the cmp error:
              Code:
              Memory usage
                      used    allocated
                          
              data        171,286,306    268,435,456
              strLs        0    0
                          
              data & strLs        171,286,306    268,435,456
              
                          
              data & strLs        171,286,306    268,435,456
              var. names, %fmts,    ...    25,487    63,499
              overhead        3,178,544    3,178,944
              
              Stata matrices        0    0
              ado-files        313,313    313,313
              stored results        0    0
              
              Mata matrices        136,000    136,000
              Mata functions        163,472    163,472
              
              set maxvar usage        5,281,738    5,281,738
              
              other        7,474    7,474
                          
              grand total        180,121,822    277,579,896
              So, it cannot be an insufficient pyshical memory problem right? I just installed cmp. Hence it should be the latest version. I appreciate any help.

              Comment

              Working...
              X