Announcement

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

  • Error message - 'equation [kappa] not found r(303) - when choosing parametric model in Stata

    Hello all,

    I am having trouble with a command in Stata and was wondering if anybody could shed some light on it. I am fitting a nested accelerated failure time model and have successfully managed to fit it, however, for this method I would like to test which parametric model is most appropriate e.g. generalized gamma, Weibull, Lognormal etc and I am following the advice in Cleves et al. (2010) An introduction to survival analysis, the similar advice can also be found here: https://jdemeritt.weebly.com/uploads...parametric.pdf (page 7).

    My issue is that when I try to test whether k=1 using this code test [kappa]_b[_cons]=1 I get the error message 'equation [kappa] not found
    r(303);'. I'm not sure why this is happening, I think maybe due to mis-specification somewhere but I'm unable to find where. Here is the model output for the generalized gamma model.

    Generalized gamma AFT regression

    No. of subjects = 2,379 Number of obs = 5,123
    No. of failures = 2,745
    Time at risk = 4435723
    Wald chi2(24) = 266.91
    Log pseudolikelihood = -4388.0882 Prob > chi2 = 0.0000

    (Std. Err. adjusted for 2,379 clusters in ID)
    -----------------------------------------------------------------------------------------
    | Robust
    _t | Coef. Std. Err. z P>|z| [95% Conf. Interval]
    ------------------------+----------------------------------------------------------------
    sex |
    M | .0975589 .0895883 1.09 0.276 -.0780309 .2731487
    |
    clinic |
    KC | -.4006913 .113282 -3.54 0.000 -.6227199 -.1786626
    KS | -.184139 .1198321 -1.54 0.124 -.4190056 .0507275
    |
    otype |
    FO | .611605 .1783377 3.43 0.001 .2620695 .9611404
    KAFO | -.0402873 .0963903 -0.42 0.676 -.229209 .1486343
    Shoe Raise | -.9145288 .1695116 -5.40 0.000 -1.246765 -.5822922
    SFAB | -.5030514 .1934337 -2.60 0.009 -.8821744 -.1239284
    Spinal | .5159427 .1986001 2.60 0.009 .1266936 .9051917
    Other | .1200314 .1477773 0.81 0.417 -.1696068 .4096697
    |
    agecat |
    18-29 | .3240066 .1171543 2.77 0.006 .0943883 .5536248
    30-44 | .5876781 .1697069 3.46 0.001 .2550587 .9202975
    45+ | .8975508 .1624355 5.53 0.000 .579183 1.215919
    |
    diag |
    Trauma/injury | -.7675417 .548409 -1.40 0.162 -1.842404 .3073201
    Other congenital | -.1317484 .3092856 -0.43 0.670 -.737937 .4744401
    Cerebral Palsy | -.0415777 .2206258 -0.19 0.851 -.4739964 .390841
    Club foot | -.8421487 .2640103 -3.19 0.001 -1.359599 -.3246979
    Paralysis | .0372566 .2872067 0.13 0.897 -.5256582 .6001714
    Dislocation/fracture | -.6898822 .2753318 -2.51 0.012 -1.229523 -.1502418
    Polio | -.7046541 .2605685 -2.70 0.007 -1.215359 -.1939492
    Scoliosis/curved spine | -.5017567 .3061357 -1.64 0.101 -1.101772 .0982582
    Short leg | .3748963 .3047463 1.23 0.219 -.2223955 .9721881
    Stroke | .4969035 .4470183 1.11 0.266 -.3792363 1.373043
    Other | .1593808 .2461399 0.65 0.517 -.3230445 .6418062
    Missing | .0372867 .3296631 0.11 0.910 -.6088411 .6834145
    |
    _cons | 7.376842 .235195 31.36 0.000 6.915868 7.837816
    ------------------------+----------------------------------------------------------------
    /lnsigma | .1670233 .0301981 5.53 0.000 .107836 .2262105
    /kappa | .760035 .0838385 9.07 0.000 .5957146 .9243554
    ------------------------+----------------------------------------------------------------
    sigma | 1.181782 .0356876 1.113865 1.25384
    -----------------------------------------------------------------------------------------

    So, please could someone advise why this might be the case? I have also tried this code test _b[kappa:_cons]=1 but I receive the same error message.

    Many thanks,
    Charlotte

  • #2
    You are not showing your command line which makes it difficult to help you. In general, you want the option -coeflegend- to identify how your coefficients are named.

    Code:
    webuse cancer, clear
    streg drug age, distribution(ggamma) coeflegend
    test _b[/kappa]=1
    Res.:

    Code:
    . streg drug age, distribution(ggamma) coeflegend
    
             failure _d:  died
       analysis time _t:  studytime
    
    Fitting constant-only model:
    
    Iteration 0:   log likelihood = -61.342985  
    Iteration 1:   log likelihood = -60.523452  
    Iteration 2:   log likelihood = -60.489447  
    Iteration 3:   log likelihood = -60.489405  
    Iteration 4:   log likelihood = -60.489405  
    
    Fitting full model:
    
    Iteration 0:   log likelihood = -60.489405  (not concave)
    Iteration 1:   log likelihood = -49.141476  
    Iteration 2:   log likelihood = -43.458207  
    Iteration 3:   log likelihood = -42.649202  
    Iteration 4:   log likelihood = -42.619672  
    Iteration 5:   log likelihood = -42.619647  
    Iteration 6:   log likelihood = -42.619647  
    
    Generalized gamma AFT regression
    
    No. of subjects =           48                  Number of obs    =          48
    No. of failures =           31
    Time at risk    =          744
                                                    LR chi2(2)       =       35.74
    Log likelihood  =   -42.619647                  Prob > chi2      =      0.0000
    
    ------------------------------------------------------------------------------
              _t |      Coef.  Legend
    -------------+----------------------------------------------------------------
            drug |   .7861776  _b[drug]
             age |  -.0644245  _b[age]
           _cons |   5.108207  _b[_cons]
    -------------+----------------------------------------------------------------
        /lnsigma |  -.5174028  _b[/lnsigma]
          /kappa |   .8532814  _b[/kappa]
    -------------+----------------------------------------------------------------
           sigma |   .5960666
    ------------------------------------------------------------------------------
    
    . 
    . test _b[/kappa]=1
    
     ( 1)  [/]kappa = 1
    
               chi2(  1) =    0.09
             Prob > chi2 =    0.7651
    
    .

    Comment


    • #3
      Hi Andrew,

      Thanks for your response. Adding the -coeflegend- option to find the exact name of the coefficients has helped!

      Charlotte

      Comment

      Working...
      X