Announcement

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

  • Dummy variable

    I am a bit confused about which would be correct.

    I would like to regress salary on a dummy variable representing females (under the variable gender)

    what is the correct way of doing this? I used this code

    tab gender, gen(gender)
    rename (gender1) (female)

    reg salary gender1


    or do it just use this

    reg salary i.gender

    TIA

  • #2
    Audry:
    welcome to this forum.
    The best way is to go:
    Code:
    reg salary i.gender
    Ths way you can see the difference (other things being equal) between male and female as far as salry is concerned.
    As an aside, it is hard to believe that a simple OLS (that is, an OLS with one predictor only) can address such a complex issue.
    Kind regards,
    Carlo
    (StataNow 18.5)

    Comment


    • #3
      Thank you.
      I am using the salary.dat from S. Weisberg (1985) and I would like to see if there is evidence of gender discrimination. So I wanted to regress salary on a dummy variable representing females.

      reg salary i.gender1

      Source SS df MS Number of obs = 52
      F(1, 50) = 3.41
      Model 114106220 1 114106220 Prob > F = 0.0706
      Residual 1.6716e+09 50 33432472.8 R-squared = 0.0639
      Adj R-squared = 0.0452
      Total 1.7857e+09 51 35014310.9 Root MSE = 5782.1


      salary Coefficient Std. err. t P>t [95% conf. interval]

      gender1
      male 3339.647 1807.716 1.85 0.071 -291.257 6970.55
      _cons 21357.14 1545.326 13.82 0.000 18253.26 24461.02


      Since I want to represent females is this still correct?

      Thank you for taking time and responding to my questions.

      Comment


      • #4
        If gender is coded 1=female 0=male then i.gender or 1.gender will represent females relative to males.

        If gender is coded 0=female 1=male then ib1.gender or 0.gender will represent females relative to males.

        You should not use tab to create a gender1 variable from your tab results. That approach is outdated since the introduction of factor variable notation. See the output of
        Code:
        help factor variables
        for further explanation.

        Comment


        • #5
          Audry:
          as an aside to William's helpful reply, isn't it a job for Oaxaca decomposition (-search oaxaca-)?
          In addition, please use CODE delimiters (#-shaped toggle available from the toolbar) to share what you typed and what Stata gave you back. Thanks.
          Kind regards,
          Carlo
          (StataNow 18.5)

          Comment


          • #6
            Thank you all. this was very helpful.

            Comment

            Working...
            X