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
ssykIncrease in salaryF-value for ageinteraction
335 Tax and related government associate professionals2.2959882159.4793522sex and age
331 Financial and accounting associate professionals2.276622742.0381959sex and age
241 Accountants, financial analysts and fund managers2.743154420.6684827sex and age
531 Child care workers and teachers aides2.142196820.6043679sex and age
242 Organisation analysts, policy administrators and human resource specialists2.264055320.5912541sex and age
234 Primary- and pre-school teachers3.516028818.7575727sex and age
713 Painters, Lacquerers, Chimney-sweepers and related trades workers3.199488117.5772847sex and age
911 Cleaners and helpers1.771488516.3428281sex and age
227 Naprapaths, physiotherapists, occupational therapists2.168585215.4642863sex and age
151 Health care managers2.560952414.4293656sex and age
231 University and higher education teachers2.581011513.7386699sex and age
533 Health care assistants2.079451213.0025749sex and age
541 Other surveillance and security workers2.423274012.9292988sex and age
267 Religious professionals and deacons3.186356312.7247444sex and age
321 Medical and pharmaceutical technicians2.928994312.1381897sex and age
522 Shop staff2.711931812.0951539sex and age
213 Biologists, pharmacologists and specialists in agriculture and forestry1.45902799.6061073sex and age
821 Assemblers2.83652959.2734220sex and age
422 Client information clerks1.77432978.7718831sex and age
262 Museum curators and librarians and related professionals2.32030658.5847669sex and age
159 Other social services managers2.54399917.8781716sex and age
123 Administration and planning managers4.32752437.3452011sex and age
161 Financial and insurance managers3.49532967.2879455sex and age
818 Other stationary plant and machine operators2.40629977.1387013sex and age
333 Business services agents2.74890456.9293991sex and age
722 Blacksmiths, toolmakers and related trades workers1.93536346.8656109sex and age
511 Cabin crew, guides and related workers0.69979646.7913009sex and age
261 Legal professionals3.08212526.6602603sex and age
311 Physical and engineering science technicians2.17771286.2915291sex and age
816 Machine operators, food and related products2.00693835.6187226sex and age
814 Machine operators, rubber, plastic and paper products2.48308045.3245175sex and age
336 Police officers2.92171345.3169761sex and age
812 Metal processing and finishing plant operators1.76804265.1597022sex and age
351 ICT operations and user support technicians2.13457454.8748330sex and age
411 Office assistants and other secretaries2.53567544.7575794sex and age
741 Electrical equipment installers and repairers2.47462264.7218323sex and age
342 Athletes, fitness instructors and recreational workers1.64157414.6480979sex and age
819 Process control technicians2.35556144.6407029sex and age
214 Engineering professionals1.92997244.5859413sex and age
228 Specialists in health care not elsewhere classified2.73521424.5394356sex and age
962 Newspaper distributors, janitors and other service workers1.42970594.5028895sex and age
312 Construction and manufacturing supervisors3.58084224.3879763sex and age
232 Vocational education teachers3.02450504.0584628sex and age
212 Mathematicians, actuaries and statisticians2.43695303.9838403sex and age
211 Physicists and chemists2.09434913.9727058sex and age
334 Administrative and specialized secretaries2.97027463.6129743sex and age
222 Nursing professionals4.25117173.5676086sex and age
121 Finance managers3.27045473.3530172sex and age
243 Marketing and public relations professionals1.48900953.2225018sex and age
932 Manufacturing labourers2.69914813.1523625sex and age
817 Wood processing and papermaking plant operators2.93418923.1259551sex and age
532 Personal care workers in health services2.89447533.0544887sex and age
217 Designers2.55265153.0235916sex and age
136 Production managers in construction and mining2.74066492.5807238sex and age
732 Printing trades workers1.93553612.3243296sex and age
534 Attendants, personal assistants and related workers1.93662352.2843662sex and age
441 Library and filing clerks2.12679032.2496759sex and age
235 Teaching professionals not elsewhere classified2.48933022.1506250sex and age
131 Information and communications technology service managers4.08481342.1380093sex and age
834 Mobile plant operators2.53744072.0839971sex and age
611 Market gardeners and crop growers0.79051442.0157799sex and age
223 Nursing professionals (cont.)3.08621291.9488266sex and age
512 Cooks and cold-buffet managers2.82465211.9384343sex and age
352 Broadcasting and audio-visual technicians0.64309971.9263743sex and age
264 Authors, journalists and linguists1.60033301.8718057sex and age
221 Medical doctors1.44646711.8334236sex and age
133 Research and development managers1.38681021.8214105sex and age
432 Stores and transport clerks2.20088611.7861746sex and age
523 Cashiers and related clerks0.43383371.7438312sex and age
132 Supply, logistics and transport managers1.25835581.7194546sex and age
216 Architects and surveyors2.44631031.6944331sex and age
137 Production managers in manufacturing2.51392521.6853597sex and age
813 Machine operators, chemical and pharmaceutical products2.57817711.6607729sex and age
332 Insurance advisers, sales and purchasing agents1.77694521.6356527sex and age
515 Building caretakers and related workers2.00612171.5892818sex and age
266 Social work and counselling professionals3.20752761.5751088sex and age
815 Machine operators, textile, fur and leather products1.29199851.5542036sex and age
251 ICT architects, systems analysts and test managers2.52741011.4087670sex and age
125 Sales and marketing managers1.90208921.3550073sex and age
134 Architectural and engineering managers2.45401181.2227887sex and age
961 Recycling collectors2.26325931.1906325sex and age
723 Machinery mechanics and fitters2.06633081.1041179sex and age
344 Driving instructors and other instructors2.87745501.0799384sex and age
833 Heavy truck and bus drivers1.90177451.0503103sex and age
122 Human resource managers3.61232610.9673152sex and age
226 Dentists2.26107440.9612771sex and age
224 Psychologists and psychotherapists2.74351220.9185294sex and age
711 Carpenters, bricklayers and construction workers1.82487150.9020636sex and age
761 Butchers, bakers and food processors1.63075380.8629405sex and age
141 Primary and secondary schools and adult education managers3.57385990.8021870sex and age
831 Train operators and related workers1.79287260.7956301sex and age
179 Other services managers not elsewhere classified2.76193040.7557586sex and age
218 Specialists within environmental and health protection2.61469400.7229000sex and age
516 Other service related workers2.11563930.7101924sex and age
524 Event seller and telemarketers2.05454660.5044158sex and age
752 Wood treaters, cabinet-makers and related trades workers2.68087500.4777104sex and age
265 Creative and performing artists2.56144820.4592989sex and age
912 Washers, window cleaners and other cleaning workers2.56421000.3968101sex and age
153 Elderly care managers3.36571670.3924072sex and age
343 Photographers, interior decorators and entertainers3.44337850.3697008sex and age
513 Waiters and bartenders2.17118000.2718709sex and age
129 Administration and service managers not elsewhere classified2.20861750.2151892sex and age
941 Fast-food workers, food preparation assistants2.01582490.2048116sex and age
233 Secondary education teachers2.98955900.1966141sex and age
152 Managers in social and curative care3.93690390.1858560sex and age
341 Social work and religious associate professionals2.59170330.1642278sex 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
ssykIncrease in salaryF-value for ageinteraction
131 Information and communications technology service managers2.309691318.9885627sex and year
741 Electrical equipment installers and repairers2.895409015.1782057sex and year
813 Machine operators, chemical and pharmaceutical products1.907796311.5897622sex and year
151 Health care managers0.004551910.7526199sex and year
211 Physicists and chemists1.39151237.4977359sex and year
221 Medical doctors0.65387737.3600653sex and year
816 Machine operators, food and related products1.57172314.9339943sex and year
235 Teaching professionals not elsewhere classified2.03103464.5698800sex and year
524 Event seller and telemarketers3.50812684.4316751sex and year
711 Carpenters, bricklayers and construction workers2.22545974.4174399sex and year
932 Manufacturing labourers2.12909544.1545847sex and year
262 Museum curators and librarians and related professionals1.78992104.1395912sex and year
227 Naprapaths, physiotherapists, occupational therapists1.29228533.7328350sex and year
441 Library and filing clerks1.66219433.1588539sex and year
732 Printing trades workers1.49140842.9105428sex and year
611 Market gardeners and crop growers1.38214742.7246518sex and year
266 Social work and counselling professionals2.94507992.6820347sex and year
123 Administration and planning managers5.23251292.4711124sex and year
422 Client information clerks1.35451442.2011024sex and year
261 Legal professionals2.28650932.1206991sex and year
214 Engineering professionals1.57428272.0990600sex and year
815 Machine operators, textile, fur and leather products1.00468152.0981886sex and year
267 Religious professionals and deacons4.25990771.9296670sex and year
218 Specialists within environmental and health protection2.29238931.9224272sex and year
122 Human resource managers4.85860011.7650927sex and year
251 ICT architects, systems analysts and test managers2.11366581.7424405sex and year
534 Attendants, personal assistants and related workers1.82448191.7041840sex and year
232 Vocational education teachers2.76714471.4897367sex and year
134 Architectural and engineering managers2.07040511.3888211sex and year
333 Business services agents3.09550321.3284140sex and year
834 Mobile plant operators2.87422661.2866972sex and year
814 Machine operators, rubber, plastic and paper products2.29174991.2780326sex and year
121 Finance managers2.50638991.2719390sex and year
511 Cabin crew, guides and related workers1.25490991.2614665sex and year
137 Production managers in manufacturing2.31529281.2488175sex and year
819 Process control technicians2.57921561.2321895sex and year
752 Wood treaters, cabinet-makers and related trades workers2.36168771.2158818sex and year
311 Physical and engineering science technicians2.58307141.1623245sex and year
264 Authors, journalists and linguists1.15293061.1155040sex and year
343 Photographers, interior decorators and entertainers4.19855421.1106546sex and year
243 Marketing and public relations professionals0.98155321.0732378sex and year
541 Other surveillance and security workers2.57619731.0256130sex and year
336 Police officers3.14127151.0138419sex and year
216 Architects and surveyors2.94719430.9876359sex and year
233 Secondary education teachers2.77342580.9441665sex and year
351 ICT operations and user support technicians1.90385400.7819692sex and year
132 Supply, logistics and transport managers1.90992550.7677975sex and year
342 Athletes, fitness instructors and recreational workers1.90682830.7090386sex and year
912 Washers, window cleaners and other cleaning workers2.80873420.7016091sex and year
321 Medical and pharmaceutical technicians3.15977380.6977518sex and year
962 Newspaper distributors, janitors and other service workers1.18873970.6955963sex and year
818 Other stationary plant and machine operators2.68777770.6820875sex and year
432 Stores and transport clerks2.38174260.6776753sex and year
411 Office assistants and other secretaries2.26277800.6775943sex and year
341 Social work and religious associate professionals2.72586870.6031036sex and year
153 Elderly care managers3.16603450.5974951sex and year
129 Administration and service managers not elsewhere classified2.57869630.4952633sex and year
723 Machinery mechanics and fitters2.22811190.4619171sex and year
265 Creative and performing artists2.81678220.4064823sex and year
161 Financial and insurance managers4.52711090.3869820sex and year
513 Waiters and bartenders2.43440830.3385613sex and year
761 Butchers, bakers and food processors1.54834580.3298306sex and year
179 Other services managers not elsewhere classified3.02931210.3105108sex and year
831 Train operators and related workers1.68242700.3089261sex and year
133 Research and development managers1.18724380.2947620sex and year
961 Recycling collectors2.19401000.2898964sex and year
213 Biologists, pharmacologists and specialists in agriculture and forestry1.67574430.2654079sex and year
722 Blacksmiths, toolmakers and related trades workers1.78776960.2513383sex and year
224 Psychologists and psychotherapists2.50480410.2303968sex and year
231 University and higher education teachers2.42113670.2112476sex and year
817 Wood processing and papermaking plant operators2.82572980.2058922sex and year
212 Mathematicians, actuaries and statisticians2.15807850.1932679sex and year
331 Financial and accounting associate professionals1.89223880.1893544sex and year
335 Tax and related government associate professionals2.14483030.1877449sex and year
136 Production managers in construction and mining2.98326560.1877118sex and year
941 Fast-food workers, food preparation assistants2.14050630.1755668sex and year
234 Primary- and pre-school teachers3.45597680.1540937sex and year
222 Nursing professionals4.32184110.1292660sex and year
241 Accountants, financial analysts and fund managers2.90510160.1277434sex and year
533 Health care assistants2.03759100.1236315sex and year
312 Construction and manufacturing supervisors3.49527510.1144032sex and year
332 Insurance advisers, sales and purchasing agents1.69550170.0981232sex and year
217 Designers2.38690240.0963789sex and year
159 Other social services managers2.60647590.0820633sex and year
352 Broadcasting and audio-visual technicians0.76409210.0744931sex and year
532 Personal care workers in health services2.91478950.0673681sex and year
334 Administrative and specialized secretaries2.84149940.0628304sex and year
821 Assemblers2.79125790.0461133sex and year
523 Cashiers and related clerks0.24142490.0391983sex and year
516 Other service related workers2.19496950.0374522sex and year
242 Organisation analysts, policy administrators and human resource specialists2.31805870.0370499sex and year
515 Building caretakers and related workers1.89615790.0213149sex and year
911 Cleaners and helpers1.68939620.0203530sex and year
512 Cooks and cold-buffet managers2.77633700.0188044sex and year
223 Nursing professionals (cont.)3.10579710.0161602sex and year
226 Dentists2.22467980.0121797sex and year
833 Heavy truck and bus drivers1.88789190.0062890sex and year
141 Primary and secondary schools and adult education managers3.60113270.0059097sex and year
812 Metal processing and finishing plant operators1.76368610.0046745sex and year
228 Specialists in health care not elsewhere classified2.84402460.0042559sex and year
344 Driving instructors and other instructors2.85259290.0037639sex and year
152 Managers in social and curative care3.91521060.0030755sex and year
522 Shop staff2.57569100.0016560sex and year
531 Child care workers and teachers aides2.18096140.0010117sex and year
713 Painters, Lacquerers, Chimney-sweepers and related trades workers2.83255690.0006941sex and year
125 Sales and marketing managers1.90060170.0000073sex 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
ssykIncrease in salaryF-value for ageinteraction
515 Building caretakers and related workers1.955911615.9023802year and age
821 Assemblers2.88798339.2570096year and age
223 Nursing professionals (cont.)3.08621297.5229917year and age
812 Metal processing and finishing plant operators1.76810825.9064137year and age
912 Washers, window cleaners and other cleaning workers2.56421005.6899347year and age
516 Other service related workers2.11522465.2080039year and age
264 Authors, journalists and linguists1.60033304.9115575year and age
235 Teaching professionals not elsewhere classified2.48933024.7634036year and age
251 ICT architects, systems analysts and test managers2.52741014.4833008year and age
532 Personal care workers in health services2.89447534.3339760year and age
441 Library and filing clerks2.12679034.2334206year and age
333 Business services agents2.35880544.1952156year and age
332 Insurance advisers, sales and purchasing agents1.77694524.1089082year and age
132 Supply, logistics and transport managers1.65025663.9217350year and age
833 Heavy truck and bus drivers1.90177453.6601456year and age
932 Manufacturing labourers2.69914813.6464745year and age
432 Stores and transport clerks2.20088613.5354072year and age
222 Nursing professionals4.23084213.4741301year and age
818 Other stationary plant and machine operators2.40629973.4540268year and age
161 Financial and insurance managers4.03644933.3856627year and age
233 Secondary education teachers2.98955903.1794015year and age
234 Primary- and pre-school teachers3.51602883.1553505year and age
228 Specialists in health care not elsewhere classified2.88754133.1501241year and age
152 Managers in social and curative care3.92352012.8784925year and age
137 Production managers in manufacturing2.69541722.6701651year and age
352 Broadcasting and audio-visual technicians0.62167042.5914276year and age
334 Administrative and specialized secretaries2.84451432.5139090year and age
815 Machine operators, textile, fur and leather products1.29199852.4449179year and age
941 Fast-food workers, food preparation assistants2.01582492.4202939year and age
266 Social work and counselling professionals3.21701572.4011601year and age
216 Architects and surveyors2.61700692.3614098year and age
343 Photographers, interior decorators and entertainers3.46450372.2302218year and age
533 Health care assistants2.07945122.1161718year and age
961 Recycling collectors2.25002791.9762282year and age
211 Physicists and chemists2.09434911.9599317year and age
342 Athletes, fitness instructors and recreational workers1.64157411.7856668year and age
761 Butchers, bakers and food processors1.65614571.6846191year and age
214 Engineering professionals1.94963711.6729919year and age
153 Elderly care managers3.35647671.6605420year and age
411 Office assistants and other secretaries2.53567541.6094669year and age
534 Attendants, personal assistants and related workers1.93662351.5775466year and age
336 Police officers2.89679891.5454215year and age
541 Other surveillance and security workers2.42327401.5351778year and age
232 Vocational education teachers3.06213551.5199772year and age
513 Waiters and bartenders2.17118001.3797110year and age
212 Mathematicians, actuaries and statisticians2.30252151.3794017year and age
531 Child care workers and teachers aides2.19779551.3438941year and age
134 Architectural and engineering managers2.44218721.3309754year and age
732 Printing trades workers1.94680281.2928325year and age
344 Driving instructors and other instructors3.08801081.2771979year and age
831 Train operators and related workers1.73902091.2652502year and age
351 ICT operations and user support technicians2.13457451.2472259year and age
713 Painters, Lacquerers, Chimney-sweepers and related trades workers2.79214421.2381889year and age
261 Legal professionals3.07546241.2256187year and age
159 Other social services managers2.54399911.2079146year and age
136 Production managers in construction and mining2.65652461.1618915year and age
611 Market gardeners and crop growers0.80917231.1274767year and age
813 Machine operators, chemical and pharmaceutical products2.56866761.1016766year and age
722 Blacksmiths, toolmakers and related trades workers1.94849971.0809628year and age
241 Accountants, financial analysts and fund managers2.74315441.0545884year and age
133 Research and development managers1.38808601.0327136year and age
711 Carpenters, bricklayers and construction workers1.72843010.9998010year and age
819 Process control technicians2.35556140.9854613year and age
814 Machine operators, rubber, plastic and paper products2.48308040.9597551year and age
179 Other services managers not elsewhere classified2.76193040.9365528year and age
524 Event seller and telemarketers2.05454660.9061984year and age
752 Wood treaters, cabinet-makers and related trades workers2.74142130.8802318year and age
817 Wood processing and papermaking plant operators2.93418920.8608835year and age
331 Financial and accounting associate professionals2.16842260.8564160year and age
962 Newspaper distributors, janitors and other service workers1.42970590.8546703year and age
341 Social work and religious associate professionals2.59008300.8191473year and age
217 Designers2.55265150.7984661year and age
741 Electrical equipment installers and repairers2.25662850.7858381year and age
311 Physical and engineering science technicians2.12980640.7798156year and age
511 Cabin crew, guides and related workers0.69979640.7635704year and age
123 Administration and planning managers4.32752430.7609043year and age
512 Cooks and cold-buffet managers2.82465210.6943099year and age
265 Creative and performing artists2.54852140.6640336year and age
312 Construction and manufacturing supervisors3.60012390.6252099year and age
221 Medical doctors1.45429550.6061171year and age
131 Information and communications technology service managers4.29672130.6059112year and age
243 Marketing and public relations professionals1.44355920.5717083year and age
122 Human resource managers3.85499560.5660338year and age
321 Medical and pharmaceutical technicians2.89742590.5491370year and age
151 Health care managers2.23912070.5385478year and age
226 Dentists2.26609040.5172035year and age
218 Specialists within environmental and health protection2.61469400.4971584year and age
816 Machine operators, food and related products2.00693830.4950654year and age
224 Psychologists and psychotherapists2.74351220.4914927year and age
121 Finance managers3.24077110.4712382year and age
227 Naprapaths, physiotherapists, occupational therapists2.17117680.4559658year and age
523 Cashiers and related clerks0.42888430.4465303year and age
422 Client information clerks1.77432970.4222086year and age
911 Cleaners and helpers1.71491580.4213080year and age
834 Mobile plant operators2.54881970.3653360year and age
522 Shop staff2.59156250.3222133year and age
125 Sales and marketing managers1.97458920.3192256year and age
242 Organisation analysts, policy administrators and human resource specialists2.26405530.2791956year and age
262 Museum curators and librarians and related professionals2.35437640.2615687year and age
141 Primary and secondary schools and adult education managers3.61233680.2597121year and age
231 University and higher education teachers2.58101150.2269531year and age
723 Machinery mechanics and fitters2.07282610.2269456year and age
335 Tax and related government associate professionals2.29598820.2050003year and age
213 Biologists, pharmacologists and specialists in agriculture and forestry1.45902790.1806503year and age
267 Religious professionals and deacons3.16550460.1747193year and age
129 Administration and service managers not elsewhere classified2.17621420.0684575year 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
ssykIncrease in salaryF-value for ageinteraction
161 Financial and insurance managers6.701438312.8607103sex, year and age
212 Mathematicians, actuaries and statisticians1.991136610.4095062sex, year and age
267 Religious professionals and deacons4.16581188.7837115sex, year and age
227 Naprapaths, physiotherapists, occupational therapists2.43037268.1151159sex, year and age
152 Managers in social and curative care2.52138776.6049915sex, year and age
713 Painters, Lacquerers, Chimney-sweepers and related trades workers2.97309026.1709248sex, year and age
343 Photographers, interior decorators and entertainers0.50607346.1295901sex, year and age
151 Health care managers-1.26491945.9426940sex, year and age
261 Legal professionals2.31254635.5530411sex, year and age
216 Architects and surveyors3.16043584.3669656sex, year and age
341 Social work and religious associate professionals2.57273754.1594012sex, year and age
441 Library and filing clerks1.32040153.5932816sex, year and age
833 Heavy truck and bus drivers1.89613983.4082814sex, year and age
432 Stores and transport clerks2.16490363.3329059sex, year and age
344 Driving instructors and other instructors2.48487183.3062803sex, year and age
342 Athletes, fitness instructors and recreational workers1.90682833.2624869sex, year and age
741 Electrical equipment installers and repairers2.86642323.1590750sex, year and age
235 Teaching professionals not elsewhere classified2.03103463.1408651sex, year and age
228 Specialists in health care not elsewhere classified3.37366092.9090416sex, year and age
711 Carpenters, bricklayers and construction workers2.16272372.7534146sex, year and age
961 Recycling collectors2.15669122.7467393sex, year and age
911 Cleaners and helpers1.72634762.4634242sex, year and age
262 Museum curators and librarians and related professionals2.30158652.3970735sex, year and age
222 Nursing professionals4.24070322.3527290sex, year and age
213 Biologists, pharmacologists and specialists in agriculture and forestry1.67574432.3028311sex, year and age
334 Administrative and specialized secretaries2.79562882.2055190sex, year and age
513 Waiters and bartenders0.87497922.1159294sex, year and age
523 Cashiers and related clerks2.84594482.0567141sex, year and age
534 Attendants, personal assistants and related workers1.82448191.9933909sex, year and age
816 Machine operators, food and related products1.57172311.9024147sex, year and age
817 Wood processing and papermaking plant operators2.82572981.8237211sex, year and age
242 Organisation analysts, policy administrators and human resource specialists2.31805871.7886047sex, year and age
332 Insurance advisers, sales and purchasing agents1.78594081.7585242sex, year and age
515 Building caretakers and related workers2.05566721.7184190sex, year and age
132 Supply, logistics and transport managers2.24750881.6580301sex, year and age
241 Accountants, financial analysts and fund managers2.90510161.3893091sex, year and age
211 Physicists and chemists1.39151231.3625703sex, year and age
218 Specialists within environmental and health protection2.29238931.3335963sex, year and age
732 Printing trades workers1.45203631.3253827sex, year and age
818 Other stationary plant and machine operators2.68777771.3237424sex, year and age
232 Vocational education teachers2.79502721.1768965sex, year and age
541 Other surveillance and security workers2.59284211.1184021sex, year and age
834 Mobile plant operators2.85524481.1025428sex, year and age
352 Broadcasting and audio-visual technicians0.87384491.0491745sex, year and age
159 Other social services managers2.57339681.0457667sex, year and age
131 Information and communications technology service managers2.36738921.0310987sex, year and age
815 Machine operators, textile, fur and leather products1.00468150.9282509sex, year and age
941 Fast-food workers, food preparation assistants2.40284520.8902366sex, year and age
912 Washers, window cleaners and other cleaning workers2.80873420.8797368sex, year and age
524 Event seller and telemarketers3.49884510.8544225sex, year and age
121 Finance managers2.56707840.8466459sex, year and age
512 Cooks and cold-buffet managers3.21639580.8442390sex, year and age
136 Production managers in construction and mining2.84679040.7932921sex, year and age
814 Machine operators, rubber, plastic and paper products2.29174990.7793006sex, year and age
214 Engineering professionals1.64923160.7761337sex, year and age
813 Machine operators, chemical and pharmaceutical products1.90639350.7563922sex, year and age
531 Child care workers and teachers aides2.09505820.7028050sex, year and age
265 Creative and performing artists2.91751660.6854106sex, year and age
336 Police officers3.16288440.6829463sex, year and age
123 Administration and planning managers5.23251290.6568238sex, year and age
226 Dentists2.20029190.6424133sex, year and age
821 Assemblers2.72987230.6272515sex, year and age
266 Social work and counselling professionals2.90309630.6105511sex, year and age
333 Business services agents3.46088430.6059347sex, year and age
122 Human resource managers2.83674330.6024562sex, year and age
264 Authors, journalists and linguists1.15293060.5903280sex, year and age
134 Architectural and engineering managers2.11605370.5768053sex, year and age
153 Elderly care managers3.03642630.5758293sex, year and age
125 Sales and marketing managers1.67397670.5704022sex, year and age
133 Research and development managers1.15970440.5683059sex, year and age
932 Manufacturing labourers2.12909540.5548487sex, year and age
312 Construction and manufacturing supervisors3.45916410.5377424sex, year and age
335 Tax and related government associate professionals2.14483030.5243855sex, year and age
533 Health care assistants2.00139780.4993126sex, year and age
221 Medical doctors0.66856000.4775631sex, year and age
819 Process control technicians2.65014380.4743982sex, year and age
243 Marketing and public relations professionals1.06179410.4741832sex, year and age
611 Market gardeners and crop growers1.41162460.4502343sex, year and age
231 University and higher education teachers2.42113670.4173814sex, year and age
233 Secondary education teachers2.77342580.3928290sex, year and age
962 Newspaper distributors, janitors and other service workers1.13188530.3918519sex, year and age
137 Production managers in manufacturing2.16606400.3369015sex, year and age
141 Primary and secondary schools and adult education managers3.40899300.3318747sex, year and age
422 Client information clerks1.35060000.3234139sex, year and age
511 Cabin crew, guides and related workers1.25490990.3045993sex, year and age
179 Other services managers not elsewhere classified3.02931210.3041590sex, year and age
223 Nursing professionals (cont.)2.87882430.2989413sex, year and age
234 Primary- and pre-school teachers3.45597680.2757739sex, year and age
532 Personal care workers in health services2.91478950.2709784sex, year and age
722 Blacksmiths, toolmakers and related trades workers1.86719650.2638641sex, year and age
831 Train operators and related workers1.54604500.2570093sex, year and age
331 Financial and accounting associate professionals1.80202730.2535867sex, year and age
411 Office assistants and other secretaries2.26277800.1869850sex, year and age
812 Metal processing and finishing plant operators1.73056420.1741774sex, year and age
311 Physical and engineering science technicians2.64723700.1720296sex, year and age
761 Butchers, bakers and food processors1.61722210.1659462sex, year and age
224 Psychologists and psychotherapists2.43335530.1445774sex, year and age
321 Medical and pharmaceutical technicians3.24407270.1215590sex, year and age
217 Designers2.38690240.1138331sex, year and age
351 ICT operations and user support technicians1.75679730.1112492sex, year and age
516 Other service related workers2.84347180.0882348sex, year and age
129 Administration and service managers not elsewhere classified2.63956730.0513667sex, year and age
723 Machinery mechanics and fitters2.27205510.0252031sex, year and age
752 Wood treaters, cabinet-makers and related trades workers2.25526760.0214662sex, year and age
522 Shop staff2.89646810.0194987sex, year and age
251 ICT architects, systems analysts and test managers2.24883550.0081645sex, 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
ssykIncrease in salaryF-value for ageinteraction
231 University and higher education teachers2.295814134.5015790sex and edulevel
531 Child care workers and teachers aides2.084948222.9893835sex and edulevel
534 Attendants, personal assistants and related workers1.985359917.8765982sex and edulevel
159 Other social services managers2.520002217.2526856sex and edulevel
331 Financial and accounting associate professionals1.940824515.3185884sex and edulevel
232 Vocational education teachers2.890554513.2302391sex and edulevel
235 Teaching professionals not elsewhere classified1.891032212.9225823sex and edulevel
533 Health care assistants1.989419012.7840342sex and edulevel
532 Personal care workers in health services2.84967259.1729109sex and edulevel
335 Tax and related government associate professionals2.33537567.9120778sex and edulevel
151 Health care managers2.33718977.8893324sex and edulevel
312 Construction and manufacturing supervisors3.25141557.5021320sex and edulevel
221 Medical doctors1.62878877.2076142sex and edulevel
261 Legal professionals3.04800656.8746713sex and edulevel
213 Biologists, pharmacologists and specialists in agriculture and forestry1.54500276.5884385sex and edulevel
123 Administration and planning managers3.29407316.5099919sex and edulevel
332 Insurance advisers, sales and purchasing agents2.20924996.4609540sex and edulevel
218 Specialists within environmental and health protection2.73929766.4333433sex and edulevel
815 Machine operators, textile, fur and leather products1.29872605.9964706sex and edulevel
352 Broadcasting and audio-visual technicians1.19892745.9008142sex and edulevel
234 Primary- and pre-school teachers2.98425225.5772411sex and edulevel
179 Other services managers not elsewhere classified2.77078305.5622073sex and edulevel
818 Other stationary plant and machine operators2.33488135.3288394sex and edulevel
122 Human resource managers2.81363115.2385563sex and edulevel
831 Train operators and related workers1.83236184.7619015sex and edulevel
133 Research and development managers1.24774914.7380058sex and edulevel
242 Organisation analysts, policy administrators and human resource specialists1.77457694.6468566sex and edulevel
432 Stores and transport clerks1.88122384.5189085sex and edulevel
819 Process control technicians2.20145944.3967289sex and edulevel
441 Library and filing clerks1.88160624.2560137sex and edulevel
311 Physical and engineering science technicians1.82303924.1225856sex and edulevel
422 Client information clerks1.80285604.0863532sex and edulevel
513 Waiters and bartenders2.84493793.9818863sex and edulevel
217 Designers2.78083933.7385345sex and edulevel
125 Sales and marketing managers2.30367993.4839265sex and edulevel
214 Engineering professionals2.28669573.3293074sex and edulevel
132 Supply, logistics and transport managers1.29541353.2963695sex and edulevel
821 Assemblers2.88592123.2954380sex and edulevel
341 Social work and religious associate professionals2.56699733.2470601sex and edulevel
523 Cashiers and related clerks1.41614523.1231802sex and edulevel
161 Financial and insurance managers2.85614693.0300851sex and edulevel
411 Office assistants and other secretaries2.24677402.9941491sex and edulevel
941 Fast-food workers, food preparation assistants1.80061792.9874932sex and edulevel
342 Athletes, fitness instructors and recreational workers1.77941452.9204408sex and edulevel
334 Administrative and specialized secretaries3.19965572.7701174sex and edulevel
216 Architects and surveyors2.05319862.7656716sex and edulevel
511 Cabin crew, guides and related workers0.52007692.6492869sex and edulevel
812 Metal processing and finishing plant operators0.78941882.4826989sex and edulevel
251 ICT architects, systems analysts and test managers2.58326212.4743375sex and edulevel
817 Wood processing and papermaking plant operators2.85086832.3671829sex and edulevel
524 Event seller and telemarketers1.74836452.3363353sex and edulevel
121 Finance managers2.56225732.3103331sex and edulevel
522 Shop staff2.18913082.1309636sex and edulevel
723 Machinery mechanics and fitters1.96521002.1236645sex and edulevel
321 Medical and pharmaceutical technicians2.71935462.0749292sex and edulevel
911 Cleaners and helpers1.89001361.9883146sex and edulevel
137 Production managers in manufacturing1.82047831.9834843sex and edulevel
541 Other surveillance and security workers2.48540951.8987495sex and edulevel
962 Newspaper distributors, janitors and other service workers1.51685591.7259970sex and edulevel
834 Mobile plant operators2.34931041.6776513sex and edulevel
131 Information and communications technology service managers4.52174511.5468919sex and edulevel
264 Authors, journalists and linguists0.93987591.5389406sex and edulevel
732 Printing trades workers1.37549201.4116364sex and edulevel
961 Recycling collectors2.50262411.3670042sex and edulevel
333 Business services agents2.66471331.2102215sex and edulevel
932 Manufacturing labourers2.99385541.1866761sex and edulevel
241 Accountants, financial analysts and fund managers3.06492471.0785958sex and edulevel
343 Photographers, interior decorators and entertainers3.77515541.0765630sex and edulevel
512 Cooks and cold-buffet managers2.38236371.0684103sex and edulevel
833 Heavy truck and bus drivers1.60671551.0284369sex and edulevel
129 Administration and service managers not elsewhere classified2.30802531.0114151sex and edulevel
173 Retail and wholesale trade managers4.58237810.8462927sex and edulevel
233 Secondary education teachers2.37271540.7689329sex and edulevel
611 Market gardeners and crop growers1.29481390.7273208sex and edulevel
243 Marketing and public relations professionals0.60330590.6504950sex and edulevel
136 Production managers in construction and mining1.92906460.6163258sex and edulevel
711 Carpenters, bricklayers and construction workers1.82298910.5364368sex and edulevel
816 Machine operators, food and related products1.79353350.4643469sex and edulevel
262 Museum curators and librarians and related professionals3.01790140.4478464sex and edulevel
722 Blacksmiths, toolmakers and related trades workers1.96069240.4286145sex and edulevel
351 ICT operations and user support technicians1.72011550.3979107sex and edulevel
265 Creative and performing artists3.08426170.3975144sex and edulevel
516 Other service related workers2.81147180.3611032sex and edulevel
813 Machine operators, chemical and pharmaceutical products2.22013420.3378979sex and edulevel
515 Building caretakers and related workers2.63329390.2296460sex and edulevel
134 Architectural and engineering managers2.84630940.1876642sex and edulevel
266 Social work and counselling professionals2.42591630.1355394sex and edulevel
814 Machine operators, rubber, plastic and paper products2.44795150.0917245sex 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
ssykIncrease in salaryF-value for ageinteraction
262 Museum curators and librarians and related professionals1.337039012.5685564sex and year
813 Machine operators, chemical and pharmaceutical products1.723190510.6533739sex and year
131 Information and communications technology service managers2.746273710.0982495sex and year
151 Health care managers1.33735359.1937238sex and year
815 Machine operators, textile, fur and leather products0.75152258.5275034sex and year
243 Marketing and public relations professionals-0.55503147.7320191sex and year
932 Manufacturing labourers2.45644795.1323005sex and year
816 Machine operators, food and related products1.41020814.6641162sex and year
311 Physical and engineering science technicians2.62956354.4514388sex and year
819 Process control technicians2.51436893.3882796sex and year
533 Health care assistants1.79597723.3597299sex and year
351 ICT operations and user support technicians1.30308323.3339379sex and year
221 Medical doctors1.07032163.2379210sex and year
264 Authors, journalists and linguists0.28304183.2324009sex and year
541 Other surveillance and security workers2.66837853.0177453sex and year
511 Cabin crew, guides and related workers1.33149372.7734531sex and year
834 Mobile plant operators2.62623712.7299923sex and year
159 Other social services managers2.17879982.6997604sex and year
173 Retail and wholesale trade managers6.28490302.6920564sex and year
341 Social work and religious associate professionals2.79937822.4785285sex and year
312 Construction and manufacturing supervisors3.58506602.1887133sex and year
723 Machinery mechanics and fitters2.33751702.1272013sex and year
235 Teaching professionals not elsewhere classified1.37828872.1168491sex and year
821 Assemblers2.58947152.0183158sex and year
122 Human resource managers1.61587381.8995024sex and year
123 Administration and planning managers4.02384531.7601948sex and year
334 Administrative and specialized secretaries3.77142651.6845647sex and year
512 Cooks and cold-buffet managers2.74971791.4835714sex and year
179 Other services managers not elsewhere classified3.20902231.4601245sex and year
732 Printing trades workers1.10438141.3695629sex and year
432 Stores and transport clerks1.68480011.3440502sex and year
411 Office assistants and other secretaries1.90081291.1244333sex and year
814 Machine operators, rubber, plastic and paper products2.27070501.0815608sex and year
911 Cleaners and helpers2.02983271.0400501sex and year
962 Newspaper distributors, janitors and other service workers1.28426401.0400405sex and year
812 Metal processing and finishing plant operators0.05982980.9982723sex and year
321 Medical and pharmaceutical technicians3.00954530.9569319sex and year
352 Broadcasting and audio-visual technicians0.78873040.9352994sex and year
441 Library and filing clerks1.61435600.9017484sex and year
343 Photographers, interior decorators and entertainers4.38634780.8400912sex and year
817 Wood processing and papermaking plant operators2.69363380.7010849sex and year
422 Client information clerks1.60812750.6920726sex and year
333 Business services agents3.00147890.6872118sex and year
137 Production managers in manufacturing2.21370620.6712665sex and year
331 Financial and accounting associate professionals1.66116450.6470988sex and year
232 Vocational education teachers2.65794750.6330528sex and year
532 Personal care workers in health services2.77131760.6314612sex and year
121 Finance managers2.10977940.6254650sex and year
833 Heavy truck and bus drivers1.77072510.5974334sex and year
513 Waiters and bartenders2.37519290.4976799sex and year
265 Creative and performing artists2.68693890.4912352sex and year
161 Financial and insurance managers3.36780370.4848632sex and year
534 Attendants, personal assistants and related workers1.75168180.4712625sex and year
266 Social work and counselling professionals2.22540120.4681457sex and year
332 Insurance advisers, sales and purchasing agents2.40288940.4468183sex and year
524 Event seller and telemarketers2.05328440.4218714sex and year
242 Organisation analysts, policy administrators and human resource specialists1.59928070.3854059sex and year
711 Carpenters, bricklayers and construction workers1.96919940.3716610sex and year
941 Fast-food workers, food preparation assistants1.61556300.3607242sex and year
261 Legal professionals3.38238470.3303860sex and year
516 Other service related workers2.50588370.3278309sex and year
342 Athletes, fitness instructors and recreational workers1.97577150.2936025sex and year
134 Architectural and engineering managers3.02108960.2305112sex and year
132 Supply, logistics and transport managers1.27335340.2184407sex and year
522 Shop staff2.05173580.2003355sex and year
214 Engineering professionals2.21035390.1363967sex and year
136 Production managers in construction and mining1.80486200.1361198sex and year
129 Administration and service managers not elsewhere classified2.38578220.1359729sex and year
722 Blacksmiths, toolmakers and related trades workers2.02959050.1151279sex and year
213 Biologists, pharmacologists and specialists in agriculture and forestry1.69010800.1061134sex and year
515 Building caretakers and related workers2.70622050.1013957sex and year
611 Market gardeners and crop growers1.33889710.0784413sex and year
241 Accountants, financial analysts and fund managers3.15314370.0419040sex and year
523 Cashiers and related clerks1.22198860.0365257sex and year
251 ICT architects, systems analysts and test managers2.64539680.0341629sex and year
125 Sales and marketing managers2.26167620.0175115sex and year
133 Research and development managers1.11026910.0171085sex and year
217 Designers2.71550670.0160870sex and year
218 Specialists within environmental and health protection2.56048430.0138650sex and year
234 Primary- and pre-school teachers3.00031100.0070748sex and year
233 Secondary education teachers2.39809830.0066879sex and year
231 University and higher education teachers2.26879670.0051000sex and year
831 Train operators and related workers1.82514530.0043574sex and year
335 Tax and related government associate professionals2.32419950.0038471sex and year
531 Child care workers and teachers aides2.09549910.0031907sex and year
216 Architects and surveyors2.07296950.0031382sex and year
818 Other stationary plant and machine operators2.33254730.0016111sex and year
961 Recycling collectors2.49779530.0008583sex 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
ssykIncrease in salaryF-value for ageinteraction
534 Attendants, personal assistants and related workers-0.140281017.4936553year and edulevel
812 Metal processing and finishing plant operators-5.152058715.9949732year and edulevel
262 Museum curators and librarians and related professionals1.98407588.0470057year and edulevel
234 Primary- and pre-school teachers3.88389515.4208619year and edulevel
522 Shop staff0.06988775.0158953year and edulevel
129 Administration and service managers not elsewhere classified4.16732284.7271849year and edulevel
161 Financial and insurance managers4.51350814.0324041year and edulevel
516 Other service related workers7.26702103.1139823year and edulevel
125 Sales and marketing managers2.34720663.0940253year and edulevel
131 Information and communications technology service managers2.12012152.8775913year and edulevel
243 Marketing and public relations professionals0.73241202.7082606year and edulevel
335 Tax and related government associate professionals1.17656822.5942601year and edulevel
242 Organisation analysts, policy administrators and human resource specialists1.36878262.5767431year and edulevel
511 Cabin crew, guides and related workers1.65657002.4973120year and edulevel
541 Other surveillance and security workers2.92994672.4531985year and edulevel
233 Secondary education teachers3.29214642.3912796year and edulevel
221 Medical doctors2.60997772.3282085year and edulevel
343 Photographers, interior decorators and entertainers1.74844832.3120145year and edulevel
352 Broadcasting and audio-visual technicians1.15301912.3008338year and edulevel
821 Assemblers3.47173002.2599823year and edulevel
241 Accountants, financial analysts and fund managers1.61971172.2273108year and edulevel
515 Building caretakers and related workers3.44014562.1128708year and edulevel
121 Finance managers2.39070911.8807514year and edulevel
232 Vocational education teachers3.04421301.7782730year and edulevel
218 Specialists within environmental and health protection3.38852911.7324927year and edulevel
173 Retail and wholesale trade managers7.46403951.6906345year and edulevel
266 Social work and counselling professionals3.45828801.6867797year and edulevel
524 Event seller and telemarketers0.59030281.6179929year and edulevel
251 ICT architects, systems analysts and test managers3.44500651.5962935year and edulevel
732 Printing trades workers1.40357741.4933929year and edulevel
151 Health care managers1.95311121.4056639year and edulevel
261 Legal professionals2.45244031.3545649year and edulevel
818 Other stationary plant and machine operators1.10733471.3304879year and edulevel
123 Administration and planning managers1.82720301.3139512year and edulevel
932 Manufacturing labourers2.02739051.2593432year and edulevel
311 Physical and engineering science technicians1.24848971.2546202year and edulevel
723 Machinery mechanics and fitters3.19645441.2328322year and edulevel
265 Creative and performing artists1.77337981.2051886year and edulevel
531 Child care workers and teachers aides1.62180791.0967008year and edulevel
411 Office assistants and other secretaries4.88346881.0316452year and edulevel
235 Teaching professionals not elsewhere classified2.84829741.0232382year and edulevel
214 Engineering professionals2.01104041.0077700year and edulevel
333 Business services agents1.76310500.9966769year and edulevel
264 Authors, journalists and linguists1.47934440.9754283year and edulevel
512 Cooks and cold-buffet managers2.18561200.9514593year and edulevel
342 Athletes, fitness instructors and recreational workers2.11638820.9498070year and edulevel
133 Research and development managers0.58398580.9449465year and edulevel
217 Designers3.25948260.9229512year and edulevel
134 Architectural and engineering managers1.22115970.9193392year and edulevel
334 Administrative and specialized secretaries1.96141670.9145418year and edulevel
961 Recycling collectors0.54397500.8972133year and edulevel
332 Insurance advisers, sales and purchasing agents2.27207630.8912591year and edulevel
137 Production managers in manufacturing1.89097720.8796878year and edulevel
816 Machine operators, food and related products1.50117160.8683619year and edulevel
611 Market gardeners and crop growers0.97020780.7969390year and edulevel
122 Human resource managers1.93163030.7634885year and edulevel
833 Heavy truck and bus drivers1.23623980.6907621year and edulevel
136 Production managers in construction and mining3.20444450.6886988year and edulevel
813 Machine operators, chemical and pharmaceutical products1.61812300.6737919year and edulevel
513 Waiters and bartenders1.86615490.6546343year and edulevel
711 Carpenters, bricklayers and construction workers1.19697850.6416119year and edulevel
532 Personal care workers in health services2.80202490.6328864year and edulevel
834 Mobile plant operators2.40226340.6302037year and edulevel
819 Process control technicians1.70619940.6114937year and edulevel
159 Other social services managers3.23046080.5909851year and edulevel
432 Stores and transport clerks1.84499060.5743293year and edulevel
533 Health care assistants2.16165450.5736881year and edulevel
321 Medical and pharmaceutical technicians2.52977910.5488535year and edulevel
911 Cleaners and helpers2.22450450.5336872year and edulevel
331 Financial and accounting associate professionals1.21000810.5288551year and edulevel
817 Wood processing and papermaking plant operators3.50932760.5181038year and edulevel
216 Architects and surveyors1.99191420.4832745year and edulevel
722 Blacksmiths, toolmakers and related trades workers1.72704020.4520330year and edulevel
351 ICT operations and user support technicians2.13848430.4518060year and edulevel
523 Cashiers and related clerks0.85930310.4308086year and edulevel
831 Train operators and related workers1.93702800.4298998year and edulevel
312 Construction and manufacturing supervisors2.73069100.4009186year and edulevel
941 Fast-food workers, food preparation assistants1.62270450.3683117year and edulevel
441 Library and filing clerks1.59601810.3611492year and edulevel
213 Biologists, pharmacologists and specialists in agriculture and forestry0.79027350.3333037year and edulevel
179 Other services managers not elsewhere classified2.45316690.2396802year and edulevel
422 Client information clerks2.06494250.1625848year and edulevel
132 Supply, logistics and transport managers1.18934790.1619384year and edulevel
341 Social work and religious associate professionals2.49251710.1313061year and edulevel
962 Newspaper distributors, janitors and other service workers1.37460980.0752161year and edulevel
231 University and higher education teachers2.18557040.0653639year and edulevel
815 Machine operators, textile, fur and leather products1.31384830.0462972year and edulevel
814 Machine operators, rubber, plastic and paper products2.58122720.0446220year 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
ssykIncrease in salaryF-value for ageinteraction
311 Physical and engineering science technicians0.30070697.6368150sex, year and edulevel
261 Legal professionals1.97497417.2332096sex, year and edulevel
334 Administrative and specialized secretaries1.66454884.9962163sex, year and edulevel
151 Health care managers2.00729834.6943513sex, year and edulevel
232 Vocational education teachers2.73878014.1907918sex, year and edulevel
264 Authors, journalists and linguists2.08631404.0644218sex, year and edulevel
711 Carpenters, bricklayers and construction workers1.19697854.0519757sex, year and edulevel
121 Finance managers2.06418223.6513567sex, year and edulevel
122 Human resource managers1.07795763.5481108sex, year and edulevel
137 Production managers in manufacturing-0.01521773.3778729sex, year and edulevel
523 Cashiers and related clerks1.07666833.1321131sex, year and edulevel
159 Other social services managers2.04758322.6301550sex, year and edulevel
234 Primary- and pre-school teachers3.49923042.5722281sex, year and edulevel
818 Other stationary plant and machine operators1.10733472.5439043sex, year and edulevel
342 Athletes, fitness instructors and recreational workers2.75821762.4744045sex, year and edulevel
531 Child care workers and teachers aides1.43412982.4314811sex, year and edulevel
522 Shop staff-0.58916261.9849918sex, year and edulevel
331 Financial and accounting associate professionals0.44254761.9602026sex, year and edulevel
332 Insurance advisers, sales and purchasing agents2.29473881.9422377sex, year and edulevel
533 Health care assistants1.62532101.9216616sex, year and edulevel
343 Photographers, interior decorators and entertainers1.06348661.7202512sex, year and edulevel
235 Teaching professionals not elsewhere classified3.02335621.4927454sex, year and edulevel
233 Secondary education teachers3.04076281.4358037sex, year and edulevel
813 Machine operators, chemical and pharmaceutical products1.61812301.3871806sex, year and edulevel
217 Designers3.68212931.2946162sex, year and edulevel
534 Attendants, personal assistants and related workers0.35971221.2943980sex, year and edulevel
541 Other surveillance and security workers3.11023721.2828090sex, year and edulevel
125 Sales and marketing managers0.78350221.2779771sex, year and edulevel
129 Administration and service managers not elsewhere classified4.95047481.2735961sex, year and edulevel
819 Process control technicians2.49865431.2299209sex, year and edulevel
911 Cleaners and helpers2.80149311.2021688sex, year and edulevel
341 Social work and religious associate professionals2.50102651.1808832sex, year and edulevel
723 Machinery mechanics and fitters3.19645441.1493456sex, year and edulevel
611 Market gardeners and crop growers0.14349701.1324088sex, year and edulevel
243 Marketing and public relations professionals-4.12757971.1078823sex, year and edulevel
351 ICT operations and user support technicians2.62706041.0821259sex, year and edulevel
821 Assemblers3.57271790.9895740sex, year and edulevel
524 Event seller and telemarketers0.19574560.9768868sex, year and edulevel
335 Tax and related government associate professionals1.66510380.9445517sex, year and edulevel
242 Organisation analysts, policy administrators and human resource specialists1.73779160.9296940sex, year and edulevel
831 Train operators and related workers1.93702800.9170162sex, year and edulevel
515 Building caretakers and related workers4.26856000.9019820sex, year and edulevel
422 Client information clerks2.61866000.8683975sex, year and edulevel
512 Cooks and cold-buffet managers1.93421620.8474145sex, year and edulevel
123 Administration and planning managers1.64234650.8377722sex, year and edulevel
312 Construction and manufacturing supervisors3.67693090.7940555sex, year and edulevel
241 Accountants, financial analysts and fund managers1.46342890.7813243sex, year and edulevel
812 Metal processing and finishing plant operators-4.97613470.7523221sex, year and edulevel
516 Other service related workers7.07432580.7425455sex, year and edulevel
432 Stores and transport clerks1.63370810.7279130sex, year and edulevel
221 Medical doctors2.50163530.6902677sex, year and edulevel
134 Architectural and engineering managers1.22115970.6693583sex, year and edulevel
333 Business services agents1.00126480.6482391sex, year and edulevel
441 Library and filing clerks0.82657960.6267038sex, year and edulevel
962 Newspaper distributors, janitors and other service workers1.60612030.5933810sex, year and edulevel
941 Fast-food workers, food preparation assistants0.69148530.5829709sex, year and edulevel
321 Medical and pharmaceutical technicians2.45405050.5434559sex, year and edulevel
352 Broadcasting and audio-visual technicians1.94356130.5379284sex, year and edulevel
161 Financial and insurance managers4.93472000.5294277sex, year and edulevel
511 Cabin crew, guides and related workers3.06444050.5132864sex, year and edulevel
932 Manufacturing labourers2.02739050.5026755sex, year and edulevel
179 Other services managers not elsewhere classified2.20469700.4872775sex, year and edulevel
532 Personal care workers in health services2.69317030.4842910sex, year and edulevel
173 Retail and wholesale trade managers10.59937970.4694386sex, year and edulevel
133 Research and development managers1.30718330.4418744sex, year and edulevel
231 University and higher education teachers2.05035010.3707303sex, year and edulevel
834 Mobile plant operators2.40226340.3545803sex, year and edulevel
265 Creative and performing artists1.18092610.3382118sex, year and edulevel
266 Social work and counselling professionals3.17924870.3328237sex, year and edulevel
251 ICT architects, systems analysts and test managers3.96606910.3290868sex, year and edulevel
815 Machine operators, textile, fur and leather products0.58962740.3224206sex, year and edulevel
131 Information and communications technology service managers-0.03476010.3179017sex, year and edulevel
732 Printing trades workers1.40357740.2933972sex, year and edulevel
132 Supply, logistics and transport managers1.95892580.2574186sex, year and edulevel
411 Office assistants and other secretaries4.88928500.2517369sex, year and edulevel
833 Heavy truck and bus drivers1.68482270.2443507sex, year and edulevel
722 Blacksmiths, toolmakers and related trades workers2.17328260.2354179sex, year and edulevel
816 Machine operators, food and related products0.85830280.1593265sex, year and edulevel
214 Engineering professionals1.97851620.1445402sex, year and edulevel
262 Museum curators and librarians and related professionals1.47279220.1389862sex, year and edulevel
136 Production managers in construction and mining3.98741040.1239311sex, year and edulevel
817 Wood processing and papermaking plant operators3.50932760.0936398sex, year and edulevel
513 Waiters and bartenders2.52670440.0838668sex, year and edulevel
814 Machine operators, rubber, plastic and paper products2.58122720.0552916sex, year and edulevel
218 Specialists within environmental and health protection2.76404670.0345293sex, year and edulevel
213 Biologists, pharmacologists and specialists in agriculture and forestry0.71451560.0285926sex, year and edulevel
961 Recycling collectors0.54397500.0142411sex, year and edulevel
216 Architects and surveyors1.93980000.0071724sex, 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)