Announcement

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

  • invalid name error - r(198)

    Click image for larger version

Name:	Screen Shot 2022-06-30 at 1.04.50 AM.png
Views:	1
Size:	41.9 KB
ID:	1671514




    I want to test whether kappa is equal to 1 or not.

    But I see this error. How can I fix it?

  • #2
    In Stata 17,
    Code:
    test /kappa = 1
    worked with the example data I used and the example regression I ran.

    However, in versions 14 and earlier the syntax required is apparently
    Code:
    test [kappa] = 1
    Please take a few moments to review the Statalist FAQ linked to from the top of the page, as well as from the Advice on Posting link on the page you used to create your post. Note especially sections 9-12 on how to best pose your question.

    In this case, the FAQ advises you to show the command you ran, and if you are not running the latest version of Stata, tell us the version you are running.

    Comment


    • #3
      Originally posted by William Lisowski View Post
      In Stata 17,
      Code:
      test /kappa = 1
      worked with the example data I used and the example regression I ran.

      However, in versions 14 and earlier the syntax required is apparently
      Code:
      test [kappa] = 1
      Please take a few moments to review the Statalist FAQ linked to from the top of the page, as well as from the Advice on Posting link on the page you used to create your post. Note especially sections 9-12 on how to best pose your question.

      In this case, the FAQ advises you to show the command you ran, and if you are not running the latest version of Stata, tell us the version you are running.
      --------

      Yes I use Stata 14.

      But this code did not work as well.

      Code:

      . test [kappa] = 1
      kappa not found
      r(111);

      Comment


      • #4
        Originally posted by William Lisowski View Post
        In Stata 17,
        Code:
        test /kappa = 1
        worked with the example data I used and the example regression I ran.

        However, in versions 14 and earlier the syntax required is apparently
        Code:
        test [kappa] = 1
        Please take a few moments to review the Statalist FAQ linked to from the top of the page, as well as from the Advice on Posting link on the page you used to create your post. Note especially sections 9-12 on how to best pose your question.

        In this case, the FAQ advises you to show the command you ran, and if you are not running the latest version of Stata, tell us the version you are running.
        --------

        Yes I use Stata 14.

        But this code did not work as well.

        Code:

        . test [kappa] = 1
        kappa not found
        r(111);

        Comment


        • #5
          Sean:
          after some trial-and-error sessions
          Code:
          mat list e(b)
          put me on the right track with Stata 14:
          Code:
          . use https://www.stata-press.com/data/r14/cancer
          . stset studytime, failure(died)
          
               failure event:  died != 0 & died < .
          obs. time interval:  (0, studytime]
           exit on or before:  failure
          
          ------------------------------------------------------------------------------
                   48  total observations
                    0  exclusions
          ------------------------------------------------------------------------------
                   48  observations remaining, representing
                   31  failures in single-record/single-failure data
                  744  total analysis time at risk and under observation
                                                          at risk from t =         0
                                               earliest observed entry t =         0
                                                    last observed exit t =        39
          
          . replace drug = drug==2 | drug==3
          (28 real changes made)
          
          . streg drug age, distribution(ggamma) nolog
          
                   failure _d:  died
             analysis time _t:  studytime
          note: drug omitted because of collinearity
          
          Generalized gamma regression -- accelerated failure-time form
          
          No. of subjects =           48                  Number of obs    =          48
          No. of failures =           31
          Time at risk    =          744
                                                          LR chi2(1)       =        6.63
          Log likelihood  =   -57.175276                  Prob > chi2      =      0.0100
          
          ------------------------------------------------------------------------------
                    _t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
          -------------+----------------------------------------------------------------
                  drug |          0  (omitted)
                   age |  -.0771936     .03141    -2.46   0.014     -.138756   -.0156312
                 _cons |   7.173099   1.687563     4.25   0.000     3.865537    10.48066
          -------------+----------------------------------------------------------------
               /ln_sig |   -.009931   .2119507    -0.05   0.963    -.4253468    .4054847
                /kappa |   .2632982   .6947163     0.38   0.705    -1.098321    1.624917
          -------------+----------------------------------------------------------------
                 sigma |   .9901181   .2098562                      .6535431    1.500029
          ------------------------------------------------------------------------------
          
          
          . mat list e(b)
          
          e(b)[1,5]
                      _t:         _t:         _t:     ln_sig:      kappa:
                    drug         age       _cons       _cons       _cons
          y1   1.3946577  -.07804164   6.4560907  -.37936318   .46692516
          
          
          
          .  test [kappa]_cons=1
          
           ( 1)  [kappa]_cons = 1
          
                     chi2(  1) =    1.12
                   Prob > chi2 =    0.2889
          
          .
          I had to realize once more that Stata always rules. Therefore, I shall keep on learning how it works behind the curtain.
          Tables with smart rows and columns are frills; whereas Stata calculates using matrices.
          Kind regards,
          Carlo
          (Stata 19.0)

          Comment

          Working...
          X