Announcement

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

  • Ambiguous Abbreviation Error with test command

    Hi, All:

    After running a logistic regression, I wanted to do a Wald test for my variable female. Stata gives me a r111 and says that the variable female is not found, but it is because I am able to tabulate it. Can someone please help me figure out why my "test" command is not working?

    logit binarycitations i.female i.mmale i.nopub1 i.fellow i.workadmn

    Iteration 0: log likelihood = -174.02793
    Iteration 1: log likelihood = -150.89347
    Iteration 2: log likelihood = -149.39611
    Iteration 3: log likelihood = -149.38601
    Iteration 4: log likelihood = -149.38601

    Logistic regression Number of obs = 297
    LR chi2(5) = 49.28
    Prob > chi2 = 0.0000
    Log likelihood = -149.38601 Pseudo R2 = 0.1416

    -------------------------------------------------------------------------------
    binarycitat~s | Coef. Std. Err. z P>|z| [95% Conf. Interval]
    --------------+----------------------------------------------------------------
    female |
    1Female | -.7626615 .3380316 -2.26 0.024 -1.425191 -.1001317
    |
    mmale |
    1MalMent | -.7277077 1.108126 -0.66 0.511 -2.899595 1.44418
    |
    nopub1 |
    1NoPubs | -1.405057 .4389459 -3.20 0.001 -2.265375 -.5447388
    |
    fellow |
    1Fellow | 1.318628 .292187 4.51 0.000 .7459525 1.891304
    |
    workadmn |
    1Admin | .6988945 .5506152 1.27 0.204 -.3802914 1.77808
    _cons | -.4831004 1.109789 -0.44 0.663 -2.658247 1.692046
    -------------------------------------------------------------------------------

    .
    end of do-file

    . do "C:\Users\rjohn123\AppData\Local\Temp\STD23a8_0000 00.tmp"

    . test female
    female not found
    r(111);

    end of do-file

    r(111);

    . tab female

    Female? | Freq. Percent Cum.
    ------------+-----------------------------------
    0Male | 195 65.66 65.66
    1Female | 102 34.34 100.00
    ------------+----------------------------------
    -
    Total | 297 100.00





  • #2
    It's in the help. Once you use factor variable notation, the coefficient has to be specified differently. We can't use your data example because there isn't one, but the following shows the issue.

    Code:
    . sysuse auto, clear
    (1978 Automobile Data)
    
    . regress mpg foreign
    
          Source |       SS           df       MS      Number of obs   =        74
    -------------+----------------------------------   F(1, 72)        =     13.18
           Model |  378.153515         1  378.153515   Prob > F        =    0.0005
        Residual |  2065.30594        72  28.6848048   R-squared       =    0.1548
    -------------+----------------------------------   Adj R-squared   =    0.1430
           Total |  2443.45946        73  33.4720474   Root MSE        =    5.3558
    
    ------------------------------------------------------------------------------
             mpg |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
         foreign |   4.945804   1.362162     3.63   0.001     2.230384    7.661225
           _cons |   19.82692   .7427186    26.70   0.000     18.34634    21.30751
    ------------------------------------------------------------------------------
    
    . test foreign
    
     ( 1)  foreign = 0
    
           F(  1,    72) =   13.18
                Prob > F =    0.0005
    
    . regress mpg i.foreign
    
          Source |       SS           df       MS      Number of obs   =        74
    -------------+----------------------------------   F(1, 72)        =     13.18
           Model |  378.153515         1  378.153515   Prob > F        =    0.0005
        Residual |  2065.30594        72  28.6848048   R-squared       =    0.1548
    -------------+----------------------------------   Adj R-squared   =    0.1430
           Total |  2443.45946        73  33.4720474   Root MSE        =    5.3558
    
    ------------------------------------------------------------------------------
             mpg |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
         foreign |
        Foreign  |   4.945804   1.362162     3.63   0.001     2.230384    7.661225
           _cons |   19.82692   .7427186    26.70   0.000     18.34634    21.30751
    ------------------------------------------------------------------------------
    
    . test foreign
    foreign not found
    r(111);
    
    . test 1.foreign
    
     ( 1)  1.foreign = 0
    
           F(  1,    72) =   13.18
                Prob > F =    0.0005

    Comment

    Working...
    X