Announcement

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

  • censornb

    I'm using censornb with cross-sectional survey data. The dependent variable is a count variable that indicates the number of modes of communication an organization uses. The maximum number of modes an organization can select is 11 (i.e. the variable is right-censored at 11).

    I created the censor variable cenvar_modes with the appropriate 1s and -1s.

    Here is the basic model I am trying to run:
    Code:
    censornb num_modes revenue_log, censor(cenvar_modes)
    When I run the regression I get the following error message:
    initial: log likelihood = -<inf> (could not be evaluated)
    could not find feasible values
    When I run the following basic nbreg model on the same data:
    Code:
    nbreg num_modes revenue_log
    It runs without any errors.

    Do you know what might be causing the problems when I run censornb?

  • #2
    Welcome to Statalist. -censornb- is a community-contributed command downloadable from SSC (as you're asked to tell us). The error message you report is telling exactly what the problem is! Looking at the output from -viewsource censornb.ado- suggests that the program is using default starting values; these may well be the source of the problem. I suggest that you use as starting values the parameter estimates that you get from -nbreg-. Something along the lines of (i) -matrix b = e(b)- after the call to -nbreg-; and then (ii) refer to "init(b, skip)" in your call to -censornb-

    Comment


    • #3
      Thanks for your input. Can you provide a little more explanation for how/where I would enter (i) and (ii) into my code? Thanks.

      Comment


      • #4
        Something like the following -- you can run this code. (This uses a "toy" example data set and model.)

        Code:
        sysuse auto, clear
        ge censorvar = 0
        replace censorvar = 1 in 1/10
        
        nbreg rep78 price mpg
        mat b = e(b)
        matrix list b
        * extract coefficients (excluding auxiliary parameter from -nbreg-)
        mat b2 = b[1,"rep78:price".."rep78:_cons"]
        mat list b2
        
        * add starting value for auxiliary parameter of model w/ censoring: guess "-2"
        mat b2 = b2, -2
        mat li b2
        
        censornb rep78 price mpg, censor(censorvar) from(b2, copy)
        
        mat list e(b)
        I'd advise reading the fine manuals to learn more. E.g. help ml and look at the sections on init() option, and follow the relevant links.


        Code:
        . sysuse auto, clear
        (1978 Automobile Data)
        
        . ge censorvar = 0
        
        . replace censorvar = 1 in 1/10
        (10 real changes made)
        
        . 
        . nbreg rep78 price mpg
        
        Fitting Poisson model:
        
        Iteration 0:   log likelihood = -114.24448  
        Iteration 1:   log likelihood = -114.24448  
        
        Fitting constant-only model:
        
        Iteration 0:   log likelihood = -162.82048  
        Iteration 1:   log likelihood = -116.17777  
        Iteration 2:   log likelihood = -116.17777  
        
        Fitting full model:
        
        Iteration 0:   log likelihood = -114.25173  
        Iteration 1:   log likelihood = -114.24448  
        Iteration 2:   log likelihood = -114.24448  
        
        Negative binomial regression                    Number of obs     =         69
                                                        LR chi2(2)        =       3.87
        Dispersion     = mean                           Prob > chi2       =     0.1447
        Log likelihood = -114.24448                     Pseudo R2         =     0.0166
        
        ------------------------------------------------------------------------------
               rep78 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
        -------------+----------------------------------------------------------------
               price |   .0000228   .0000249     0.92   0.360     -.000026    .0000716
                 mpg |   .0235891    .011719     2.01   0.044     .0006202     .046558
               _cons |   .5753581   .3599811     1.60   0.110     -.130192    1.280908
        -------------+----------------------------------------------------------------
            /lnalpha |  -41.45834          .                             .           .
        -------------+----------------------------------------------------------------
               alpha |   9.88e-19          .                             .           .
        ------------------------------------------------------------------------------
        LR test of alpha=0: chibar2(01) = 0.00                 Prob >= chibar2 = 1.000
        
        . mat b = e(b)
        
        . matrix list b
        
        b[1,4]
                 rep78:      rep78:      rep78:          /:
                 price         mpg       _cons     lnalpha
        y1   .00002279   .02358913   .57535812  -41.458341
        
        . * extract coefficients (excluding auxiliary parameter from -nbreg-)
        . mat b2 = b[1,"rep78:price".."rep78:_cons"]
        
        . mat list b2
        
        b2[1,3]
                rep78:     rep78:     rep78:
                price        mpg      _cons
        y1  .00002279  .02358913  .57535812
        
        . 
        . * add starting value for auxiliary parameter of model w/ censoring: guess "-2"
        . mat b2 = b2, -2
        
        . mat li b2
        
        b2[1,4]
                rep78:     rep78:     rep78:           
                price        mpg      _cons         c4
        y1  .00002279  .02358913  .57535812         -2
        
        . 
        . censornb rep78 price mpg, censor(censorvar) from(b2, copy)
        
        initial:       log likelihood = -51.534763
        rescale:       log likelihood = -35.068536
        rescale eq:    log likelihood = -21.729857
        Iteration 0:   log likelihood = -21.729857  
        Iteration 1:   log likelihood = -21.324463  
        Iteration 2:   log likelihood = -21.140959  
        Iteration 3:   log likelihood = -21.136571  
        Iteration 4:   log likelihood = -21.136562  
        Iteration 5:   log likelihood = -21.136562  
        
        Censored Negative Binomial Regression           Number of obs     =         69
                                                        Wald chi2(2)      =       1.19
        Log likelihood = -21.136562                     Prob > chi2       =     0.5524
        
        ------------------------------------------------------------------------------
               rep78 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
        -------------+----------------------------------------------------------------
        xb           |
               price |   .0000598   .0000828     0.72   0.470    -.0001024    .0002221
                 mpg |   .0462188   .0438842     1.05   0.292    -.0397926    .1322302
               _cons |   .8298298   1.186863     0.70   0.484    -1.496379    3.156038
        -------------+----------------------------------------------------------------
        lnalpha      |
               _cons |  -.7141961   .7996964    -0.89   0.372    -2.281572    .8531799
        -------------+----------------------------------------------------------------
               alpha |   .4895855   .3915198                      .1021235    2.347099
        ------------------------------------------------------------------------------
        AIC Statistic =        0.700
        
        . mat list e(b)
        
        e(b)[1,4]
                    xb:         xb:         xb:    lnalpha:
                 price         mpg       _cons       _cons
        y1   .00005984   .04621878   .82982977  -.71419613

        Comment


        • #5
          This is all super helpful. Thanks!

          I got everything to work up to the point of adding the starting value for auxiliary parameter of model w/ censoring. None of the values I "guess" are working. I keep getting the error message that it could not find feasible values.

          I read through the documentation you referenced, but none of it seems to provide guidance on criteria to use when providing/guessing the starting value (e.g., range of possible values, etc.). Any additional input you can provide on this step would be great.

          Comment

          Working...
          X