The significance of gender on the salary in Sweden, a comparison between different occupational groups

[This article was first published on R Analystatistics Sweden , and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

In my last post, I found that the interaction between the different predictors has a significant impact on the salary of engineers. Is the significance of the interactions on wages unique to engineers or are there similar correlations in other occupational groups?

We start by examining the interaction between age, year, gender.

The F-value from the Anova table is used as the single value to discriminate how much education and salary correlates. For exploratory analysis, the Anova value seems good enough.

First, define libraries and functions.

library (tidyverse) 
## -- Attaching packages --------------------------------------- tidyverse 1.2.1 --
## v ggplot2 3.2.0     v purrr   0.3.2
## v tibble  2.1.3     v dplyr   0.8.3
## v tidyr   1.0.0     v stringr 1.4.0
## v readr   1.3.1     v forcats 0.4.0
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
library (broom) 
library (car)
## Loading required package: carData
## 
## Attaching package: 'car'
## The following object is masked from 'package:dplyr':
## 
##     recode
## The following object is masked from 'package:purrr':
## 
##     some
library(sjPlot)
readfile <- function (file1){  
  read_csv (file1, col_types = cols(), locale = readr::locale (encoding = "latin1"), na = c("..", "NA")) %>%  
    gather (starts_with("19"), starts_with("20"), key = "year", value = salary) %>%  
    drop_na() %>%  
    mutate (year_n = parse_number (year))
}

The data table is downloaded from Statistics Sweden. It is saved as a comma-delimited file without heading, 000000D2.csv, http://www.statistikdatabasen.scb.se/pxweb/en/ssd/.

The table: Average basic salary, monthly salary and women´s salary as a percentage of men´s salary by sector, occupational group (SSYK 2012), sex and age. Year 2014 – 2018 Monthly salary All sectors

I will use a continuous predictor, a polynomial of degree three, to fit the contribution of age to the salary.

In the plot and tables, you can also find information on how the increase in salaries per year for each occupational group is affected when the interactions are taken into account.

tb <- readfile("000000D2.csv") %>%
  rowwise() %>%
  mutate(age_l = unlist(lapply(strsplit(substr(age, 1, 5), "-"), strtoi))[1]) %>%
  rowwise() %>%
  mutate(age_h = unlist(lapply(strsplit(substr(age, 1, 5), "-"), strtoi))[2]) %>%
  mutate(age_n = (age_l + age_h) / 2)

summary_table = vector()
anova_table = vector()
for (i in unique(tb$`occuptional  (SSYK 2012)`)){
  temp <- filter(tb, `occuptional  (SSYK 2012)` == i)
  if (dim(temp)[1] > 30){
    model <-lm (log(salary) ~ year_n + sex * poly(age_n, 3), data = temp)
    summary_table <- bind_rows (summary_table, mutate (tidy (summary (model)), ssyk = i, interaction = "sex and age"))
    anova_table <- bind_rows (anova_table, mutate (tidy (Anova (model, type = 2)), ssyk = i, interaction = "sex and age"))

    model <-lm (log(salary) ~ year_n * sex + poly(age_n, 3), data = temp)
    summary_table <- bind_rows (summary_table, mutate (tidy (summary (model)), ssyk = i, interaction = "sex and year"))
    anova_table <- bind_rows (anova_table, mutate (tidy (Anova (model, type = 2)), ssyk = i, interaction = "sex and year"))

    model <-lm (log(salary) ~ sex + year_n * poly(age_n, 3), data = temp)
    summary_table <- bind_rows (summary_table, mutate (tidy (summary (model)), ssyk = i, interaction = "year and age"))
    anova_table <- bind_rows (anova_table, mutate (tidy (Anova (model, type = 2)), ssyk = i, interaction = "year and age"))

    model <-lm (log(salary) ~ sex * year_n * poly(age_n, 3), data = temp)
    summary_table <- bind_rows (summary_table, mutate (tidy (summary (model)), ssyk = i, interaction = "sex, year and age"))
    anova_table <- bind_rows (anova_table, mutate (tidy (Anova (model, type = 2)), ssyk = i, interaction = "sex, year and age"))
    }
}
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
anova_table <- anova_table %>% rowwise() %>% mutate(contcol = str_count(term, ":")) 

summary_table <- summary_table %>% rowwise() %>% mutate(contcol = str_count(term, ":"))

merge(summary_table, anova_table, by = c("ssyk", "interaction"), all = TRUE) %>%
  filter (term.x == "year_n") %>%
  filter (contcol.y > 0) %>%    
  # only look at the interactions between all three variables
  filter (!(contcol.y == 1 & interaction == "sex, year and age")) %>% 
  
  mutate (estimate = (exp(estimate) - 1) * 100) %>%  
  ggplot () +
    geom_point (mapping = aes(x = estimate, y = statistic.y, colour = interaction)) +
    labs(
      x = "Increase in salaries (% / year)",
      y = "F-value for interaction"
    )   

The significance of the interaction between age, year, sex on the salary in Sweden, a comparison between different occupational groups, Year 2014 - 2018

Figure 1: The significance of the interaction between age, year, sex on the salary in Sweden, a comparison between different occupational groups, Year 2014 – 2018

The tables with all occupational groups sorted by F-value in descending order.

merge(summary_table, anova_table, c("ssyk", "interaction"), all = TRUE) %>%
  filter (term.x == "year_n") %>%
  filter (contcol.y > 0) %>%   
  filter (interaction == "sex and age") %>%
  mutate (estimate = (exp(estimate) - 1) * 100) %>%  
  select (ssyk, estimate, statistic.y, interaction) %>%
  rename (`F-value for age` = statistic.y) %>%
  rename (`Increase in salary` = estimate) %>%
  arrange (desc (`F-value for age`)) %>%
  knitr::kable(
    booktabs = TRUE,
    caption = 'Correlation for F-value (sex and age) and the yearly increase in salaries')
Table 1: Correlation for F-value (sex and age) and the yearly increase in salaries
ssyk Increase in salary F-value for age interaction
335 Tax and related government associate professionals 2.2959882 159.4793522 sex and age
331 Financial and accounting associate professionals 2.2766227 42.0381959 sex and age
241 Accountants, financial analysts and fund managers 2.7431544 20.6684827 sex and age
531 Child care workers and teachers aides 2.1421968 20.6043679 sex and age
242 Organisation analysts, policy administrators and human resource specialists 2.2640553 20.5912541 sex and age
234 Primary- and pre-school teachers 3.5160288 18.7575727 sex and age
713 Painters, Lacquerers, Chimney-sweepers and related trades workers 3.1994881 17.5772847 sex and age
911 Cleaners and helpers 1.7714885 16.3428281 sex and age
227 Naprapaths, physiotherapists, occupational therapists 2.1685852 15.4642863 sex and age
151 Health care managers 2.5609524 14.4293656 sex and age
231 University and higher education teachers 2.5810115 13.7386699 sex and age
533 Health care assistants 2.0794512 13.0025749 sex and age
541 Other surveillance and security workers 2.4232740 12.9292988 sex and age
267 Religious professionals and deacons 3.1863563 12.7247444 sex and age
321 Medical and pharmaceutical technicians 2.9289943 12.1381897 sex and age
522 Shop staff 2.7119318 12.0951539 sex and age
213 Biologists, pharmacologists and specialists in agriculture and forestry 1.4590279 9.6061073 sex and age
821 Assemblers 2.8365295 9.2734220 sex and age
422 Client information clerks 1.7743297 8.7718831 sex and age
262 Museum curators and librarians and related professionals 2.3203065 8.5847669 sex and age
159 Other social services managers 2.5439991 7.8781716 sex and age
123 Administration and planning managers 4.3275243 7.3452011 sex and age
161 Financial and insurance managers 3.4953296 7.2879455 sex and age
818 Other stationary plant and machine operators 2.4062997 7.1387013 sex and age
333 Business services agents 2.7489045 6.9293991 sex and age
722 Blacksmiths, toolmakers and related trades workers 1.9353634 6.8656109 sex and age
511 Cabin crew, guides and related workers 0.6997964 6.7913009 sex and age
261 Legal professionals 3.0821252 6.6602603 sex and age
311 Physical and engineering science technicians 2.1777128 6.2915291 sex and age
816 Machine operators, food and related products 2.0069383 5.6187226 sex and age
814 Machine operators, rubber, plastic and paper products 2.4830804 5.3245175 sex and age
336 Police officers 2.9217134 5.3169761 sex and age
812 Metal processing and finishing plant operators 1.7680426 5.1597022 sex and age
351 ICT operations and user support technicians 2.1345745 4.8748330 sex and age
411 Office assistants and other secretaries 2.5356754 4.7575794 sex and age
741 Electrical equipment installers and repairers 2.4746226 4.7218323 sex and age
342 Athletes, fitness instructors and recreational workers 1.6415741 4.6480979 sex and age
819 Process control technicians 2.3555614 4.6407029 sex and age
214 Engineering professionals 1.9299724 4.5859413 sex and age
228 Specialists in health care not elsewhere classified 2.7352142 4.5394356 sex and age
962 Newspaper distributors, janitors and other service workers 1.4297059 4.5028895 sex and age
312 Construction and manufacturing supervisors 3.5808422 4.3879763 sex and age
232 Vocational education teachers 3.0245050 4.0584628 sex and age
212 Mathematicians, actuaries and statisticians 2.4369530 3.9838403 sex and age
211 Physicists and chemists 2.0943491 3.9727058 sex and age
334 Administrative and specialized secretaries 2.9702746 3.6129743 sex and age
222 Nursing professionals 4.2511717 3.5676086 sex and age
121 Finance managers 3.2704547 3.3530172 sex and age
243 Marketing and public relations professionals 1.4890095 3.2225018 sex and age
932 Manufacturing labourers 2.6991481 3.1523625 sex and age
817 Wood processing and papermaking plant operators 2.9341892 3.1259551 sex and age
532 Personal care workers in health services 2.8944753 3.0544887 sex and age
217 Designers 2.5526515 3.0235916 sex and age
136 Production managers in construction and mining 2.7406649 2.5807238 sex and age
732 Printing trades workers 1.9355361 2.3243296 sex and age
534 Attendants, personal assistants and related workers 1.9366235 2.2843662 sex and age
441 Library and filing clerks 2.1267903 2.2496759 sex and age
235 Teaching professionals not elsewhere classified 2.4893302 2.1506250 sex and age
131 Information and communications technology service managers 4.0848134 2.1380093 sex and age
834 Mobile plant operators 2.5374407 2.0839971 sex and age
611 Market gardeners and crop growers 0.7905144 2.0157799 sex and age
223 Nursing professionals (cont.) 3.0862129 1.9488266 sex and age
512 Cooks and cold-buffet managers 2.8246521 1.9384343 sex and age
352 Broadcasting and audio-visual technicians 0.6430997 1.9263743 sex and age
264 Authors, journalists and linguists 1.6003330 1.8718057 sex and age
221 Medical doctors 1.4464671 1.8334236 sex and age
133 Research and development managers 1.3868102 1.8214105 sex and age
432 Stores and transport clerks 2.2008861 1.7861746 sex and age
523 Cashiers and related clerks 0.4338337 1.7438312 sex and age
132 Supply, logistics and transport managers 1.2583558 1.7194546 sex and age
216 Architects and surveyors 2.4463103 1.6944331 sex and age
137 Production managers in manufacturing 2.5139252 1.6853597 sex and age
813 Machine operators, chemical and pharmaceutical products 2.5781771 1.6607729 sex and age
332 Insurance advisers, sales and purchasing agents 1.7769452 1.6356527 sex and age
515 Building caretakers and related workers 2.0061217 1.5892818 sex and age
266 Social work and counselling professionals 3.2075276 1.5751088 sex and age
815 Machine operators, textile, fur and leather products 1.2919985 1.5542036 sex and age
251 ICT architects, systems analysts and test managers 2.5274101 1.4087670 sex and age
125 Sales and marketing managers 1.9020892 1.3550073 sex and age
134 Architectural and engineering managers 2.4540118 1.2227887 sex and age
961 Recycling collectors 2.2632593 1.1906325 sex and age
723 Machinery mechanics and fitters 2.0663308 1.1041179 sex and age
344 Driving instructors and other instructors 2.8774550 1.0799384 sex and age
833 Heavy truck and bus drivers 1.9017745 1.0503103 sex and age
122 Human resource managers 3.6123261 0.9673152 sex and age
226 Dentists 2.2610744 0.9612771 sex and age
224 Psychologists and psychotherapists 2.7435122 0.9185294 sex and age
711 Carpenters, bricklayers and construction workers 1.8248715 0.9020636 sex and age
761 Butchers, bakers and food processors 1.6307538 0.8629405 sex and age
141 Primary and secondary schools and adult education managers 3.5738599 0.8021870 sex and age
831 Train operators and related workers 1.7928726 0.7956301 sex and age
179 Other services managers not elsewhere classified 2.7619304 0.7557586 sex and age
218 Specialists within environmental and health protection 2.6146940 0.7229000 sex and age
516 Other service related workers 2.1156393 0.7101924 sex and age
524 Event seller and telemarketers 2.0545466 0.5044158 sex and age
752 Wood treaters, cabinet-makers and related trades workers 2.6808750 0.4777104 sex and age
265 Creative and performing artists 2.5614482 0.4592989 sex and age
912 Washers, window cleaners and other cleaning workers 2.5642100 0.3968101 sex and age
153 Elderly care managers 3.3657167 0.3924072 sex and age
343 Photographers, interior decorators and entertainers 3.4433785 0.3697008 sex and age
513 Waiters and bartenders 2.1711800 0.2718709 sex and age
129 Administration and service managers not elsewhere classified 2.2086175 0.2151892 sex and age
941 Fast-food workers, food preparation assistants 2.0158249 0.2048116 sex and age
233 Secondary education teachers 2.9895590 0.1966141 sex and age
152 Managers in social and curative care 3.9369039 0.1858560 sex and age
341 Social work and religious associate professionals 2.5917033 0.1642278 sex and age
merge(summary_table, anova_table, c("ssyk", "interaction"), all = TRUE) %>%
  filter (term.x == "year_n") %>%
  filter (contcol.y > 0) %>%   
  filter (interaction == "sex and year") %>%
  mutate (estimate = (exp(estimate) - 1) * 100) %>%  
  select (ssyk, estimate, statistic.y, interaction) %>%
  rename (`F-value for age` = statistic.y) %>%
  rename (`Increase in salary` = estimate) %>%
  arrange (desc (`F-value for age`)) %>%
  knitr::kable(
    booktabs = TRUE,
    caption = 'Correlation for F-value (sex and year) and the yearly increase in salaries')
Table 2: Correlation for F-value (sex and year) and the yearly increase in salaries
ssyk Increase in salary F-value for age interaction
131 Information and communications technology service managers 2.3096913 18.9885627 sex and year
741 Electrical equipment installers and repairers 2.8954090 15.1782057 sex and year
813 Machine operators, chemical and pharmaceutical products 1.9077963 11.5897622 sex and year
151 Health care managers 0.0045519 10.7526199 sex and year
211 Physicists and chemists 1.3915123 7.4977359 sex and year
221 Medical doctors 0.6538773 7.3600653 sex and year
816 Machine operators, food and related products 1.5717231 4.9339943 sex and year
235 Teaching professionals not elsewhere classified 2.0310346 4.5698800 sex and year
524 Event seller and telemarketers 3.5081268 4.4316751 sex and year
711 Carpenters, bricklayers and construction workers 2.2254597 4.4174399 sex and year
932 Manufacturing labourers 2.1290954 4.1545847 sex and year
262 Museum curators and librarians and related professionals 1.7899210 4.1395912 sex and year
227 Naprapaths, physiotherapists, occupational therapists 1.2922853 3.7328350 sex and year
441 Library and filing clerks 1.6621943 3.1588539 sex and year
732 Printing trades workers 1.4914084 2.9105428 sex and year
611 Market gardeners and crop growers 1.3821474 2.7246518 sex and year
266 Social work and counselling professionals 2.9450799 2.6820347 sex and year
123 Administration and planning managers 5.2325129 2.4711124 sex and year
422 Client information clerks 1.3545144 2.2011024 sex and year
261 Legal professionals 2.2865093 2.1206991 sex and year
214 Engineering professionals 1.5742827 2.0990600 sex and year
815 Machine operators, textile, fur and leather products 1.0046815 2.0981886 sex and year
267 Religious professionals and deacons 4.2599077 1.9296670 sex and year
218 Specialists within environmental and health protection 2.2923893 1.9224272 sex and year
122 Human resource managers 4.8586001 1.7650927 sex and year
251 ICT architects, systems analysts and test managers 2.1136658 1.7424405 sex and year
534 Attendants, personal assistants and related workers 1.8244819 1.7041840 sex and year
232 Vocational education teachers 2.7671447 1.4897367 sex and year
134 Architectural and engineering managers 2.0704051 1.3888211 sex and year
333 Business services agents 3.0955032 1.3284140 sex and year
834 Mobile plant operators 2.8742266 1.2866972 sex and year
814 Machine operators, rubber, plastic and paper products 2.2917499 1.2780326 sex and year
121 Finance managers 2.5063899 1.2719390 sex and year
511 Cabin crew, guides and related workers 1.2549099 1.2614665 sex and year
137 Production managers in manufacturing 2.3152928 1.2488175 sex and year
819 Process control technicians 2.5792156 1.2321895 sex and year
752 Wood treaters, cabinet-makers and related trades workers 2.3616877 1.2158818 sex and year
311 Physical and engineering science technicians 2.5830714 1.1623245 sex and year
264 Authors, journalists and linguists 1.1529306 1.1155040 sex and year
343 Photographers, interior decorators and entertainers 4.1985542 1.1106546 sex and year
243 Marketing and public relations professionals 0.9815532 1.0732378 sex and year
541 Other surveillance and security workers 2.5761973 1.0256130 sex and year
336 Police officers 3.1412715 1.0138419 sex and year
216 Architects and surveyors 2.9471943 0.9876359 sex and year
233 Secondary education teachers 2.7734258 0.9441665 sex and year
351 ICT operations and user support technicians 1.9038540 0.7819692 sex and year
132 Supply, logistics and transport managers 1.9099255 0.7677975 sex and year
342 Athletes, fitness instructors and recreational workers 1.9068283 0.7090386 sex and year
912 Washers, window cleaners and other cleaning workers 2.8087342 0.7016091 sex and year
321 Medical and pharmaceutical technicians 3.1597738 0.6977518 sex and year
962 Newspaper distributors, janitors and other service workers 1.1887397 0.6955963 sex and year
818 Other stationary plant and machine operators 2.6877777 0.6820875 sex and year
432 Stores and transport clerks 2.3817426 0.6776753 sex and year
411 Office assistants and other secretaries 2.2627780 0.6775943 sex and year
341 Social work and religious associate professionals 2.7258687 0.6031036 sex and year
153 Elderly care managers 3.1660345 0.5974951 sex and year
129 Administration and service managers not elsewhere classified 2.5786963 0.4952633 sex and year
723 Machinery mechanics and fitters 2.2281119 0.4619171 sex and year
265 Creative and performing artists 2.8167822 0.4064823 sex and year
161 Financial and insurance managers 4.5271109 0.3869820 sex and year
513 Waiters and bartenders 2.4344083 0.3385613 sex and year
761 Butchers, bakers and food processors 1.5483458 0.3298306 sex and year
179 Other services managers not elsewhere classified 3.0293121 0.3105108 sex and year
831 Train operators and related workers 1.6824270 0.3089261 sex and year
133 Research and development managers 1.1872438 0.2947620 sex and year
961 Recycling collectors 2.1940100 0.2898964 sex and year
213 Biologists, pharmacologists and specialists in agriculture and forestry 1.6757443 0.2654079 sex and year
722 Blacksmiths, toolmakers and related trades workers 1.7877696 0.2513383 sex and year
224 Psychologists and psychotherapists 2.5048041 0.2303968 sex and year
231 University and higher education teachers 2.4211367 0.2112476 sex and year
817 Wood processing and papermaking plant operators 2.8257298 0.2058922 sex and year
212 Mathematicians, actuaries and statisticians 2.1580785 0.1932679 sex and year
331 Financial and accounting associate professionals 1.8922388 0.1893544 sex and year
335 Tax and related government associate professionals 2.1448303 0.1877449 sex and year
136 Production managers in construction and mining 2.9832656 0.1877118 sex and year
941 Fast-food workers, food preparation assistants 2.1405063 0.1755668 sex and year
234 Primary- and pre-school teachers 3.4559768 0.1540937 sex and year
222 Nursing professionals 4.3218411 0.1292660 sex and year
241 Accountants, financial analysts and fund managers 2.9051016 0.1277434 sex and year
533 Health care assistants 2.0375910 0.1236315 sex and year
312 Construction and manufacturing supervisors 3.4952751 0.1144032 sex and year
332 Insurance advisers, sales and purchasing agents 1.6955017 0.0981232 sex and year
217 Designers 2.3869024 0.0963789 sex and year
159 Other social services managers 2.6064759 0.0820633 sex and year
352 Broadcasting and audio-visual technicians 0.7640921 0.0744931 sex and year
532 Personal care workers in health services 2.9147895 0.0673681 sex and year
334 Administrative and specialized secretaries 2.8414994 0.0628304 sex and year
821 Assemblers 2.7912579 0.0461133 sex and year
523 Cashiers and related clerks 0.2414249 0.0391983 sex and year
516 Other service related workers 2.1949695 0.0374522 sex and year
242 Organisation analysts, policy administrators and human resource specialists 2.3180587 0.0370499 sex and year
515 Building caretakers and related workers 1.8961579 0.0213149 sex and year
911 Cleaners and helpers 1.6893962 0.0203530 sex and year
512 Cooks and cold-buffet managers 2.7763370 0.0188044 sex and year
223 Nursing professionals (cont.) 3.1057971 0.0161602 sex and year
226 Dentists 2.2246798 0.0121797 sex and year
833 Heavy truck and bus drivers 1.8878919 0.0062890 sex and year
141 Primary and secondary schools and adult education managers 3.6011327 0.0059097 sex and year
812 Metal processing and finishing plant operators 1.7636861 0.0046745 sex and year
228 Specialists in health care not elsewhere classified 2.8440246 0.0042559 sex and year
344 Driving instructors and other instructors 2.8525929 0.0037639 sex and year
152 Managers in social and curative care 3.9152106 0.0030755 sex and year
522 Shop staff 2.5756910 0.0016560 sex and year
531 Child care workers and teachers aides 2.1809614 0.0010117 sex and year
713 Painters, Lacquerers, Chimney-sweepers and related trades workers 2.8325569 0.0006941 sex and year
125 Sales and marketing managers 1.9006017 0.0000073 sex and year
merge(summary_table, anova_table, c("ssyk", "interaction"), all = TRUE) %>%
  filter (term.x == "year_n") %>%
  filter (contcol.y > 0) %>%   
  filter (interaction == "year and age") %>%
  mutate (estimate = (exp(estimate) - 1) * 100) %>%  
  select (ssyk, estimate, statistic.y, interaction) %>%
  rename (`F-value for age` = statistic.y) %>%
  rename (`Increase in salary` = estimate) %>%
  arrange (desc (`F-value for age`)) %>%
  knitr::kable(
    booktabs = TRUE,
    caption = 'Correlation for F-value (year and age) and the yearly increase in salaries')
Table 3: Correlation for F-value (year and age) and the yearly increase in salaries
ssyk Increase in salary F-value for age interaction
515 Building caretakers and related workers 1.9559116 15.9023802 year and age
821 Assemblers 2.8879833 9.2570096 year and age
223 Nursing professionals (cont.) 3.0862129 7.5229917 year and age
812 Metal processing and finishing plant operators 1.7681082 5.9064137 year and age
912 Washers, window cleaners and other cleaning workers 2.5642100 5.6899347 year and age
516 Other service related workers 2.1152246 5.2080039 year and age
264 Authors, journalists and linguists 1.6003330 4.9115575 year and age
235 Teaching professionals not elsewhere classified 2.4893302 4.7634036 year and age
251 ICT architects, systems analysts and test managers 2.5274101 4.4833008 year and age
532 Personal care workers in health services 2.8944753 4.3339760 year and age
441 Library and filing clerks 2.1267903 4.2334206 year and age
333 Business services agents 2.3588054 4.1952156 year and age
332 Insurance advisers, sales and purchasing agents 1.7769452 4.1089082 year and age
132 Supply, logistics and transport managers 1.6502566 3.9217350 year and age
833 Heavy truck and bus drivers 1.9017745 3.6601456 year and age
932 Manufacturing labourers 2.6991481 3.6464745 year and age
432 Stores and transport clerks 2.2008861 3.5354072 year and age
222 Nursing professionals 4.2308421 3.4741301 year and age
818 Other stationary plant and machine operators 2.4062997 3.4540268 year and age
161 Financial and insurance managers 4.0364493 3.3856627 year and age
233 Secondary education teachers 2.9895590 3.1794015 year and age
234 Primary- and pre-school teachers 3.5160288 3.1553505 year and age
228 Specialists in health care not elsewhere classified 2.8875413 3.1501241 year and age
152 Managers in social and curative care 3.9235201 2.8784925 year and age
137 Production managers in manufacturing 2.6954172 2.6701651 year and age
352 Broadcasting and audio-visual technicians 0.6216704 2.5914276 year and age
334 Administrative and specialized secretaries 2.8445143 2.5139090 year and age
815 Machine operators, textile, fur and leather products 1.2919985 2.4449179 year and age
941 Fast-food workers, food preparation assistants 2.0158249 2.4202939 year and age
266 Social work and counselling professionals 3.2170157 2.4011601 year and age
216 Architects and surveyors 2.6170069 2.3614098 year and age
343 Photographers, interior decorators and entertainers 3.4645037 2.2302218 year and age
533 Health care assistants 2.0794512 2.1161718 year and age
961 Recycling collectors 2.2500279 1.9762282 year and age
211 Physicists and chemists 2.0943491 1.9599317 year and age
342 Athletes, fitness instructors and recreational workers 1.6415741 1.7856668 year and age
761 Butchers, bakers and food processors 1.6561457 1.6846191 year and age
214 Engineering professionals 1.9496371 1.6729919 year and age
153 Elderly care managers 3.3564767 1.6605420 year and age
411 Office assistants and other secretaries 2.5356754 1.6094669 year and age
534 Attendants, personal assistants and related workers 1.9366235 1.5775466 year and age
336 Police officers 2.8967989 1.5454215 year and age
541 Other surveillance and security workers 2.4232740 1.5351778 year and age
232 Vocational education teachers 3.0621355 1.5199772 year and age
513 Waiters and bartenders 2.1711800 1.3797110 year and age
212 Mathematicians, actuaries and statisticians 2.3025215 1.3794017 year and age
531 Child care workers and teachers aides 2.1977955 1.3438941 year and age
134 Architectural and engineering managers 2.4421872 1.3309754 year and age
732 Printing trades workers 1.9468028 1.2928325 year and age
344 Driving instructors and other instructors 3.0880108 1.2771979 year and age
831 Train operators and related workers 1.7390209 1.2652502 year and age
351 ICT operations and user support technicians 2.1345745 1.2472259 year and age
713 Painters, Lacquerers, Chimney-sweepers and related trades workers 2.7921442 1.2381889 year and age
261 Legal professionals 3.0754624 1.2256187 year and age
159 Other social services managers 2.5439991 1.2079146 year and age
136 Production managers in construction and mining 2.6565246 1.1618915 year and age
611 Market gardeners and crop growers 0.8091723 1.1274767 year and age
813 Machine operators, chemical and pharmaceutical products 2.5686676 1.1016766 year and age
722 Blacksmiths, toolmakers and related trades workers 1.9484997 1.0809628 year and age
241 Accountants, financial analysts and fund managers 2.7431544 1.0545884 year and age
133 Research and development managers 1.3880860 1.0327136 year and age
711 Carpenters, bricklayers and construction workers 1.7284301 0.9998010 year and age
819 Process control technicians 2.3555614 0.9854613 year and age
814 Machine operators, rubber, plastic and paper products 2.4830804 0.9597551 year and age
179 Other services managers not elsewhere classified 2.7619304 0.9365528 year and age
524 Event seller and telemarketers 2.0545466 0.9061984 year and age
752 Wood treaters, cabinet-makers and related trades workers 2.7414213 0.8802318 year and age
817 Wood processing and papermaking plant operators 2.9341892 0.8608835 year and age
331 Financial and accounting associate professionals 2.1684226 0.8564160 year and age
962 Newspaper distributors, janitors and other service workers 1.4297059 0.8546703 year and age
341 Social work and religious associate professionals 2.5900830 0.8191473 year and age
217 Designers 2.5526515 0.7984661 year and age
741 Electrical equipment installers and repairers 2.2566285 0.7858381 year and age
311 Physical and engineering science technicians 2.1298064 0.7798156 year and age
511 Cabin crew, guides and related workers 0.6997964 0.7635704 year and age
123 Administration and planning managers 4.3275243 0.7609043 year and age
512 Cooks and cold-buffet managers 2.8246521 0.6943099 year and age
265 Creative and performing artists 2.5485214 0.6640336 year and age
312 Construction and manufacturing supervisors 3.6001239 0.6252099 year and age
221 Medical doctors 1.4542955 0.6061171 year and age
131 Information and communications technology service managers 4.2967213 0.6059112 year and age
243 Marketing and public relations professionals 1.4435592 0.5717083 year and age
122 Human resource managers 3.8549956 0.5660338 year and age
321 Medical and pharmaceutical technicians 2.8974259 0.5491370 year and age
151 Health care managers 2.2391207 0.5385478 year and age
226 Dentists 2.2660904 0.5172035 year and age
218 Specialists within environmental and health protection 2.6146940 0.4971584 year and age
816 Machine operators, food and related products 2.0069383 0.4950654 year and age
224 Psychologists and psychotherapists 2.7435122 0.4914927 year and age
121 Finance managers 3.2407711 0.4712382 year and age
227 Naprapaths, physiotherapists, occupational therapists 2.1711768 0.4559658 year and age
523 Cashiers and related clerks 0.4288843 0.4465303 year and age
422 Client information clerks 1.7743297 0.4222086 year and age
911 Cleaners and helpers 1.7149158 0.4213080 year and age
834 Mobile plant operators 2.5488197 0.3653360 year and age
522 Shop staff 2.5915625 0.3222133 year and age
125 Sales and marketing managers 1.9745892 0.3192256 year and age
242 Organisation analysts, policy administrators and human resource specialists 2.2640553 0.2791956 year and age
262 Museum curators and librarians and related professionals 2.3543764 0.2615687 year and age
141 Primary and secondary schools and adult education managers 3.6123368 0.2597121 year and age
231 University and higher education teachers 2.5810115 0.2269531 year and age
723 Machinery mechanics and fitters 2.0728261 0.2269456 year and age
335 Tax and related government associate professionals 2.2959882 0.2050003 year and age
213 Biologists, pharmacologists and specialists in agriculture and forestry 1.4590279 0.1806503 year and age
267 Religious professionals and deacons 3.1655046 0.1747193 year and age
129 Administration and service managers not elsewhere classified 2.1762142 0.0684575 year and age
merge(summary_table, anova_table, c("ssyk", "interaction"), all = TRUE) %>%
  filter (term.x == "year_n") %>%
  filter (contcol.y > 1) %>%   
  filter (interaction == "sex, year and age") %>%
  filter (!(contcol.y == 1 & interaction == "sex, year and age")) %>%   
  mutate (estimate = (exp(estimate) - 1) * 100) %>%  
  select (ssyk, estimate, statistic.y, interaction) %>%
  rename (`F-value for age` = statistic.y) %>%
  rename (`Increase in salary` = estimate) %>%
  arrange (desc (`F-value for age`)) %>%
  knitr::kable(
    booktabs = TRUE,
    caption = 'Correlation for F-value (sex, year and age) and the yearly increase in salaries')
Table 4: Correlation for F-value (sex, year and age) and the yearly increase in salaries
ssyk Increase in salary F-value for age interaction
161 Financial and insurance managers 6.7014383 12.8607103 sex, year and age
212 Mathematicians, actuaries and statisticians 1.9911366 10.4095062 sex, year and age
267 Religious professionals and deacons 4.1658118 8.7837115 sex, year and age
227 Naprapaths, physiotherapists, occupational therapists 2.4303726 8.1151159 sex, year and age
152 Managers in social and curative care 2.5213877 6.6049915 sex, year and age
713 Painters, Lacquerers, Chimney-sweepers and related trades workers 2.9730902 6.1709248 sex, year and age
343 Photographers, interior decorators and entertainers 0.5060734 6.1295901 sex, year and age
151 Health care managers -1.2649194 5.9426940 sex, year and age
261 Legal professionals 2.3125463 5.5530411 sex, year and age
216 Architects and surveyors 3.1604358 4.3669656 sex, year and age
341 Social work and religious associate professionals 2.5727375 4.1594012 sex, year and age
441 Library and filing clerks 1.3204015 3.5932816 sex, year and age
833 Heavy truck and bus drivers 1.8961398 3.4082814 sex, year and age
432 Stores and transport clerks 2.1649036 3.3329059 sex, year and age
344 Driving instructors and other instructors 2.4848718 3.3062803 sex, year and age
342 Athletes, fitness instructors and recreational workers 1.9068283 3.2624869 sex, year and age
741 Electrical equipment installers and repairers 2.8664232 3.1590750 sex, year and age
235 Teaching professionals not elsewhere classified 2.0310346 3.1408651 sex, year and age
228 Specialists in health care not elsewhere classified 3.3736609 2.9090416 sex, year and age
711 Carpenters, bricklayers and construction workers 2.1627237 2.7534146 sex, year and age
961 Recycling collectors 2.1566912 2.7467393 sex, year and age
911 Cleaners and helpers 1.7263476 2.4634242 sex, year and age
262 Museum curators and librarians and related professionals 2.3015865 2.3970735 sex, year and age
222 Nursing professionals 4.2407032 2.3527290 sex, year and age
213 Biologists, pharmacologists and specialists in agriculture and forestry 1.6757443 2.3028311 sex, year and age
334 Administrative and specialized secretaries 2.7956288 2.2055190 sex, year and age
513 Waiters and bartenders 0.8749792 2.1159294 sex, year and age
523 Cashiers and related clerks 2.8459448 2.0567141 sex, year and age
534 Attendants, personal assistants and related workers 1.8244819 1.9933909 sex, year and age
816 Machine operators, food and related products 1.5717231 1.9024147 sex, year and age
817 Wood processing and papermaking plant operators 2.8257298 1.8237211 sex, year and age
242 Organisation analysts, policy administrators and human resource specialists 2.3180587 1.7886047 sex, year and age
332 Insurance advisers, sales and purchasing agents 1.7859408 1.7585242 sex, year and age
515 Building caretakers and related workers 2.0556672 1.7184190 sex, year and age
132 Supply, logistics and transport managers 2.2475088 1.6580301 sex, year and age
241 Accountants, financial analysts and fund managers 2.9051016 1.3893091 sex, year and age
211 Physicists and chemists 1.3915123 1.3625703 sex, year and age
218 Specialists within environmental and health protection 2.2923893 1.3335963 sex, year and age
732 Printing trades workers 1.4520363 1.3253827 sex, year and age
818 Other stationary plant and machine operators 2.6877777 1.3237424 sex, year and age
232 Vocational education teachers 2.7950272 1.1768965 sex, year and age
541 Other surveillance and security workers 2.5928421 1.1184021 sex, year and age
834 Mobile plant operators 2.8552448 1.1025428 sex, year and age
352 Broadcasting and audio-visual technicians 0.8738449 1.0491745 sex, year and age
159 Other social services managers 2.5733968 1.0457667 sex, year and age
131 Information and communications technology service managers 2.3673892 1.0310987 sex, year and age
815 Machine operators, textile, fur and leather products 1.0046815 0.9282509 sex, year and age
941 Fast-food workers, food preparation assistants 2.4028452 0.8902366 sex, year and age
912 Washers, window cleaners and other cleaning workers 2.8087342 0.8797368 sex, year and age
524 Event seller and telemarketers 3.4988451 0.8544225 sex, year and age
121 Finance managers 2.5670784 0.8466459 sex, year and age
512 Cooks and cold-buffet managers 3.2163958 0.8442390 sex, year and age
136 Production managers in construction and mining 2.8467904 0.7932921 sex, year and age
814 Machine operators, rubber, plastic and paper products 2.2917499 0.7793006 sex, year and age
214 Engineering professionals 1.6492316 0.7761337 sex, year and age
813 Machine operators, chemical and pharmaceutical products 1.9063935 0.7563922 sex, year and age
531 Child care workers and teachers aides 2.0950582 0.7028050 sex, year and age
265 Creative and performing artists 2.9175166 0.6854106 sex, year and age
336 Police officers 3.1628844 0.6829463 sex, year and age
123 Administration and planning managers 5.2325129 0.6568238 sex, year and age
226 Dentists 2.2002919 0.6424133 sex, year and age
821 Assemblers 2.7298723 0.6272515 sex, year and age
266 Social work and counselling professionals 2.9030963 0.6105511 sex, year and age
333 Business services agents 3.4608843 0.6059347 sex, year and age
122 Human resource managers 2.8367433 0.6024562 sex, year and age
264 Authors, journalists and linguists 1.1529306 0.5903280 sex, year and age
134 Architectural and engineering managers 2.1160537 0.5768053 sex, year and age
153 Elderly care managers 3.0364263 0.5758293 sex, year and age
125 Sales and marketing managers 1.6739767 0.5704022 sex, year and age
133 Research and development managers 1.1597044 0.5683059 sex, year and age
932 Manufacturing labourers 2.1290954 0.5548487 sex, year and age
312 Construction and manufacturing supervisors 3.4591641 0.5377424 sex, year and age
335 Tax and related government associate professionals 2.1448303 0.5243855 sex, year and age
533 Health care assistants 2.0013978 0.4993126 sex, year and age
221 Medical doctors 0.6685600 0.4775631 sex, year and age
819 Process control technicians 2.6501438 0.4743982 sex, year and age
243 Marketing and public relations professionals 1.0617941 0.4741832 sex, year and age
611 Market gardeners and crop growers 1.4116246 0.4502343 sex, year and age
231 University and higher education teachers 2.4211367 0.4173814 sex, year and age
233 Secondary education teachers 2.7734258 0.3928290 sex, year and age
962 Newspaper distributors, janitors and other service workers 1.1318853 0.3918519 sex, year and age
137 Production managers in manufacturing 2.1660640 0.3369015 sex, year and age
141 Primary and secondary schools and adult education managers 3.4089930 0.3318747 sex, year and age
422 Client information clerks 1.3506000 0.3234139 sex, year and age
511 Cabin crew, guides and related workers 1.2549099 0.3045993 sex, year and age
179 Other services managers not elsewhere classified 3.0293121 0.3041590 sex, year and age
223 Nursing professionals (cont.) 2.8788243 0.2989413 sex, year and age
234 Primary- and pre-school teachers 3.4559768 0.2757739 sex, year and age
532 Personal care workers in health services 2.9147895 0.2709784 sex, year and age
722 Blacksmiths, toolmakers and related trades workers 1.8671965 0.2638641 sex, year and age
831 Train operators and related workers 1.5460450 0.2570093 sex, year and age
331 Financial and accounting associate professionals 1.8020273 0.2535867 sex, year and age
411 Office assistants and other secretaries 2.2627780 0.1869850 sex, year and age
812 Metal processing and finishing plant operators 1.7305642 0.1741774 sex, year and age
311 Physical and engineering science technicians 2.6472370 0.1720296 sex, year and age
761 Butchers, bakers and food processors 1.6172221 0.1659462 sex, year and age
224 Psychologists and psychotherapists 2.4333553 0.1445774 sex, year and age
321 Medical and pharmaceutical technicians 3.2440727 0.1215590 sex, year and age
217 Designers 2.3869024 0.1138331 sex, year and age
351 ICT operations and user support technicians 1.7567973 0.1112492 sex, year and age
516 Other service related workers 2.8434718 0.0882348 sex, year and age
129 Administration and service managers not elsewhere classified 2.6395673 0.0513667 sex, year and age
723 Machinery mechanics and fitters 2.2720551 0.0252031 sex, year and age
752 Wood treaters, cabinet-makers and related trades workers 2.2552676 0.0214662 sex, year and age
522 Shop staff 2.8964681 0.0194987 sex, year and age
251 ICT architects, systems analysts and test managers 2.2488355 0.0081645 sex, year and age

Let’s check what we have found.

temp <- tb %>%
  filter(`occuptional  (SSYK 2012)` == "335 Tax and related government associate professionals")
 
model <-lm (log(salary) ~ year_n + sex * poly(age_n, 3), data = temp) 
 
plot_model(model, type = "pred", terms = c("age_n", "sex"))
## Model has log-transformed response. Back-transforming predictions to original response scale. Standard errors are still on the log-scale.

Highest F-value interaction sex and age, Tax and related government associate professionals

Figure 2: Highest F-value interaction sex and age, Tax and related government associate professionals

temp <- tb %>%
  filter(`occuptional  (SSYK 2012)` == "341 Social work and religious associate professionals")
 
model <-lm (log(salary) ~ year_n + sex * poly(age_n, 3), data = temp) 
 
plot_model(model, type = "pred", terms = c("age_n", "sex"))
## Model has log-transformed response. Back-transforming predictions to original response scale. Standard errors are still on the log-scale.

Lowest F-value interaction sex and age, Social work and religious associate professionals

Figure 3: Lowest F-value interaction sex and age, Social work and religious associate professionals

temp <- tb %>%
  filter(`occuptional  (SSYK 2012)` == "131 Information and communications technology service managers")
 
model <-lm (log(salary) ~ year_n * sex + poly(age_n, 3), data = temp) 
 
plot_model(model, type = "pred", terms = c("year_n", "sex"))
## Model has log-transformed response. Back-transforming predictions to original response scale. Standard errors are still on the log-scale.

Highest F-value interaction sex and year, Information and communications technology service managers

Figure 4: Highest F-value interaction sex and year, Information and communications technology service managers

temp <- tb %>%
  filter(`occuptional  (SSYK 2012)` == "125 Sales and marketing managers")
 
model <-lm (log(salary) ~ year_n * sex + poly(age_n, 3), data = temp) 
 
plot_model(model, type = "pred", terms = c("year_n", "sex"))
## Model has log-transformed response. Back-transforming predictions to original response scale. Standard errors are still on the log-scale.

Lowest F-value interaction sex and year, Sales and marketing managers

Figure 5: Lowest F-value interaction sex and year, Sales and marketing managers

temp <- tb %>%
  filter(`occuptional  (SSYK 2012)` == "515 Building caretakers and related workers")
 
model <-lm (log(salary) ~ sex + year_n * poly(age_n, 3), data = temp) 
 
plot_model(model, type = "pred", terms = c("age_n", "year_n"))
## Model has log-transformed response. Back-transforming predictions to original response scale. Standard errors are still on the log-scale.

Highest F-value interaction year and age, Building caretakers and related workers

Figure 6: Highest F-value interaction year and age, Building caretakers and related workers

temp <- tb %>%
  filter(`occuptional  (SSYK 2012)` == "129 Administration and service managers not elsewhere classified")
 
model <-lm (log(salary) ~ sex + year_n * poly(age_n, 3), data = temp) 
 
plot_model(model, type = "pred", terms = c("age_n", "year_n"))
## Model has log-transformed response. Back-transforming predictions to original response scale. Standard errors are still on the log-scale.

Lowest F-value interaction year and age, Administration and service managers not elsewhere classified

Figure 7: Lowest F-value interaction year and age, Administration and service managers not elsewhere classified

temp <- tb %>%
  filter(`occuptional  (SSYK 2012)` == "161 Financial and insurance managers")
 
model <-lm (log(salary) ~ sex * year_n * poly(age_n, 3), data = temp) 
 
plot_model(model, type = "pred", terms = c("age_n", "year_n", "sex"))
## Warning in predict.lm(model, newdata = fitfram, type = "response", se.fit =
## se, : prediction from a rank-deficient fit may be misleading
## Model has log-transformed response. Back-transforming predictions to original response scale. Standard errors are still on the log-scale.

Highest F-value interaction sex, year and age, Financial and insurance managers

Figure 8: Highest F-value interaction sex, year and age, Financial and insurance managers

temp <- tb %>%
  filter(`occuptional  (SSYK 2012)` == "251 ICT architects, systems analysts and test managers")
 
model <-lm (log(salary) ~ sex * year_n * poly(age_n, 3), data = temp) 
 
plot_model(model, type = "pred", terms = c("age_n", "year_n", "sex"))
## Model has log-transformed response. Back-transforming predictions to original response scale. Standard errors are still on the log-scale.

Lowest F-value interaction sex, year and age, ICT architects, systems analysts and test managers

Figure 9: Lowest F-value interaction sex, year and age, ICT architects, systems analysts and test managers

We proceed by examining the interaction between education, year, gender.

The data table is downloaded from Statistics Sweden. It is saved as a comma-delimited file without heading, 000000CY.csv, http://www.statistikdatabasen.scb.se/pxweb/en/ssd/.

The table: Average basic salary, monthly salary and women´s salary as a percentage of men´s salary by sector, occupational group (SSYK 2012), sex and educational level (SUN). Year 2014 - 2018 Monthly salary All sectors

I will use a categorical predictor to fit the contribution of education to the salary.

In the plot and tables, you can also find information on how the increase in salaries per year for each occupational group is affected when the interactions are taken into account.

tb <- readfile("000000CY.csv") %>% 
  mutate(edulevel = `level of education`)

numedulevel <- read.csv("edulevel.csv") 
  
tbnum <- tb %>% 
  right_join(numedulevel, by = c("level of education" = "level.of.education")) %>%
  filter(!is.na(eduyears)) %>%
  mutate(eduyears = factor(eduyears))
## Warning: Column `level of education`/`level.of.education` joining character
## vector and factor, coercing into character vector
summary_table = vector()
anova_table = vector()
for (i in unique(tbnum$`occuptional  (SSYK 2012)`)){
  temp <- filter(tbnum, `occuptional  (SSYK 2012)` == i)
  if (dim(temp)[1] > 30){
    model <-lm (log(salary) ~ year_n + sex * edulevel, data = temp)
    summary_table <- rbind (summary_table, mutate (tidy (summary (model)), ssyk = i, interaction = "sex and edulevel"))
    anova_table <- rbind (anova_table, mutate (tidy (Anova (model, type = 2)), ssyk = i, interaction = "sex and edulevel"))
    
    model <-lm (log(salary) ~ year_n * sex + edulevel, data = temp)
    summary_table <- rbind (summary_table, mutate (tidy (summary (model)), ssyk = i, interaction = "sex and year"))
    anova_table <- rbind (anova_table, mutate (tidy (Anova (model, type = 2)), ssyk = i, interaction = "sex and year"))

    model <-lm (log(salary) ~ sex + year_n * edulevel, data = temp)
    summary_table <- rbind (summary_table, mutate (tidy (summary (model)), ssyk = i, interaction = "year and edulevel"))
    anova_table <- rbind (anova_table, mutate (tidy (Anova (model, type = 2)), ssyk = i, interaction = "year and edulevel"))
    
    model <-lm (log(salary) ~ year_n * sex * edulevel, data = temp)
    summary_table <- rbind (summary_table, mutate (tidy (summary (model)), ssyk = i, interaction = "sex, year and edulevel"))
    anova_table <- rbind (anova_table, mutate (tidy (Anova (model, type = 2)), ssyk = i, interaction = "sex, year and edulevel"))   
    }
}  
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
## Note: model has aliased coefficients
##       sums of squares computed by model comparison
anova_table <- anova_table %>% rowwise() %>% mutate(contcol = str_count(term, ":"))  

summary_table <- summary_table %>% rowwise() %>% mutate(contcol = str_count(term, ":"))

merge(summary_table, anova_table, by = c("ssyk", "interaction"), all = TRUE) %>%
  filter (term.x == "year_n") %>%
  filter (contcol.y > 0) %>%  
  filter (!(contcol.y == 1 & interaction == "sex, year and edulevel")) %>% 
  mutate (estimate = (exp(estimate) - 1) * 100) %>%
  ggplot () +
    geom_point (mapping = aes(x = estimate, y = statistic.y, colour = interaction)) +
    labs(
      x = "Increase in salaries (% / year)",
      y = "F-value for education"
    ) 

The significance of education, year, sex and the interaction between them on the salary in Sweden, a comparison between different occupational groups, Year 2014 - 2018

Figure 10: The significance of education, year, sex and the interaction between them on the salary in Sweden, a comparison between different occupational groups, Year 2014 - 2018

The table with all occupational groups sorted by F-value in descending order.

merge(summary_table, anova_table, c("ssyk", "interaction"), all = TRUE) %>%
  filter (term.x == "year_n") %>%
  filter (contcol.y > 0) %>%   
  filter (interaction == "sex and edulevel") %>%
  mutate (estimate = (exp(estimate) - 1) * 100) %>%  
  select (ssyk, estimate, statistic.y, interaction) %>%
  rename (`F-value for age` = statistic.y) %>%
  rename (`Increase in salary` = estimate) %>%
  arrange (desc (`F-value for age`)) %>%
  knitr::kable(
    booktabs = TRUE,
    caption = 'Correlation for F-value (sex and edulevel) and the yearly increase in salaries')
Table 5: Correlation for F-value (sex and edulevel) and the yearly increase in salaries
ssyk Increase in salary F-value for age interaction
231 University and higher education teachers 2.2958141 34.5015790 sex and edulevel
531 Child care workers and teachers aides 2.0849482 22.9893835 sex and edulevel
534 Attendants, personal assistants and related workers 1.9853599 17.8765982 sex and edulevel
159 Other social services managers 2.5200022 17.2526856 sex and edulevel
331 Financial and accounting associate professionals 1.9408245 15.3185884 sex and edulevel
232 Vocational education teachers 2.8905545 13.2302391 sex and edulevel
235 Teaching professionals not elsewhere classified 1.8910322 12.9225823 sex and edulevel
533 Health care assistants 1.9894190 12.7840342 sex and edulevel
532 Personal care workers in health services 2.8496725 9.1729109 sex and edulevel
335 Tax and related government associate professionals 2.3353756 7.9120778 sex and edulevel
151 Health care managers 2.3371897 7.8893324 sex and edulevel
312 Construction and manufacturing supervisors 3.2514155 7.5021320 sex and edulevel
221 Medical doctors 1.6287887 7.2076142 sex and edulevel
261 Legal professionals 3.0480065 6.8746713 sex and edulevel
213 Biologists, pharmacologists and specialists in agriculture and forestry 1.5450027 6.5884385 sex and edulevel
123 Administration and planning managers 3.2940731 6.5099919 sex and edulevel
332 Insurance advisers, sales and purchasing agents 2.2092499 6.4609540 sex and edulevel
218 Specialists within environmental and health protection 2.7392976 6.4333433 sex and edulevel
815 Machine operators, textile, fur and leather products 1.2987260 5.9964706 sex and edulevel
352 Broadcasting and audio-visual technicians 1.1989274 5.9008142 sex and edulevel
234 Primary- and pre-school teachers 2.9842522 5.5772411 sex and edulevel
179 Other services managers not elsewhere classified 2.7707830 5.5622073 sex and edulevel
818 Other stationary plant and machine operators 2.3348813 5.3288394 sex and edulevel
122 Human resource managers 2.8136311 5.2385563 sex and edulevel
831 Train operators and related workers 1.8323618 4.7619015 sex and edulevel
133 Research and development managers 1.2477491 4.7380058 sex and edulevel
242 Organisation analysts, policy administrators and human resource specialists 1.7745769 4.6468566 sex and edulevel
432 Stores and transport clerks 1.8812238 4.5189085 sex and edulevel
819 Process control technicians 2.2014594 4.3967289 sex and edulevel
441 Library and filing clerks 1.8816062 4.2560137 sex and edulevel
311 Physical and engineering science technicians 1.8230392 4.1225856 sex and edulevel
422 Client information clerks 1.8028560 4.0863532 sex and edulevel
513 Waiters and bartenders 2.8449379 3.9818863 sex and edulevel
217 Designers 2.7808393 3.7385345 sex and edulevel
125 Sales and marketing managers 2.3036799 3.4839265 sex and edulevel
214 Engineering professionals 2.2866957 3.3293074 sex and edulevel
132 Supply, logistics and transport managers 1.2954135 3.2963695 sex and edulevel
821 Assemblers 2.8859212 3.2954380 sex and edulevel
341 Social work and religious associate professionals 2.5669973 3.2470601 sex and edulevel
523 Cashiers and related clerks 1.4161452 3.1231802 sex and edulevel
161 Financial and insurance managers 2.8561469 3.0300851 sex and edulevel
411 Office assistants and other secretaries 2.2467740 2.9941491 sex and edulevel
941 Fast-food workers, food preparation assistants 1.8006179 2.9874932 sex and edulevel
342 Athletes, fitness instructors and recreational workers 1.7794145 2.9204408 sex and edulevel
334 Administrative and specialized secretaries 3.1996557 2.7701174 sex and edulevel
216 Architects and surveyors 2.0531986 2.7656716 sex and edulevel
511 Cabin crew, guides and related workers 0.5200769 2.6492869 sex and edulevel
812 Metal processing and finishing plant operators 0.7894188 2.4826989 sex and edulevel
251 ICT architects, systems analysts and test managers 2.5832621 2.4743375 sex and edulevel
817 Wood processing and papermaking plant operators 2.8508683 2.3671829 sex and edulevel
524 Event seller and telemarketers 1.7483645 2.3363353 sex and edulevel
121 Finance managers 2.5622573 2.3103331 sex and edulevel
522 Shop staff 2.1891308 2.1309636 sex and edulevel
723 Machinery mechanics and fitters 1.9652100 2.1236645 sex and edulevel
321 Medical and pharmaceutical technicians 2.7193546 2.0749292 sex and edulevel
911 Cleaners and helpers 1.8900136 1.9883146 sex and edulevel
137 Production managers in manufacturing 1.8204783 1.9834843 sex and edulevel
541 Other surveillance and security workers 2.4854095 1.8987495 sex and edulevel
962 Newspaper distributors, janitors and other service workers 1.5168559 1.7259970 sex and edulevel
834 Mobile plant operators 2.3493104 1.6776513 sex and edulevel
131 Information and communications technology service managers 4.5217451 1.5468919 sex and edulevel
264 Authors, journalists and linguists 0.9398759 1.5389406 sex and edulevel
732 Printing trades workers 1.3754920 1.4116364 sex and edulevel
961 Recycling collectors 2.5026241 1.3670042 sex and edulevel
333 Business services agents 2.6647133 1.2102215 sex and edulevel
932 Manufacturing labourers 2.9938554 1.1866761 sex and edulevel
241 Accountants, financial analysts and fund managers 3.0649247 1.0785958 sex and edulevel
343 Photographers, interior decorators and entertainers 3.7751554 1.0765630 sex and edulevel
512 Cooks and cold-buffet managers 2.3823637 1.0684103 sex and edulevel
833 Heavy truck and bus drivers 1.6067155 1.0284369 sex and edulevel
129 Administration and service managers not elsewhere classified 2.3080253 1.0114151 sex and edulevel
173 Retail and wholesale trade managers 4.5823781 0.8462927 sex and edulevel
233 Secondary education teachers 2.3727154 0.7689329 sex and edulevel
611 Market gardeners and crop growers 1.2948139 0.7273208 sex and edulevel
243 Marketing and public relations professionals 0.6033059 0.6504950 sex and edulevel
136 Production managers in construction and mining 1.9290646 0.6163258 sex and edulevel
711 Carpenters, bricklayers and construction workers 1.8229891 0.5364368 sex and edulevel
816 Machine operators, food and related products 1.7935335 0.4643469 sex and edulevel
262 Museum curators and librarians and related professionals 3.0179014 0.4478464 sex and edulevel
722 Blacksmiths, toolmakers and related trades workers 1.9606924 0.4286145 sex and edulevel
351 ICT operations and user support technicians 1.7201155 0.3979107 sex and edulevel
265 Creative and performing artists 3.0842617 0.3975144 sex and edulevel
516 Other service related workers 2.8114718 0.3611032 sex and edulevel
813 Machine operators, chemical and pharmaceutical products 2.2201342 0.3378979 sex and edulevel
515 Building caretakers and related workers 2.6332939 0.2296460 sex and edulevel
134 Architectural and engineering managers 2.8463094 0.1876642 sex and edulevel
266 Social work and counselling professionals 2.4259163 0.1355394 sex and edulevel
814 Machine operators, rubber, plastic and paper products 2.4479515 0.0917245 sex and edulevel
merge(summary_table, anova_table, c("ssyk", "interaction"), all = TRUE) %>%
  filter (term.x == "year_n") %>%
  filter (contcol.y > 0) %>%   
  filter (interaction == "sex and year") %>%
  mutate (estimate = (exp(estimate) - 1) * 100) %>%  
  select (ssyk, estimate, statistic.y, interaction) %>%
  rename (`F-value for age` = statistic.y) %>%
  rename (`Increase in salary` = estimate) %>%
  arrange (desc (`F-value for age`)) %>%
  knitr::kable(
    booktabs = TRUE,
    caption = 'Correlation for F-value (sex and year) and the yearly increase in salaries')
Table 6: Correlation for F-value (sex and year) and the yearly increase in salaries
ssyk Increase in salary F-value for age interaction
262 Museum curators and librarians and related professionals 1.3370390 12.5685564 sex and year
813 Machine operators, chemical and pharmaceutical products 1.7231905 10.6533739 sex and year
131 Information and communications technology service managers 2.7462737 10.0982495 sex and year
151 Health care managers 1.3373535 9.1937238 sex and year
815 Machine operators, textile, fur and leather products 0.7515225 8.5275034 sex and year
243 Marketing and public relations professionals -0.5550314 7.7320191 sex and year
932 Manufacturing labourers 2.4564479 5.1323005 sex and year
816 Machine operators, food and related products 1.4102081 4.6641162 sex and year
311 Physical and engineering science technicians 2.6295635 4.4514388 sex and year
819 Process control technicians 2.5143689 3.3882796 sex and year
533 Health care assistants 1.7959772 3.3597299 sex and year
351 ICT operations and user support technicians 1.3030832 3.3339379 sex and year
221 Medical doctors 1.0703216 3.2379210 sex and year
264 Authors, journalists and linguists 0.2830418 3.2324009 sex and year
541 Other surveillance and security workers 2.6683785 3.0177453 sex and year
511 Cabin crew, guides and related workers 1.3314937 2.7734531 sex and year
834 Mobile plant operators 2.6262371 2.7299923 sex and year
159 Other social services managers 2.1787998 2.6997604 sex and year
173 Retail and wholesale trade managers 6.2849030 2.6920564 sex and year
341 Social work and religious associate professionals 2.7993782 2.4785285 sex and year
312 Construction and manufacturing supervisors 3.5850660 2.1887133 sex and year
723 Machinery mechanics and fitters 2.3375170 2.1272013 sex and year
235 Teaching professionals not elsewhere classified 1.3782887 2.1168491 sex and year
821 Assemblers 2.5894715 2.0183158 sex and year
122 Human resource managers 1.6158738 1.8995024 sex and year
123 Administration and planning managers 4.0238453 1.7601948 sex and year
334 Administrative and specialized secretaries 3.7714265 1.6845647 sex and year
512 Cooks and cold-buffet managers 2.7497179 1.4835714 sex and year
179 Other services managers not elsewhere classified 3.2090223 1.4601245 sex and year
732 Printing trades workers 1.1043814 1.3695629 sex and year
432 Stores and transport clerks 1.6848001 1.3440502 sex and year
411 Office assistants and other secretaries 1.9008129 1.1244333 sex and year
814 Machine operators, rubber, plastic and paper products 2.2707050 1.0815608 sex and year
911 Cleaners and helpers 2.0298327 1.0400501 sex and year
962 Newspaper distributors, janitors and other service workers 1.2842640 1.0400405 sex and year
812 Metal processing and finishing plant operators 0.0598298 0.9982723 sex and year
321 Medical and pharmaceutical technicians 3.0095453 0.9569319 sex and year
352 Broadcasting and audio-visual technicians 0.7887304 0.9352994 sex and year
441 Library and filing clerks 1.6143560 0.9017484 sex and year
343 Photographers, interior decorators and entertainers 4.3863478 0.8400912 sex and year
817 Wood processing and papermaking plant operators 2.6936338 0.7010849 sex and year
422 Client information clerks 1.6081275 0.6920726 sex and year
333 Business services agents 3.0014789 0.6872118 sex and year
137 Production managers in manufacturing 2.2137062 0.6712665 sex and year
331 Financial and accounting associate professionals 1.6611645 0.6470988 sex and year
232 Vocational education teachers 2.6579475 0.6330528 sex and year
532 Personal care workers in health services 2.7713176 0.6314612 sex and year
121 Finance managers 2.1097794 0.6254650 sex and year
833 Heavy truck and bus drivers 1.7707251 0.5974334 sex and year
513 Waiters and bartenders 2.3751929 0.4976799 sex and year
265 Creative and performing artists 2.6869389 0.4912352 sex and year
161 Financial and insurance managers 3.3678037 0.4848632 sex and year
534 Attendants, personal assistants and related workers 1.7516818 0.4712625 sex and year
266 Social work and counselling professionals 2.2254012 0.4681457 sex and year
332 Insurance advisers, sales and purchasing agents 2.4028894 0.4468183 sex and year
524 Event seller and telemarketers 2.0532844 0.4218714 sex and year
242 Organisation analysts, policy administrators and human resource specialists 1.5992807 0.3854059 sex and year
711 Carpenters, bricklayers and construction workers 1.9691994 0.3716610 sex and year
941 Fast-food workers, food preparation assistants 1.6155630 0.3607242 sex and year
261 Legal professionals 3.3823847 0.3303860 sex and year
516 Other service related workers 2.5058837 0.3278309 sex and year
342 Athletes, fitness instructors and recreational workers 1.9757715 0.2936025 sex and year
134 Architectural and engineering managers 3.0210896 0.2305112 sex and year
132 Supply, logistics and transport managers 1.2733534 0.2184407 sex and year
522 Shop staff 2.0517358 0.2003355 sex and year
214 Engineering professionals 2.2103539 0.1363967 sex and year
136 Production managers in construction and mining 1.8048620 0.1361198 sex and year
129 Administration and service managers not elsewhere classified 2.3857822 0.1359729 sex and year
722 Blacksmiths, toolmakers and related trades workers 2.0295905 0.1151279 sex and year
213 Biologists, pharmacologists and specialists in agriculture and forestry 1.6901080 0.1061134 sex and year
515 Building caretakers and related workers 2.7062205 0.1013957 sex and year
611 Market gardeners and crop growers 1.3388971 0.0784413 sex and year
241 Accountants, financial analysts and fund managers 3.1531437 0.0419040 sex and year
523 Cashiers and related clerks 1.2219886 0.0365257 sex and year
251 ICT architects, systems analysts and test managers 2.6453968 0.0341629 sex and year
125 Sales and marketing managers 2.2616762 0.0175115 sex and year
133 Research and development managers 1.1102691 0.0171085 sex and year
217 Designers 2.7155067 0.0160870 sex and year
218 Specialists within environmental and health protection 2.5604843 0.0138650 sex and year
234 Primary- and pre-school teachers 3.0003110 0.0070748 sex and year
233 Secondary education teachers 2.3980983 0.0066879 sex and year
231 University and higher education teachers 2.2687967 0.0051000 sex and year
831 Train operators and related workers 1.8251453 0.0043574 sex and year
335 Tax and related government associate professionals 2.3241995 0.0038471 sex and year
531 Child care workers and teachers aides 2.0954991 0.0031907 sex and year
216 Architects and surveyors 2.0729695 0.0031382 sex and year
818 Other stationary plant and machine operators 2.3325473 0.0016111 sex and year
961 Recycling collectors 2.4977953 0.0008583 sex and year
merge(summary_table, anova_table, c("ssyk", "interaction"), all = TRUE) %>%
  filter (term.x == "year_n") %>%
  filter (contcol.y > 0) %>%   
  filter (interaction == "year and edulevel") %>%
  mutate (estimate = (exp(estimate) - 1) * 100) %>%  
  select (ssyk, estimate, statistic.y, interaction) %>%
  rename (`F-value for age` = statistic.y) %>%
  rename (`Increase in salary` = estimate) %>%
  arrange (desc (`F-value for age`)) %>%
  knitr::kable(
    booktabs = TRUE,
    caption = 'Correlation for F-value (year and edulevel) and the yearly increase in salaries')
Table 7: Correlation for F-value (year and edulevel) and the yearly increase in salaries
ssyk Increase in salary F-value for age interaction
534 Attendants, personal assistants and related workers -0.1402810 17.4936553 year and edulevel
812 Metal processing and finishing plant operators -5.1520587 15.9949732 year and edulevel
262 Museum curators and librarians and related professionals 1.9840758 8.0470057 year and edulevel
234 Primary- and pre-school teachers 3.8838951 5.4208619 year and edulevel
522 Shop staff 0.0698877 5.0158953 year and edulevel
129 Administration and service managers not elsewhere classified 4.1673228 4.7271849 year and edulevel
161 Financial and insurance managers 4.5135081 4.0324041 year and edulevel
516 Other service related workers 7.2670210 3.1139823 year and edulevel
125 Sales and marketing managers 2.3472066 3.0940253 year and edulevel
131 Information and communications technology service managers 2.1201215 2.8775913 year and edulevel
243 Marketing and public relations professionals 0.7324120 2.7082606 year and edulevel
335 Tax and related government associate professionals 1.1765682 2.5942601 year and edulevel
242 Organisation analysts, policy administrators and human resource specialists 1.3687826 2.5767431 year and edulevel
511 Cabin crew, guides and related workers 1.6565700 2.4973120 year and edulevel
541 Other surveillance and security workers 2.9299467 2.4531985 year and edulevel
233 Secondary education teachers 3.2921464 2.3912796 year and edulevel
221 Medical doctors 2.6099777 2.3282085 year and edulevel
343 Photographers, interior decorators and entertainers 1.7484483 2.3120145 year and edulevel
352 Broadcasting and audio-visual technicians 1.1530191 2.3008338 year and edulevel
821 Assemblers 3.4717300 2.2599823 year and edulevel
241 Accountants, financial analysts and fund managers 1.6197117 2.2273108 year and edulevel
515 Building caretakers and related workers 3.4401456 2.1128708 year and edulevel
121 Finance managers 2.3907091 1.8807514 year and edulevel
232 Vocational education teachers 3.0442130 1.7782730 year and edulevel
218 Specialists within environmental and health protection 3.3885291 1.7324927 year and edulevel
173 Retail and wholesale trade managers 7.4640395 1.6906345 year and edulevel
266 Social work and counselling professionals 3.4582880 1.6867797 year and edulevel
524 Event seller and telemarketers 0.5903028 1.6179929 year and edulevel
251 ICT architects, systems analysts and test managers 3.4450065 1.5962935 year and edulevel
732 Printing trades workers 1.4035774 1.4933929 year and edulevel
151 Health care managers 1.9531112 1.4056639 year and edulevel
261 Legal professionals 2.4524403 1.3545649 year and edulevel
818 Other stationary plant and machine operators 1.1073347 1.3304879 year and edulevel
123 Administration and planning managers 1.8272030 1.3139512 year and edulevel
932 Manufacturing labourers 2.0273905 1.2593432 year and edulevel
311 Physical and engineering science technicians 1.2484897 1.2546202 year and edulevel
723 Machinery mechanics and fitters 3.1964544 1.2328322 year and edulevel
265 Creative and performing artists 1.7733798 1.2051886 year and edulevel
531 Child care workers and teachers aides 1.6218079 1.0967008 year and edulevel
411 Office assistants and other secretaries 4.8834688 1.0316452 year and edulevel
235 Teaching professionals not elsewhere classified 2.8482974 1.0232382 year and edulevel
214 Engineering professionals 2.0110404 1.0077700 year and edulevel
333 Business services agents 1.7631050 0.9966769 year and edulevel
264 Authors, journalists and linguists 1.4793444 0.9754283 year and edulevel
512 Cooks and cold-buffet managers 2.1856120 0.9514593 year and edulevel
342 Athletes, fitness instructors and recreational workers 2.1163882 0.9498070 year and edulevel
133 Research and development managers 0.5839858 0.9449465 year and edulevel
217 Designers 3.2594826 0.9229512 year and edulevel
134 Architectural and engineering managers 1.2211597 0.9193392 year and edulevel
334 Administrative and specialized secretaries 1.9614167 0.9145418 year and edulevel
961 Recycling collectors 0.5439750 0.8972133 year and edulevel
332 Insurance advisers, sales and purchasing agents 2.2720763 0.8912591 year and edulevel
137 Production managers in manufacturing 1.8909772 0.8796878 year and edulevel
816 Machine operators, food and related products 1.5011716 0.8683619 year and edulevel
611 Market gardeners and crop growers 0.9702078 0.7969390 year and edulevel
122 Human resource managers 1.9316303 0.7634885 year and edulevel
833 Heavy truck and bus drivers 1.2362398 0.6907621 year and edulevel
136 Production managers in construction and mining 3.2044445 0.6886988 year and edulevel
813 Machine operators, chemical and pharmaceutical products 1.6181230 0.6737919 year and edulevel
513 Waiters and bartenders 1.8661549 0.6546343 year and edulevel
711 Carpenters, bricklayers and construction workers 1.1969785 0.6416119 year and edulevel
532 Personal care workers in health services 2.8020249 0.6328864 year and edulevel
834 Mobile plant operators 2.4022634 0.6302037 year and edulevel
819 Process control technicians 1.7061994 0.6114937 year and edulevel
159 Other social services managers 3.2304608 0.5909851 year and edulevel
432 Stores and transport clerks 1.8449906 0.5743293 year and edulevel
533 Health care assistants 2.1616545 0.5736881 year and edulevel
321 Medical and pharmaceutical technicians 2.5297791 0.5488535 year and edulevel
911 Cleaners and helpers 2.2245045 0.5336872 year and edulevel
331 Financial and accounting associate professionals 1.2100081 0.5288551 year and edulevel
817 Wood processing and papermaking plant operators 3.5093276 0.5181038 year and edulevel
216 Architects and surveyors 1.9919142 0.4832745 year and edulevel
722 Blacksmiths, toolmakers and related trades workers 1.7270402 0.4520330 year and edulevel
351 ICT operations and user support technicians 2.1384843 0.4518060 year and edulevel
523 Cashiers and related clerks 0.8593031 0.4308086 year and edulevel
831 Train operators and related workers 1.9370280 0.4298998 year and edulevel
312 Construction and manufacturing supervisors 2.7306910 0.4009186 year and edulevel
941 Fast-food workers, food preparation assistants 1.6227045 0.3683117 year and edulevel
441 Library and filing clerks 1.5960181 0.3611492 year and edulevel
213 Biologists, pharmacologists and specialists in agriculture and forestry 0.7902735 0.3333037 year and edulevel
179 Other services managers not elsewhere classified 2.4531669 0.2396802 year and edulevel
422 Client information clerks 2.0649425 0.1625848 year and edulevel
132 Supply, logistics and transport managers 1.1893479 0.1619384 year and edulevel
341 Social work and religious associate professionals 2.4925171 0.1313061 year and edulevel
962 Newspaper distributors, janitors and other service workers 1.3746098 0.0752161 year and edulevel
231 University and higher education teachers 2.1855704 0.0653639 year and edulevel
815 Machine operators, textile, fur and leather products 1.3138483 0.0462972 year and edulevel
814 Machine operators, rubber, plastic and paper products 2.5812272 0.0446220 year and edulevel
merge(summary_table, anova_table, c("ssyk", "interaction"), all = TRUE) %>%
  filter (term.x == "year_n") %>%
  filter (contcol.y > 1) %>%   
  filter (interaction == "sex, year and edulevel") %>%
  filter (!(contcol.y == 1 & interaction == "sex, year and edulevel")) %>% 
  mutate (estimate = (exp(estimate) - 1) * 100) %>%  
  select (ssyk, estimate, statistic.y, interaction) %>%
  rename (`F-value for age` = statistic.y) %>%
  rename (`Increase in salary` = estimate) %>%
  arrange (desc (`F-value for age`)) %>%
  knitr::kable(
    booktabs = TRUE,
    caption = 'Correlation for F-value (sex, year and edulevel) and the yearly increase in salaries')
Table 8: Correlation for F-value (sex, year and edulevel) and the yearly increase in salaries
ssyk Increase in salary F-value for age interaction
311 Physical and engineering science technicians 0.3007069 7.6368150 sex, year and edulevel
261 Legal professionals 1.9749741 7.2332096 sex, year and edulevel
334 Administrative and specialized secretaries 1.6645488 4.9962163 sex, year and edulevel
151 Health care managers 2.0072983 4.6943513 sex, year and edulevel
232 Vocational education teachers 2.7387801 4.1907918 sex, year and edulevel
264 Authors, journalists and linguists 2.0863140 4.0644218 sex, year and edulevel
711 Carpenters, bricklayers and construction workers 1.1969785 4.0519757 sex, year and edulevel
121 Finance managers 2.0641822 3.6513567 sex, year and edulevel
122 Human resource managers 1.0779576 3.5481108 sex, year and edulevel
137 Production managers in manufacturing -0.0152177 3.3778729 sex, year and edulevel
523 Cashiers and related clerks 1.0766683 3.1321131 sex, year and edulevel
159 Other social services managers 2.0475832 2.6301550 sex, year and edulevel
234 Primary- and pre-school teachers 3.4992304 2.5722281 sex, year and edulevel
818 Other stationary plant and machine operators 1.1073347 2.5439043 sex, year and edulevel
342 Athletes, fitness instructors and recreational workers 2.7582176 2.4744045 sex, year and edulevel
531 Child care workers and teachers aides 1.4341298 2.4314811 sex, year and edulevel
522 Shop staff -0.5891626 1.9849918 sex, year and edulevel
331 Financial and accounting associate professionals 0.4425476 1.9602026 sex, year and edulevel
332 Insurance advisers, sales and purchasing agents 2.2947388 1.9422377 sex, year and edulevel
533 Health care assistants 1.6253210 1.9216616 sex, year and edulevel
343 Photographers, interior decorators and entertainers 1.0634866 1.7202512 sex, year and edulevel
235 Teaching professionals not elsewhere classified 3.0233562 1.4927454 sex, year and edulevel
233 Secondary education teachers 3.0407628 1.4358037 sex, year and edulevel
813 Machine operators, chemical and pharmaceutical products 1.6181230 1.3871806 sex, year and edulevel
217 Designers 3.6821293 1.2946162 sex, year and edulevel
534 Attendants, personal assistants and related workers 0.3597122 1.2943980 sex, year and edulevel
541 Other surveillance and security workers 3.1102372 1.2828090 sex, year and edulevel
125 Sales and marketing managers 0.7835022 1.2779771 sex, year and edulevel
129 Administration and service managers not elsewhere classified 4.9504748 1.2735961 sex, year and edulevel
819 Process control technicians 2.4986543 1.2299209 sex, year and edulevel
911 Cleaners and helpers 2.8014931 1.2021688 sex, year and edulevel
341 Social work and religious associate professionals 2.5010265 1.1808832 sex, year and edulevel
723 Machinery mechanics and fitters 3.1964544 1.1493456 sex, year and edulevel
611 Market gardeners and crop growers 0.1434970 1.1324088 sex, year and edulevel
243 Marketing and public relations professionals -4.1275797 1.1078823 sex, year and edulevel
351 ICT operations and user support technicians 2.6270604 1.0821259 sex, year and edulevel
821 Assemblers 3.5727179 0.9895740 sex, year and edulevel
524 Event seller and telemarketers 0.1957456 0.9768868 sex, year and edulevel
335 Tax and related government associate professionals 1.6651038 0.9445517 sex, year and edulevel
242 Organisation analysts, policy administrators and human resource specialists 1.7377916 0.9296940 sex, year and edulevel
831 Train operators and related workers 1.9370280 0.9170162 sex, year and edulevel
515 Building caretakers and related workers 4.2685600 0.9019820 sex, year and edulevel
422 Client information clerks 2.6186600 0.8683975 sex, year and edulevel
512 Cooks and cold-buffet managers 1.9342162 0.8474145 sex, year and edulevel
123 Administration and planning managers 1.6423465 0.8377722 sex, year and edulevel
312 Construction and manufacturing supervisors 3.6769309 0.7940555 sex, year and edulevel
241 Accountants, financial analysts and fund managers 1.4634289 0.7813243 sex, year and edulevel
812 Metal processing and finishing plant operators -4.9761347 0.7523221 sex, year and edulevel
516 Other service related workers 7.0743258 0.7425455 sex, year and edulevel
432 Stores and transport clerks 1.6337081 0.7279130 sex, year and edulevel
221 Medical doctors 2.5016353 0.6902677 sex, year and edulevel
134 Architectural and engineering managers 1.2211597 0.6693583 sex, year and edulevel
333 Business services agents 1.0012648 0.6482391 sex, year and edulevel
441 Library and filing clerks 0.8265796 0.6267038 sex, year and edulevel
962 Newspaper distributors, janitors and other service workers 1.6061203 0.5933810 sex, year and edulevel
941 Fast-food workers, food preparation assistants 0.6914853 0.5829709 sex, year and edulevel
321 Medical and pharmaceutical technicians 2.4540505 0.5434559 sex, year and edulevel
352 Broadcasting and audio-visual technicians 1.9435613 0.5379284 sex, year and edulevel
161 Financial and insurance managers 4.9347200 0.5294277 sex, year and edulevel
511 Cabin crew, guides and related workers 3.0644405 0.5132864 sex, year and edulevel
932 Manufacturing labourers 2.0273905 0.5026755 sex, year and edulevel
179 Other services managers not elsewhere classified 2.2046970 0.4872775 sex, year and edulevel
532 Personal care workers in health services 2.6931703 0.4842910 sex, year and edulevel
173 Retail and wholesale trade managers 10.5993797 0.4694386 sex, year and edulevel
133 Research and development managers 1.3071833 0.4418744 sex, year and edulevel
231 University and higher education teachers 2.0503501 0.3707303 sex, year and edulevel
834 Mobile plant operators 2.4022634 0.3545803 sex, year and edulevel
265 Creative and performing artists 1.1809261 0.3382118 sex, year and edulevel
266 Social work and counselling professionals 3.1792487 0.3328237 sex, year and edulevel
251 ICT architects, systems analysts and test managers 3.9660691 0.3290868 sex, year and edulevel
815 Machine operators, textile, fur and leather products 0.5896274 0.3224206 sex, year and edulevel
131 Information and communications technology service managers -0.0347601 0.3179017 sex, year and edulevel
732 Printing trades workers 1.4035774 0.2933972 sex, year and edulevel
132 Supply, logistics and transport managers 1.9589258 0.2574186 sex, year and edulevel
411 Office assistants and other secretaries 4.8892850 0.2517369 sex, year and edulevel
833 Heavy truck and bus drivers 1.6848227 0.2443507 sex, year and edulevel
722 Blacksmiths, toolmakers and related trades workers 2.1732826 0.2354179 sex, year and edulevel
816 Machine operators, food and related products 0.8583028 0.1593265 sex, year and edulevel
214 Engineering professionals 1.9785162 0.1445402 sex, year and edulevel
262 Museum curators and librarians and related professionals 1.4727922 0.1389862 sex, year and edulevel
136 Production managers in construction and mining 3.9874104 0.1239311 sex, year and edulevel
817 Wood processing and papermaking plant operators 3.5093276 0.0936398 sex, year and edulevel
513 Waiters and bartenders 2.5267044 0.0838668 sex, year and edulevel
814 Machine operators, rubber, plastic and paper products 2.5812272 0.0552916 sex, year and edulevel
218 Specialists within environmental and health protection 2.7640467 0.0345293 sex, year and edulevel
213 Biologists, pharmacologists and specialists in agriculture and forestry 0.7145156 0.0285926 sex, year and edulevel
961 Recycling collectors 0.5439750 0.0142411 sex, year and edulevel
216 Architects and surveyors 1.9398000 0.0071724 sex, year and edulevel
temp <- tbnum %>%
  filter(`occuptional  (SSYK 2012)` == "231 University and higher education teachers") 
 
model <-lm (log(salary) ~ year_n + sex * eduyears, data = temp)
 
plot_model(model, type = "pred", terms = c("eduyears", "sex"))
## Model has log-transformed response. Back-transforming predictions to original response scale. Standard errors are still on the log-scale.

Highest F-value interaction sex and education level, University and higher education teachers

Figure 11: Highest F-value interaction sex and education level, University and higher education teachers

temp <- tbnum %>%
  filter(`occuptional  (SSYK 2012)` == "814 Machine operators, rubber, plastic and paper products") 
 
model <-lm (log(salary) ~ year_n + sex * eduyears, data = temp)
 
plot_model(model, type = "pred", terms = c("eduyears", "sex"))
## Warning in predict.lm(model, newdata = fitfram, type = "response", se.fit =
## se, : prediction from a rank-deficient fit may be misleading
## Model has log-transformed response. Back-transforming predictions to original response scale. Standard errors are still on the log-scale.

Lowest F-value interaction sex and education level, Machine operators, rubber, plastic and paper products

Figure 12: Lowest F-value interaction sex and education level, Machine operators, rubber, plastic and paper products

temp <- tbnum %>%
  filter(`occuptional  (SSYK 2012)` == "534 Attendants, personal assistants and related workers") 
 
model <-lm (log(salary) ~ sex + year_n * eduyears, data = temp)
 
plot_model(model, type = "pred", terms = c("year_n", "eduyears"))
## Model has log-transformed response. Back-transforming predictions to original response scale. Standard errors are still on the log-scale.

Highest F-value interaction year and education level, Attendants, personal assistants and related workers

Figure 13: Highest F-value interaction year and education level, Attendants, personal assistants and related workers

temp <- tbnum %>%
  filter(`occuptional  (SSYK 2012)` == "814 Machine operators, rubber, plastic and paper products") 
 
model <-lm (log(salary) ~ sex + year_n * eduyears, data = temp)
 
plot_model(model, type = "pred", terms = c("year_n", "eduyears"))
## Model has log-transformed response. Back-transforming predictions to original response scale. Standard errors are still on the log-scale.

Lowest F-value interaction year and education level, Machine operators, rubber, plastic and paper products

Figure 14: Lowest F-value interaction year and education level, Machine operators, rubber, plastic and paper products

temp <- tbnum %>%
  filter(`occuptional  (SSYK 2012)` == "262 Museum curators and librarians and related professionals") 
 
model <-lm (log(salary) ~ sex * year_n + edulevel, data = temp)
 
plot_model(model, type = "pred", terms = c("year_n", "sex"))
## Model has log-transformed response. Back-transforming predictions to original response scale. Standard errors are still on the log-scale.

Highest F-value interaction sex and year, Museum curators and librarians and related professionals

Figure 15: Highest F-value interaction sex and year, Museum curators and librarians and related professionals

temp <- tbnum %>%
  filter(`occuptional  (SSYK 2012)` == "961 Recycling collectors") 
 
model <-lm (log(salary) ~ sex * year_n + edulevel, data = temp)
 
plot_model(model, type = "pred", terms = c("year_n", "sex"))
## Model has log-transformed response. Back-transforming predictions to original response scale. Standard errors are still on the log-scale.

Lowest F-value interaction sex and year, Recycling collectors

Figure 16: Lowest F-value interaction sex and year, Recycling collectors

temp <- tbnum %>%
  filter(`occuptional  (SSYK 2012)` == "311 Physical and engineering science technicians") 
 
model <-lm (log(salary) ~ sex * year_n * eduyears, data = temp)
 
plot_model(model, type = "pred", terms = c("year_n", "eduyears", "sex"))    
## Model has log-transformed response. Back-transforming predictions to original response scale. Standard errors are still on the log-scale.

Highest F-value interaction sex, year and education level, Physical and engineering science technicians

Figure 17: Highest F-value interaction sex, year and education level, Physical and engineering science technicians

temp <- tbnum %>%
  filter(`occuptional  (SSYK 2012)` == "216 Architects and surveyors") 
 
model <-lm (log(salary) ~ sex * year_n * eduyears, data = temp)
 
plot_model(model, type = "pred", terms = c("year_n", "eduyears", "sex"))    
## Warning in predict.lm(model, newdata = fitfram, type = "response", se.fit =
## se, : prediction from a rank-deficient fit may be misleading
## Model has log-transformed response. Back-transforming predictions to original response scale. Standard errors are still on the log-scale.

Lowest F-value interaction sex, year and education level, Architects and surveyors

Figure 18: Lowest F-value interaction sex, year and education level, Architects and surveyors

To leave a comment for the author, please follow the link and comment on their blog: R Analystatistics Sweden .

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)