Income inequality in Canada: Part 6 – gender and age

For my next step in looking at income inequality in Canada, I thought it would be interesting to look at average wages with respect to age and gender.  It would have been nice to include level-of-education and number of years of work experience (rather than just having the age of the individual), but I was unable to find a dataset with all these properties.  I did find some interesting data regarding education-level and escaping from poverty, but that’s for another post.

Today, I will show the overall results for Canada and the provinces.  In following days, I will publish more detailed results for the individual provinces which will show average wages for the different categories of occupation.

Data:

You can find the data I used here.  I used the find and replace functions in excel to clean up some of the terms.  An important thing to keep in mind is that this data is in current dollars – it is NOT adjusted for inflation.  From the results in the previous posts, I would expect that inflation would cancel out the vast majority of wage growth observed in the data.

Below is the excel version of the data I used (it is a very large dataset):

cansim8914194367272979509a

Methodology:

I ran the below code to generate my graphs.  Since I wanted to create a graph for each type of work (full-time, part-time, and both), and for each occupation, and for each province, I used loops to make things easier.  After making the initial set of graphs, I decided that I wanted to reproduce the graphs with a log scale in the y axis.  The below code will produce graphs with a log scale, if you don’t want the log scale, comment out the lines of code containing: coord_trans(y=”log”).

library(ggplot2)
library(reshape)
library(grid)

#import data, specify that "x" values contained in csv should be read as NA
directory <-  "C:/Users/Business/Dropbox/Economics Research/Blog/Income inequality/Post 9 - Gender Differences/"
pData <- read.csv(paste(directory,"cansim8914194367272979509a.csv", sep=""), na.strings="x")
#change column names
pData <- rename(pData, c("Ref_Date" = "Date", "GEOGRAPHY" = "Geography", "WAGERATES" = "Wage.Rates", 
"TYPEOFWORK" = "Type.Of.Work", "OCCUPATION" = "Occupation", "SEX" = "Gender", "AGEGROUP" = "Age.Group"))

#change the order of the factors. we do this so that the faceted plot will start with the national data, and then
#the provinces from east to west
pData$Geography <- factor(pData$Geography, levels = c("Canada", "Newfoundland and Labrador", "Nova Scotia", "Prince Edward Island",
"New Brunswick", "Quebec", "Ontario","Manitoba", "Saskatchewan", "Alberta", "British Columbia"))

#change the order of the occupation factors. we do this so that the faceted plot will start with the total occupatios data
pData$Occupation <- factor(pData$Occupation, levels = c("Total employees, all occupations", "Art, culture, recreation and sport", 
"Business, finance and administrative", "Health", "Management", "Natural and applied sciences and related occupations", 
"Occupations unique to primary industry","Occupations unique to processing, manufacturing and utilities", 
"Sales and service", "Social science, education, government service and religion", 
"Trades, transport and equipment operators and related occupations"))


#I found the between the two hash lines at: http://ryouready.wordpress.com/2009/02/17/r-good-practice-adding-footnotes-to-graphics/
#it's a lovely bit of code that creates a custom function to add a footer to the plots
##############################################################################################################
source <- "Source: StatsCan"
author <- "PosNorm"
footnote <- paste(source, format(Sys.time(), "%d %b %Y"),
                  author, sep=" / ")

# default footnote is today's date, cex=.7 (size) and color
# is a kind of grey

makeFootnote <- function(footnoteText=
                         format(Sys.time(), "%d %b %Y"),
                         size= .7, color= grey(.5))
{
   require(grid)
   pushViewport(viewport())
   grid.text(label= footnoteText ,
             x = unit(1,"npc") - unit(2, "mm"),
             y= unit(2, "mm"),
             just=c("right", "bottom"),
             gp=gpar(cex= size, col=color))
   popViewport()
}
##############################################################################################################


#create vectors to hold the various factors that will be looped through
occupationVec <- unique(pData$Occupation)  #gets unique values
typeOfWorkVec <- unique(pData$Type.Of.Work)
geographyVec <- unique(pData$Geography)

#this loop creates graphs for national and provincial totals
for (y in 1:length(typeOfWorkVec)){

  graphTitle <- paste("Log average hourly wages, in current dollars, by age and gender from 1997 to 2013", sep=" ")
  fileName <- paste(directory,"LOG ",typeOfWorkVec[y],"CanadaAndProvincesTotals.pdf", sep="")
  
  pdf(fileName, height = 12, width = 17.5)
  p <- ggplot(data = subset(pData, Occupation=="Total employees, all occupations" & Type.Of.Work==typeOfWorkVec[y]), aes(x = Date, y = Value, colour=Gender, shape=Age.Group))+
       geom_point(size =3, alpha = 0.65) +    #this is the first layer of the plot, the scatterplot
       facet_wrap( ~ Geography, ncol=4) + #this creates a seperate plot for each geography and limits 4 graphs per row
       theme(axis.title.x = element_blank()) +   #removes x axis title
       theme(axis.title.y = element_blank()) +    #removes y axis title
       theme(legend.position = "bottom") +
       coord_trans(y="log") + #comment out this line if you don't want log scale
       ggtitle(graphTitle)  #add a title to the plot
  print(p)  #when ggplot2 is put in a loop, you need to explicitly print the object
  makeFootnote(footnote)  #adds the footnote through the above custom function
  dev.off()
  
}

