Announcement

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

  • Tobit Command does not run on STATA 16 but does in STATA 13

    Hi All,

    I have some data from an RCT and wanted to run the a tobit model that looks at the determinants of value of some products based on the industry/ sector the firm is in. However when I run the command in STATA 16
    Code:
    tobit yvar sector `varlist' if surveytime == 0, ll
    I get the error <<convergence not achieved>>. But the tobit runs just fine when I run the exact command after changing to version 13. Is there any changes in the way different versions of stata executes a tobit model? Initially I followed some earlier posts on STATA list and ran a probit to check for perfect prediction and it did not seem to be the case. I have included some of the variables using -dataex-


    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input long yvar byte ran_sector double profit_margin
           0 3  20
           0 3   0
           . 3   .
           0 3  10
           0 3   8
           . 3   .
      250000 3   7
      500000 3   3
           . 3   .
     2000000 3  10
     3000000 3   5
           . 3   .
      800000 3   0
           0 3  50
           . 3   .
      150000 1  25
      150000 1  25
           . 1   .
           0 2  20
           0 2  30
           . 2   .
           0 3  25
           0 3  25
           . 3   .
      130000 3  25
      400000 3  11
           . 3   .
       50000 1  30
       80000 1  30
           . 1   .
      200000 3  30
      120000 3  60
           . 3   .
           0 3  20
           0 3  40
           . 3   .
      300000 1  40
     1000000 1  40
           . 1   .
      150000 1  50
      100000 1  30
           . 1   .
      170000 2  40
           0 2  40
           . 2   .
       34000 2  30
           0 2  25
           . 2   .
           0 2  20
           0 2   3
           . 2   .
           0 3   .
           0 3  10
           . 3   .
           . 3   .
       40000 3   .
           . 3   .
      300000 1  20
      300000 1  15
           . 1   .
           0 2  17
           0 2  20
           . 2   .
       60000 2  40
           0 2  25
           . 2   .
           0 3  50
           0 3  60
           . 3   .
           0 3  25
           0 3  20
           . 3   .
           0 2  30
           0 2  20
           . 2   .
       30000 3  20
       20000 3  15
           . 3   .
           0 3  10
           0 3  10
           . 3   .
           0 2  20
           0 2  10
           . 2   .
      256000 3  18
           0 3  20
           . 3   .
           0 2 100
           . 2   .
           . 2   .
           0 3  50
     5600000 3  10
           . 3   .
     5450000 1   5
    35000000 1   0
           . 1   .
       20000 3  15
           . 3   .
           . 3   .
           0 3   0
    end
    label values yvar dk_refuse
    label values profit_margin dk_refuse

    Thank you

  • #2
    The issue appears to be related to the scale of the dependent variable. You should contact Stata Tech Support. In the meantime you might try dividing through by 10,000.

    This problem can replicated with the auto data set:
    Code:
    . sysuse auto,clear
    (1978 Automobile Data)
    
    . replace mpg = 17 if mpg < 17
    (14 real changes made)
    
    . gen m2 = mpg  * 100000
    
    . tobit mpg price gear, ll nolog
    
    Tobit regression                                Number of obs     =         74
                                                       Uncensored     =         56
    Limits: lower = 17                                 Left-censored  =         18
            upper = +inf                               Right-censored =          0
    
                                                    LR chi2(2)        =      48.43
                                                    Prob > chi2       =     0.0000
    Log likelihood = -176.46259                     Pseudo R2         =     0.1207
    
    ------------------------------------------------------------------------------
             mpg |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
           price |  -.0008998    .000253    -3.56   0.001    -.0014042   -.0003954
      gear_ratio |   7.707567   1.386608     5.56   0.000     4.943414    10.47172
           _cons |   2.853392   4.714366     0.61   0.547    -6.544524    12.25131
    -------------+----------------------------------------------------------------
       var(e.mpg)|   22.56021   4.345473                      15.36686    33.12082
    ------------------------------------------------------------------------------
    
    . tobit m2 price gear, ll
    convergence not achieved
    convergence not achieved
    r(430);

    Comment


    • #3
      Hi Scott,

      Thank you for the prompt response. Unfortunately, scaling the variable did not resolve the issue. I will reach out to Stata Tech Support as you'd recommended. Thanks again.

      Lori

      Comment


      • #4
        Hi Lorien,

        I had a similar issue with a tobit command, I solved it writing "version 14" at the beginning of the code, I don't know if this could help...

        Comment


        • #5
          Whenever something doesn't work that used to work, a version command is one of the first things to try. You can then try to go through all the whatsnew files to figure out why and how something was changed/
          -------------------------------------------
          Richard Williams, Notre Dame Dept of Sociology
          StataNow Version: 19.5 MP (2 processor)

          EMAIL: [email protected]
          WWW: https://www3.nd.edu/~rwilliam

          Comment


          • #6
            Lorien Nair If you write back on what Stata Tech Support reports that would be helpful.

            Comment


            • #7
              Matteo Bulgarelli Yes, I was able to run the command on Stata 13 initially as mentioned in my earlier post. I am awaiting response from Tech support on why this is the case.

              Thanks everyone for your input.

              Comment


              • #8
                Did you try running it with version control? If so did it not work?
                -------------------------------------------
                Richard Williams, Notre Dame Dept of Sociology
                StataNow Version: 19.5 MP (2 processor)

                EMAIL: [email protected]
                WWW: https://www3.nd.edu/~rwilliam

                Comment


                • #9
                  Richard Williams It worked with version control, specifically works for versions 14 and older.

                  Comment


                  • #10
                    We re-implemented -tobit- with a stronger computation engine since Stata 15. Now, -tobit- accepts censoring and constraints. The general methods are the same in both versions. However, there is a difference in the parameterization of the scale for the error term. While the original -tobit- (version 14 and earlier) performs the optimization to find the standard deviation of the error term, the optimization in the new version finds the variance. This change can make the computations more sensitive to scaling problems in some cases.

                    We experimented on our side that rescaling your dependent var "yvar" by 1e3, then -tobit- would be able to fit your model. Or you can use -version- to invoke earlier versions.

                    Here is the modified code,​​​​​​
                    Code:
                    . input long yvar byte ran_sector double profit_margin
                    
                                 yvar  ran_se~r  profit_m~n
                      1.        0 3  20
                      2.        0 3   0
                      3.        . 3   .
                      4.        0 3  10
                      5.        0 3   8
                      6.        . 3   .
                      7.   250000 3   7
                      8.   500000 3   3
                      9.        . 3   .
                     10.  2000000 3  10
                     11.  3000000 3   5
                     12.        . 3   .
                     13.   800000 3   0
                     14.        0 3  50
                     15.        . 3   .
                     16.   150000 1  25
                     17.   150000 1  25
                     18.        . 1   .
                     19.        0 2  20
                     20.        0 2  30
                     21.        . 2   .
                     22.        0 3  25
                     23.        0 3  25
                     24.        . 3   .
                     25.   130000 3  25
                     26.   400000 3  11
                     27.        . 3   .
                     28.    50000 1  30
                     29.    80000 1  30
                     30.        . 1   .
                     31.   200000 3  30
                     32.   120000 3  60
                     33.        . 3   .
                     34.        0 3  20
                     35.        0 3  40
                     36.        . 3   .
                     37.   300000 1  40
                     38.  1000000 1  40
                     39.        . 1   .
                     40.   150000 1  50
                     41.   100000 1  30
                     42.        . 1   .
                     43.   170000 2  40
                     44.        0 2  40
                     45.        . 2   .
                     46.    34000 2  30
                     47.        0 2  25
                     48.        . 2   .
                     49.        0 2  20
                     50.        0 2   3
                     51.        . 2   .
                     52.        0 3   .
                     53.        0 3  10
                     54.        . 3   .
                     55.        . 3   .
                     56.    40000 3   .
                     57.        . 3   .
                     58.   300000 1  20
                     59.   300000 1  15
                     60.        . 1   .
                     61.        0 2  17
                     62.        0 2  20
                     63.        . 2   .
                     64.    60000 2  40
                     65.        0 2  25
                     66.        . 2   .
                     67.        0 3  50
                     68.        0 3  60
                     69.        . 3   .
                     70.        0 3  25
                     71.        0 3  20
                     72.        . 3   .
                     73.        0 2  30
                     74.        0 2  20
                     75.        . 2   .
                     76.    30000 3  20
                     77.    20000 3  15
                     78.        . 3   .
                     79.        0 3  10
                     80.        0 3  10
                     81.        . 3   .
                     82.        0 2  20
                     83.        0 2  10
                     84.        . 2   .
                     85.   256000 3  18
                     86.        0 3  20
                     87.        . 3   .
                     88.        0 2 100
                     89.        . 2   .
                     90.        . 2   .
                     91.        0 3  50
                     92.  5600000 3  10
                     93.        . 3   .
                     94.  5450000 1   5
                     95. 35000000 1   0
                     96.        . 1   .
                     97.    20000 3  15
                     98.        . 3   .
                     99.        . 3   .
                    100.        0 3   0
                    101. end
                    
                    . version 14:tobit yvar ran_sector profit_margin,ll
                    
                    Tobit regression                                Number of obs     =         62
                                                                       Uncensored     =         29
                    Limits: lower = 0                                  Left-censored  =         33
                            upper = +inf                               Right-censored =          0
                    
                                                                    LR chi2(2)        =      12.80
                                                                    Prob > chi2       =     0.0017
                    Log likelihood = -510.09445                     Pseudo R2         =     0.0124
                    
                    -------------------------------------------------------------------------------
                             yvar |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                    --------------+----------------------------------------------------------------
                       ran_sector |   -3566327    1157249    -3.08   0.003     -5881170    -1251485
                    profit_margin |  -160485.1   65831.13    -2.44   0.018      -292167   -28803.23
                            _cons |    9442130    3345478     2.82   0.006      2750179    1.61e+07
                    --------------+----------------------------------------------------------------
                           /sigma |    6169919   826564.4                       4516544     7823294
                    -------------------------------------------------------------------------------
                    
                    . replace yvar=yvar/1000
                    (30 real changes made)
                    
                    . tobit yvar ran_sector profit_margin,ll
                    
                    Refining starting values:
                    
                    Grid node 0:   log likelihood = -324.63644
                    
                    Fitting full model:
                    
                    Iteration 0:   log likelihood = -324.63644  
                    Iteration 1:   log likelihood = -312.26269  
                    Iteration 2:   log likelihood = -309.84965  
                    Iteration 3:   log likelihood =  -309.7715  
                    Iteration 4:   log likelihood = -309.76955  
                    Iteration 5:   log likelihood = -309.76955  
                    
                    Tobit regression                                Number of obs     =         62
                                                                       Uncensored     =         29
                    Limits: lower = 0                                  Left-censored  =         33
                            upper = +inf                               Right-censored =          0
                    
                                                                    LR chi2(2)        =      12.80
                                                                    Prob > chi2       =     0.0017
                    Log likelihood = -309.76955                     Pseudo R2         =     0.0202
                    
                    -------------------------------------------------------------------------------
                             yvar |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                    --------------+----------------------------------------------------------------
                       ran_sector |  -3566.327   1157.252    -3.08   0.003    -5881.176   -1251.479
                    profit_margin |  -160.4851   65.83128    -2.44   0.018    -292.1672   -28.80291
                            _cons |    9442.13   3345.485     2.82   0.006     2750.163     16134.1
                    --------------+----------------------------------------------------------------
                       var(e.yvar)|   3.81e+07   1.02e+07                      2.23e+07    6.51e+07
                    -------------------------------------------------------------------------------
                    ​​​​​​The coefficients estimated were comparable by the scale of 1e3.

                    Chris Cheng, Tech Services

                    Comment

                    Working...
                    X