Announcement

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

  • Base level related question

    What is autometically taken as base level in stata for binary variable while regression (0,1)?

  • #2
    It is not clear to me the exact context of your question.

    If you have a binary dependent variable y, then
    Code:
    logistic y x1 x2 ...
    models the probability of a non-zero outcome.

    If you have a categorical independent variable x1, then
    Code:
    regress y x1 x2 ...
    will treat x1 as a continuous variable, while
    Code:
    regress y i.x1 x2 ...
    will treat x1 as a categorical variable, and the output of help factor variables tells us that the default is to use the smallest value as the base level.

    Comment


    • #3
      Deepty:
      as an aside to William's helpful comment, if your (not so clearly posted, though) aim is to understand which level of a given independent categorical variable of your logistic regression Stata takes as reference category, just add the -allbaselevels- option at the end of your code:
      Code:
      sysuse auto.dta
      logistic foreign i.rep78 if rep78>=3, allbaselevels
      
      Logistic regression                             Number of obs     =         59
                                                      LR chi2(2)        =      21.93
                                                      Prob > chi2       =     0.0000
      Log likelihood = -27.444671                     Pseudo R2         =     0.2855
      
      ------------------------------------------------------------------------------
           foreign | Odds Ratio   Std. Err.      z    P>|z|     [95% Conf. Interval]
      -------------+----------------------------------------------------------------
             rep78 |
                3  |          1  (base)
                4  |          9   6.928203     2.85   0.004     1.990615    40.69094
                5  |       40.5   40.12325     3.74   0.000     5.809942    282.3178
                   |
             _cons |   .1111111   .0676201    -3.61   0.000      .033708    .3662539
      ------------------------------------------------------------------------------
      Note: _cons estimates baseline odds.
      
      .
      Kind regards,
      Carlo
      (Stata 19.0)

      Comment


      • #4

        [/CODE]
        will treat x1 as a categorical variable, and the output of help factor variables tells us that the default is to use the smallest value as the base level.
        [/QUOTE]

        this is what i needed to know. thanks a lot.....

        Comment

        Working...
        X