#this loop creates graphs for the various occupations
for (i in 1:length(occupationVec)){
  for (y in 1:length(typeOfWorkVec)){
    
    graphTitle <- paste("Log average hourly wages, in current dollars, of",tolower(typeOfWorkVec[y]), ", by age and gender, for", tolower(occupationVec[i]), 
    "from 1997 to 2013", sep=" ")
    fileName <- paste(directory,"LOG ",typeOfWorkVec[y]," ",occupationVec[i],".pdf", sep="")
    
    pdf(fileName, height = 10, width = 15)
    p <- ggplot(data = subset(pData, Occupation==occupationVec[i] & Type.Of.Work==typeOfWorkVec[y]), aes(x = Date, y = Value, colour=Gender, shape=Age.Group))+
         geom_point(size = 2.5, alpha = 0.65) +    #this is the first layer of the plot, the scatterplot
         facet_wrap( ~ Geography, ncol=4) + #this creates a seperate plot for each geography and limits 4 graphs per row
         theme(axis.title.x = element_blank()) +   #removes x axis title
         theme(axis.title.y = element_blank()) +    #removes y axis title
         theme(legend.position = "bottom") +
         coord_trans(y="log") + #comment out this line if you don't want log scale
         ggtitle(graphTitle)  #add a title to the plot
    print(p)  #when ggplot2 is put in a loop, you need to explicitly print the object
    makeFootnote(footnote)  #adds the footnote through the above custom function
    dev.off()
    
  }
}

#this loop creates graphs for the provinces
for (i in 1:length(geographyVec)){
  for (y in 1:length(typeOfWorkVec)){

    graphTitle <- paste("Log average hourly wages, in current dollars, of",tolower(typeOfWorkVec[y]), ", by age and gender, for", geographyVec[i], 
    "from 1997 to 2013", sep=" ")
    fileName <- paste(directory,"LOG ",typeOfWorkVec[y]," ",geographyVec[i],".pdf", sep="")
    
    pdf(fileName, height = 12, width = 17.5)
    p <- ggplot(data = subset(pData, Geography==geographyVec[i] & Type.Of.Work==typeOfWorkVec[y]), aes(x = Date, y = Value, colour=Gender, shape=Age.Group))+
         geom_point(size =3, alpha = 0.65) +    #this is the first layer of the plot, the scatterplot
         facet_wrap( ~ Occupation, ncol=4) + #this creates a seperate plot for each geography and limits 4 graphs per row
         theme(axis.title.x = element_blank()) +   #removes x axis title
         theme(axis.title.y = element_blank()) +    #removes y axis title
         theme(legend.position = "bottom") +
         coord_trans(y="log") + #comment out this line if you don't want log scale
         ggtitle(graphTitle)  #add a title to the plot
    print(p)  #when ggplot2 is put in a loop, you need to explicitly print the object
    makeFootnote(footnote)  #adds the footnote through the above custom function
    dev.off()
    
  }
}

 Results:

The below graphs show the results for total occupations for Canada and its provinces:

Full-time employeesCanadaAndProvincesTotals-page-001

LOG Full-time employeesCanadaAndProvincesTotals-page-001

Part-time employeesCanadaAndProvincesTotals-page-001

Positive Analysis: From the top figure, which shows full-time wages on a linear scale, it appears as though for the nation as a whole, the average wage difference between genders has not changed much since 1997.  When we switch to the middle figure, which shows the same data on a log scale, it shows that in proportional terms, the difference between genders has narrowed slightly over time.

Prince Edward Island shows the smallest difference in wage rates between genders over time, and is the only province where the wage rates between men and women appear to be roughly equal.  Alberta has the largest difference in wages between genders, but it has also the highest wages of the provinces.

There appears to be no significant difference between average wages for people between 25-54 and those over 55.

For part-time work, the wages for men and women appear to be pretty much equal throughout the provinces.

Normative Analysis: Although it would have been nice if the dataset included characteristics such as: level of education, and number of year work experience, as those factors might help explain some of the differences, I am surprised by how big the gap is in wages is between men and women.  I was also surprised to see that there was almost no difference in wages between the middle and top age groups.  I am curious as to why Prince Edward Island stands out in terms of wage equality between genders.

One thought on “Income inequality in Canada: Part 6 – gender and age

  1. I would think it’s because of the number of minimum wage jobs here. That so many are working them, both men and women means that there is equality in wages for most of the working population. Equality!

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s