Announcement

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

  • Gender Wage Gap calculations

    Hello,

    I wish to perform an analysis of the gender wage gap, similar to the one attached. My question is what the text in "Notes" mean with regards to calculating the female/male log hourly ratios. I have in my own dataset, generated log wages for men and women, however, I am not quite sure how to generate a ratio. When I take logwages of women divided by log wages of men to get a ratio, the ratio is almost 1, which makes me think that this is not the correct way to do it. The "Notes" section says that they take the logwages of women minus the logwages of men, however, is this equal to the ratio then?

    This is what I have done so far:

    // Generating mean log wages for men and women//

    bysort year sex: egen meanlnwage = mean(lnwage)
    bysort year: egen meanlnwagef = mean(lnwage / (sex == 2))
    bysort year: egen meanlnwagem = mean(lnwage / (sex == 1))

    //Generating gender wage gap and displaying for each year//

    gen gap = meanlnwagem-meanlnwagef
    egen tag = tag(year)
    tabdisp year if tag, c(meanlnwagem meanlnwagef gap)


    The table below is what I want to achieve:

    Click image for larger version

Name:	Gender Gap.PNG
Views:	1
Size:	145.8 KB
ID:	1648558


  • #2
    if you look up properties of logarithms you'll see that the log of a quotient is the difference of the logs
    also for female/male ratio it should be meanlnwagef - meanlnwagem, not meanlnwagem - meanlnwagef

    Comment


    • #3
      Originally posted by Øyvind Snilsberg View Post
      if you look up properties of logarithms you'll see that the log of a quotient is the difference of the logs
      also for female/male ratio it should be meanlnwagef - meanlnwagem, not meanlnwagem - meanlnwagef
      Thank you for clarifying. Am I correct to understand that you take meanlnwagef - meanlnwagem, and then take 1 minus that in order to get a number equal to that in the table, as meanlnwagef - meanlnwagem is 0.2 using my data. Would the ratio then be 80%?

      Comment


      • #4
        maybe you'll find the following example useful,
        Code:
        * Example generated by -dataex-. To install: ssc install dataex
        clear
        input int year byte(sex wage)
        1980 1 15
        1980 1 16
        1980 1 17
        1980 1 18
        1980 1 19
        1980 2 11
        1980 2 12
        1980 2 13
        1980 2 14
        1980 2 15
        1989 1 25
        1989 1 26
        1989 1 27
        1989 1 28
        1989 1 29
        1989 2 21
        1989 2 22
        1989 2 23
        1989 2 24
        1989 2 25
        end
        
        collapse wage, by(year sex)
        
        reshape wide wage, i(year) j(sex)
        
        gen D = ln(wage2/wage1)
        
        gen expD = exp(D)

        Comment


        • #5
          Originally posted by Øyvind Snilsberg View Post
          maybe you'll find the following example useful,
          Code:
          * Example generated by -dataex-. To install: ssc install dataex
          clear
          input int year byte(sex wage)
          1980 1 15
          1980 1 16
          1980 1 17
          1980 1 18
          1980 1 19
          1980 2 11
          1980 2 12
          1980 2 13
          1980 2 14
          1980 2 15
          1989 1 25
          1989 1 26
          1989 1 27
          1989 1 28
          1989 1 29
          1989 2 21
          1989 2 22
          1989 2 23
          1989 2 24
          1989 2 25
          end
          
          collapse wage, by(year sex)
          
          reshape wide wage, i(year) j(sex)
          
          gen D = ln(wage2/wage1)
          
          gen expD = exp(D)
          Thank you, that was very helpful!

          Comment


          • #6
            Originally posted by Øyvind Snilsberg View Post
            maybe you'll find the following example useful,
            Code:
            * Example generated by -dataex-. To install: ssc install dataex
            clear
            input int year byte(sex wage)
            1980 1 15
            1980 1 16
            1980 1 17
            1980 1 18
            1980 1 19
            1980 2 11
            1980 2 12
            1980 2 13
            1980 2 14
            1980 2 15
            1989 1 25
            1989 1 26
            1989 1 27
            1989 1 28
            1989 1 29
            1989 2 21
            1989 2 22
            1989 2 23
            1989 2 24
            1989 2 25
            end
            
            collapse wage, by(year sex)
            
            reshape wide wage, i(year) j(sex)
            
            gen D = ln(wage2/wage1)
            
            gen expD = exp(D)
            Is there anyway I can do this without losing all the other variables in my dataset?

            Comment


            • #7
              absolutely,
              Code:
              bys year: egen wage1 = mean(wage) if sex==1
              bys year (wage1): replace wage1 = wage1[1]
              
              bys year: egen wage2 = mean(wage) if sex==2
              bys year (wage2): replace wage2 = wage2[1]
              
              gen D = ln(wage2/wage1)
              
              gen expD = exp(D)

              Comment

              Working...
              X