The significance of the sector on the salary in Sweden, a comparison between different occupational groups, part 2

February 22, 2020
By

[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 examined the significance of the sector on the salary for different occupational groups using statistics from different regions. In previous posts I have shown a correlation between the salary and experience and also salary and education, In this post, I will examine the correlation between salary and sector using statistics for age.

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

First, define libraries and functions.

library (tidyverse)
## -- Attaching packages --------------------------------------------------- tidyverse 1.3.0 --
## v ggplot2 3.2.1     v purrr   0.3.3
## v tibble  2.1.3     v dplyr   0.8.3
## v tidyr   1.0.2     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)
## Registered S3 methods overwritten by 'lme4':
##   method                          from
##   cooks.distance.influence.merMod car 
##   influence.merMod                car 
##   dfbeta.influence.merMod         car 
##   dfbetas.influence.merMod        car
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/.

I have renamed the file to 000000D2_sector.csv because the filename 000000D2.csv was used in a previous post.

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 1-3 public sector 4-5 private sector

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_sector.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 = 0
anova_table = 0

for (i in unique(tb$`occuptional  (SSYK 2012)`)){
  temp <- filter(tb, `occuptional  (SSYK 2012)` == i)
  if (dim(temp)[1] > 90){
    model <- lm(log(salary) ~ poly(age_n, 3) + sex + year_n + sector, data = temp)
    summary_table <- rbind (summary_table, mutate (tidy (summary (model)), ssyk = i, interaction = "none"))
    anova_table <- rbind (anova_table, mutate (tidy (Anova (model, type = 2)), ssyk = i, interaction = "none"))  
  
    model <- lm(log(salary) ~ poly(age_n, 3) * sector + sex + year_n, data = temp)
    summary_table <- rbind (summary_table, mutate (tidy (summary (model)), ssyk = i, interaction = "sector and age"))
    anova_table <- rbind (anova_table, mutate (tidy (Anova (model, type = 2)), ssyk = i, interaction = "sector and age"))  
    
    model <- lm(log(salary) ~ poly(age_n, 3) + sector * sex + year_n, data = temp)
    summary_table <- rbind (summary_table, mutate (tidy (summary (model)), ssyk = i, interaction = "sector and sex"))
    anova_table <- rbind (anova_table, mutate (tidy (Anova (model, type = 2)), ssyk = i, interaction = "sector and sex"))  
    
    model <- lm(log(salary) ~ poly(age_n, 3) +  year_n * sector + sex, data = temp)
    summary_table <- rbind (summary_table, mutate (tidy (summary (model)), ssyk = i, interaction = "sector and year"))
    anova_table <- rbind (anova_table, mutate (tidy (Anova (model, type = 2)), ssyk = i, interaction = "sector and year"))  
    
    model <- lm(log(salary) ~ poly(age_n, 3) * sector * sex * year_n, data = temp)
    summary_table <- rbind (summary_table, mutate (tidy (summary (model)), ssyk = i, interaction = "sector, year, age and sex"))
    anova_table <- rbind (anova_table, mutate (tidy (Anova (model, type = 2)), ssyk = i, interaction = "sector, year, age and sex"))      
  }
}
## 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 (term.y == "sector") %>%    
  filter (interaction == "none") %>%
  
  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 sector"
    )   

The significance of the sector on the salary in Sweden, a comparison between different occupational groups, Year 2014 - 2018

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

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 four variables in the case with interaction sector, year, age and sex
  filter (!(contcol.y < 3 & interaction == "sector, year, age and sex")) %>% 
  
  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 sector, age, year and sex on the salary in Sweden, a comparison between different occupational groups, Year 2014 - 2018

Figure 2: The significance of the interaction between sector, age, year and 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 (term.y == "sector") %>%   
  filter (interaction == "none") %>%
  mutate (estimate = (exp(estimate) - 1) * 100) %>%  
  select (ssyk, estimate, statistic.y, interaction) %>%
  rename (`F-value` = statistic.y) %>%
  rename (`Increase in salary` = estimate) %>%
  arrange (desc (`F-value`)) %>%
  knitr::kable(
    booktabs = TRUE,
    caption = 'Correlation for F-value (sector) and the yearly increase in salaries')
Table 1: Correlation for F-value (sector) and the yearly increase in salaries
ssyk Increase in salary F-value interaction
218 Specialists within environmental and health protection 2.3966875 456.4704739 none
261 Legal professionals 2.6130221 304.1919940 none
411 Office assistants and other secretaries 2.3419860 285.0349753 none
222 Nursing professionals 4.6578230 280.4433905 none
515 Building caretakers and related workers 2.2146338 270.0075297 none
819 Process control technicians 2.5350438 268.3445857 none
242 Organisation analysts, policy administrators and human resource specialists 2.0523696 259.5458010 none
251 ICT architects, systems analysts and test managers 2.3512692 241.0997355 none
321 Medical and pharmaceutical technicians 2.5801263 237.2341857 none
333 Business services agents 2.3936321 218.8431989 none
334 Administrative and specialized secretaries 2.0432078 197.0091850 none
243 Marketing and public relations professionals 1.7547524 188.6715597 none
335 Tax and related government associate professionals 2.4477931 179.6275210 none
342 Athletes, fitness instructors and recreational workers 1.8086152 178.9426205 none
962 Newspaper distributors, janitors and other service workers 1.9900356 178.5334093 none
213 Biologists, pharmacologists and specialists in agriculture and forestry 1.8912397 161.3670379 none
265 Creative and performing artists 2.0992262 156.9400225 none
241 Accountants, financial analysts and fund managers 2.4619072 134.7081954 none
351 ICT operations and user support technicians 2.7045039 117.0092304 none
331 Financial and accounting associate professionals 2.1803329 111.0703889 none
264 Authors, journalists and linguists 2.2865429 93.9690111 none
211 Physicists and chemists 2.0010438 65.4196943 none
911 Cleaners and helpers 1.9306757 64.9465316 none
231 University and higher education teachers 2.3987358 58.9926983 none
541 Other surveillance and security workers 2.2500326 54.4430468 none
815 Machine operators, textile, fur and leather products 1.3517419 48.6411876 none
723 Machinery mechanics and fitters 2.4251751 48.2416487 none
233 Secondary education teachers 3.0390165 38.5627689 none
422 Client information clerks 2.4686744 37.8718779 none
228 Specialists in health care not elsewhere classified 2.1589844 36.5601628 none
941 Fast-food workers, food preparation assistants 1.9960527 18.6514673 none
216 Architects and surveyors 2.8323556 15.8227312 none
235 Teaching professionals not elsewhere classified 1.6582824 14.3745577 none
532 Personal care workers in health services 3.0076073 12.2147525 none
311 Physical and engineering science technicians 2.7704145 12.1641422 none
234 Primary- and pre-school teachers 3.4774983 7.3900661 none
511 Cabin crew, guides and related workers -0.3443427 6.9533625 none
534 Attendants, personal assistants and related workers 2.0233419 5.1208491 none
533 Health care assistants 2.2271720 4.8058895 none
332 Insurance advisers, sales and purchasing agents 2.2044676 4.2832833 none
531 Child care workers and teachers aides 1.9105637 4.0479235 none
214 Engineering professionals 2.7995742 2.1850611 none
341 Social work and religious associate professionals 2.5651458 2.1164875 none
432 Stores and transport clerks 1.9337354 0.7577500 none
611 Market gardeners and crop growers 1.8041743 0.0643998 none
512 Cooks and cold-buffet managers 2.7942944 0.0197082 none
merge(summary_table, anova_table, c("ssyk", "interaction"), all = TRUE) %>%
  filter (term.x == "year_n") %>%
  filter (contcol.y > 0) %>%   
  filter (interaction == "sector and sex") %>%
  mutate (estimate = (exp(estimate) - 1) * 100) %>%  
  select (ssyk, estimate, statistic.y, interaction) %>%
  rename (`F-value` = statistic.y) %>%
  rename (`Increase in salary` = estimate) %>%
  arrange (desc (`F-value`)) %>%
  knitr::kable(
    booktabs = TRUE,
    caption = 'Correlation for F-value (sector and sex) and the yearly increase in salaries')
Table 2: Correlation for F-value (sector and sex) and the yearly increase in salaries
ssyk Increase in salary F-value interaction
911 Cleaners and helpers 1.9306757 109.1411280 sector and sex
335 Tax and related government associate professionals 2.4477931 70.7824355 sector and sex
815 Machine operators, textile, fur and leather products 1.3563289 31.8117555 sector and sex
333 Business services agents 2.2899853 30.4752880 sector and sex
331 Financial and accounting associate professionals 2.2023600 25.9296892 sector and sex
342 Athletes, fitness instructors and recreational workers 1.8086152 25.0203935 sector and sex
241 Accountants, financial analysts and fund managers 2.4786358 24.2528951 sector and sex
264 Authors, journalists and linguists 2.2453619 21.8740576 sector and sex
533 Health care assistants 2.2271720 21.5539071 sector and sex
243 Marketing and public relations professionals 1.7263442 19.6730093 sector and sex
332 Insurance advisers, sales and purchasing agents 2.2044676 19.3664844 sector and sex
611 Market gardeners and crop growers 1.7542849 15.6290927 sector and sex
532 Personal care workers in health services 3.0076073 12.5499477 sector and sex
213 Biologists, pharmacologists and specialists in agriculture and forestry 1.8973847 11.5413223 sector and sex
321 Medical and pharmaceutical technicians 2.5636636 9.5201918 sector and sex
242 Organisation analysts, policy administrators and human resource specialists 2.0388525 7.8030347 sector and sex
351 ICT operations and user support technicians 2.7045039 7.5568275 sector and sex
211 Physicists and chemists 1.9926264 7.5217104 sector and sex
235 Teaching professionals not elsewhere classified 1.6228416 5.7033533 sector and sex
512 Cooks and cold-buffet managers 2.7942944 5.4926902 sector and sex
941 Fast-food workers, food preparation assistants 1.9960527 3.8523689 sector and sex
432 Stores and transport clerks 1.9247904 3.3361868 sector and sex
218 Specialists within environmental and health protection 2.3902920 3.2726896 sector and sex
231 University and higher education teachers 2.4049429 3.1968905 sector and sex
222 Nursing professionals 4.6527974 2.8848508 sector and sex
265 Creative and performing artists 2.0908231 2.4335097 sector and sex
962 Newspaper distributors, janitors and other service workers 1.9900356 2.3091055 sector and sex
233 Secondary education teachers 3.0478812 1.6616950 sector and sex
228 Specialists in health care not elsewhere classified 2.2271410 1.4295653 sector and sex
819 Process control technicians 2.5350438 1.1646979 sector and sex
541 Other surveillance and security workers 2.2500326 1.1488532 sector and sex
534 Attendants, personal assistants and related workers 2.0233419 1.1344410 sector and sex
261 Legal professionals 2.6014900 1.1208624 sector and sex
531 Child care workers and teachers aides 1.9034289 1.0441681 sector and sex
411 Office assistants and other secretaries 2.3419860 0.8053533 sector and sex
214 Engineering professionals 2.7938330 0.7610648 sector and sex
341 Social work and religious associate professionals 2.5666541 0.6898733 sector and sex
422 Client information clerks 2.4707255 0.4188795 sector and sex
251 ICT architects, systems analysts and test managers 2.3512692 0.2019761 sector and sex
234 Primary- and pre-school teachers 3.4774983 0.1910697 sector and sex
334 Administrative and specialized secretaries 2.0473936 0.1673844 sector and sex
723 Machinery mechanics and fitters 2.4270025 0.0946975 sector and sex
216 Architects and surveyors 2.8323370 0.0480519 sector and sex
515 Building caretakers and related workers 2.2148711 0.0466927 sector and sex
311 Physical and engineering science technicians 2.7695781 0.0317138 sector and sex
511 Cabin crew, guides and related workers -0.3452668 0.0263848 sector and sex
merge(summary_table, anova_table, c("ssyk", "interaction"), all = TRUE) %>%
  filter (term.x == "year_n") %>%
  filter (contcol.y > 0) %>%   
  filter (interaction == "sector and age") %>%
  mutate (estimate = (exp(estimate) - 1) * 100) %>%  
  select (ssyk, estimate, statistic.y, interaction) %>%
  rename (`F-value` = statistic.y) %>%
  rename (`Increase in salary` = estimate) %>%
  arrange (desc (`F-value`)) %>%
  knitr::kable(
    booktabs = TRUE,
    caption = 'Correlation for F-value (sector and age) and the yearly increase in salaries')
Table 3: Correlation for F-value (sector and age) and the yearly increase in salaries
ssyk Increase in salary F-value interaction
251 ICT architects, systems analysts and test managers 2.3512692 81.293931 sector and age
534 Attendants, personal assistants and related workers 2.0233419 74.994233 sector and age
234 Primary- and pre-school teachers 3.4774983 50.554556 sector and age
511 Cabin crew, guides and related workers -0.3214703 49.726047 sector and age
331 Financial and accounting associate professionals 2.1760115 43.716282 sector and age
432 Stores and transport clerks 1.9372268 41.355837 sector and age
351 ICT operations and user support technicians 2.7045039 37.992660 sector and age
241 Accountants, financial analysts and fund managers 2.4925081 31.914364 sector and age
242 Organisation analysts, policy administrators and human resource specialists 2.0984548 31.372391 sector and age
422 Client information clerks 2.4763530 24.396462 sector and age
342 Athletes, fitness instructors and recreational workers 1.8086152 21.878170 sector and age
332 Insurance advisers, sales and purchasing agents 2.2044676 20.887588 sector and age
333 Business services agents 2.5711782 20.728956 sector and age
261 Legal professionals 2.6542145 19.114710 sector and age
233 Secondary education teachers 3.1089611 18.460571 sector and age
541 Other surveillance and security workers 2.2500326 18.166197 sector and age
243 Marketing and public relations professionals 1.8298739 16.372110 sector and age
231 University and higher education teachers 2.5000216 15.799814 sector and age
411 Office assistants and other secretaries 2.3419860 15.436701 sector and age
235 Teaching professionals not elsewhere classified 1.8467331 15.280487 sector and age
211 Physicists and chemists 1.9949354 11.545117 sector and age
213 Biologists, pharmacologists and specialists in agriculture and forestry 1.8835767 11.142152 sector and age
228 Specialists in health care not elsewhere classified 2.0243679 10.920972 sector and age
335 Tax and related government associate professionals 2.4477931 10.914843 sector and age
941 Fast-food workers, food preparation assistants 1.9960527 10.718505 sector and age
341 Social work and religious associate professionals 2.5816295 9.475763 sector and age
216 Architects and surveyors 2.7872555 9.229637 sector and age
321 Medical and pharmaceutical technicians 2.5872747 8.122166 sector and age
911 Cleaners and helpers 1.9306757 8.084293 sector and age
815 Machine operators, textile, fur and leather products 1.3751133 7.636766 sector and age
334 Administrative and specialized secretaries 2.1355883 7.153296 sector and age
218 Specialists within environmental and health protection 2.4620357 6.994422 sector and age
962 Newspaper distributors, janitors and other service workers 1.9900356 6.838603 sector and age
531 Child care workers and teachers aides 1.9226126 6.070516 sector and age
515 Building caretakers and related workers 2.2192760 6.005165 sector and age
311 Physical and engineering science technicians 2.7875316 5.421210 sector and age
723 Machinery mechanics and fitters 2.4360682 5.406378 sector and age
819 Process control technicians 2.5350438 5.043236 sector and age
264 Authors, journalists and linguists 2.2247505 4.044872 sector and age
512 Cooks and cold-buffet managers 2.7942944 3.928362 sector and age
533 Health care assistants 2.2271720 3.673529 sector and age
265 Creative and performing artists 2.0786906 2.538964 sector and age
214 Engineering professionals 2.7863137 2.497814 sector and age
532 Personal care workers in health services 3.0076073 2.339712 sector and age
222 Nursing professionals 4.6262827 2.287950 sector and age
611 Market gardeners and crop growers 1.8042107 1.716068 sector and age
merge(summary_table, anova_table, c("ssyk", "interaction"), all = TRUE) %>%
  filter (term.x == "year_n") %>%
  filter (contcol.y > 0) %>%   
  filter (interaction == "sector and year") %>%
  mutate (estimate = (exp(estimate) - 1) * 100) %>%  
  select (ssyk, estimate, statistic.y, interaction) %>%
  rename (`F-value` = statistic.y) %>%
  rename (`Increase in salary` = estimate) %>%
  arrange (desc (`F-value`)) %>%
  knitr::kable(
    booktabs = TRUE,
    caption = 'Correlation for F-value (sector and year) and the yearly increase in salaries')
Table 4: Correlation for F-value (sector and year) and the yearly increase in salaries
ssyk Increase in salary F-value interaction
222 Nursing professionals 3.2821623 52.9080079 sector and year
235 Teaching professionals not elsewhere classified 2.7102815 24.3392922 sector and year
334 Administrative and specialized secretaries 0.6824704 15.9484068 sector and year
531 Child care workers and teachers aides 2.3704462 13.8844930 sector and year
422 Client information clerks 3.2226939 12.4412439 sector and year
962 Newspaper distributors, janitors and other service workers 2.5465829 10.9472608 sector and year
534 Attendants, personal assistants and related workers 2.3719311 10.1007673 sector and year
532 Personal care workers in health services 2.7590988 9.0616925 sector and year
611 Market gardeners and crop growers 2.4285881 9.0355793 sector and year
233 Secondary education teachers 3.4681159 8.2187247 sector and year
264 Authors, journalists and linguists 3.2488108 6.2777560 sector and year
351 ICT operations and user support technicians 3.4272576 4.8822064 sector and year
214 Engineering professionals 3.4475215 4.3685520 sector and year
723 Machinery mechanics and fitters 2.7726800 4.0300820 sector and year
511 Cabin crew, guides and related workers -1.4636615 3.9854827 sector and year
243 Marketing and public relations professionals 2.4174309 3.9092911 sector and year
311 Physical and engineering science technicians 3.2975181 3.6534643 sector and year
533 Health care assistants 2.0202998 3.4258034 sector and year
216 Architects and surveyors 3.2766321 3.0286083 sector and year
512 Cooks and cold-buffet managers 2.4761796 2.1189296 sector and year
231 University and higher education teachers 2.7564149 1.9590690 sector and year
911 Cleaners and helpers 2.1080113 1.3375758 sector and year
265 Creative and performing artists 1.8252102 1.3073089 sector and year
341 Social work and religious associate professionals 2.7179780 1.1525106 sector and year
332 Insurance advisers, sales and purchasing agents 2.4698420 0.8846941 sector and year
515 Building caretakers and related workers 2.0896486 0.8721029 sector and year
251 ICT architects, systems analysts and test managers 2.1070969 0.8453000 sector and year
242 Organisation analysts, policy administrators and human resource specialists 2.3074810 0.7627131 sector and year
213 Biologists, pharmacologists and specialists in agriculture and forestry 2.1515840 0.7217108 sector and year
815 Machine operators, textile, fur and leather products 1.5169216 0.7021796 sector and year
333 Business services agents 2.6770984 0.6948266 sector and year
411 Office assistants and other secretaries 2.4961111 0.6866667 sector and year
261 Legal professionals 2.9024857 0.6474976 sector and year
342 Athletes, fitness instructors and recreational workers 2.0356952 0.5210552 sector and year
541 Other surveillance and security workers 2.1319348 0.4764820 sector and year
941 Fast-food workers, food preparation assistants 2.1030085 0.4107102 sector and year
241 Accountants, financial analysts and fund managers 2.1837720 0.3653365 sector and year
335 Tax and related government associate professionals 2.2476351 0.3329319 sector and year
228 Specialists in health care not elsewhere classified 2.0215985 0.1994037 sector and year
321 Medical and pharmaceutical technicians 2.4986510 0.1694097 sector and year
234 Primary- and pre-school teachers 3.5227087 0.0566620 sector and year
211 Physicists and chemists 2.0509288 0.0256116 sector and year
819 Process control technicians 2.5525388 0.0089722 sector and year
432 Stores and transport clerks 1.9579284 0.0058151 sector and year
331 Financial and accounting associate professionals 2.1471390 0.0023497 sector and year
218 Specialists within environmental and health protection 2.3896946 0.0012880 sector and year
merge(summary_table, anova_table, c("ssyk", "interaction"), all = TRUE) %>%
  filter (term.x == "year_n") %>%
  filter (contcol.y > 1) %>%   
  filter (interaction == "sector, year, age and sex") %>%
  filter (!(contcol.y < 3 & interaction == "sector, year, age and sex")) %>%  
  mutate (estimate = (exp(estimate) - 1) * 100) %>%  
  select (ssyk, estimate, statistic.y, interaction) %>%
  rename (`F-value` = statistic.y) %>%
  rename (`Increase in salary` = estimate) %>%
  arrange (desc (`F-value`)) %>%
  knitr::kable(
    booktabs = TRUE,
    caption = 'Correlation for F-value (sector, year, age and sex) and the yearly increase in salaries')
Table 5: Correlation for F-value (sector, year, age and sex) and the yearly increase in salaries
ssyk Increase in salary F-value interaction
214 Engineering professionals 2.4648855 11.6391393 sector, year, age and sex
342 Athletes, fitness instructors and recreational workers 2.0991670 8.9098726 sector, year, age and sex
216 Architects and surveyors 3.2301466 7.6322806 sector, year, age and sex
228 Specialists in health care not elsewhere classified 1.5176747 4.1043437 sector, year, age and sex
321 Medical and pharmaceutical technicians 2.2641978 3.9184148 sector, year, age and sex
218 Specialists within environmental and health protection 2.4573789 3.6168903 sector, year, age and sex
261 Legal professionals 2.7581752 3.2902539 sector, year, age and sex
235 Teaching professionals not elsewhere classified 2.4011513 3.0277439 sector, year, age and sex
335 Tax and related government associate professionals 2.0292874 2.6128635 sector, year, age and sex
341 Social work and religious associate professionals 2.6319084 2.6004044 sector, year, age and sex
233 Secondary education teachers 3.5273156 2.2615012 sector, year, age and sex
331 Financial and accounting associate professionals 2.4662860 1.9867325 sector, year, age and sex
941 Fast-food workers, food preparation assistants 1.9900178 1.9221016 sector, year, age and sex
512 Cooks and cold-buffet managers 2.5222219 1.9206611 sector, year, age and sex
962 Newspaper distributors, janitors and other service workers 2.6603985 1.8150814 sector, year, age and sex
213 Biologists, pharmacologists and specialists in agriculture and forestry 2.3962841 1.7496638 sector, year, age and sex
911 Cleaners and helpers 2.1197350 1.5815397 sector, year, age and sex
511 Cabin crew, guides and related workers -0.6957497 1.5410098 sector, year, age and sex
211 Physicists and chemists 2.3310509 1.5257771 sector, year, age and sex
333 Business services agents 2.9306066 1.5169994 sector, year, age and sex
819 Process control technicians 2.5394398 1.4148181 sector, year, age and sex
723 Machinery mechanics and fitters 2.9145883 1.2913243 sector, year, age and sex
234 Primary- and pre-school teachers 3.5373214 1.2588294 sector, year, age and sex
533 Health care assistants 2.0561764 1.1641262 sector, year, age and sex
222 Nursing professionals 3.3141175 1.1593790 sector, year, age and sex
515 Building caretakers and related workers 2.3554368 1.0916712 sector, year, age and sex
334 Administrative and specialized secretaries -0.4841162 0.8627072 sector, year, age and sex
264 Authors, journalists and linguists 3.8766371 0.8178463 sector, year, age and sex
541 Other surveillance and security workers 2.1959143 0.8087407 sector, year, age and sex
531 Child care workers and teachers aides 2.4624435 0.6787061 sector, year, age and sex
815 Machine operators, textile, fur and leather products 1.2558500 0.6507638 sector, year, age and sex
242 Organisation analysts, policy administrators and human resource specialists 2.1412580 0.6425880 sector, year, age and sex
411 Office assistants and other secretaries 2.4063713 0.5077368 sector, year, age and sex
432 Stores and transport clerks 2.1618484 0.5005162 sector, year, age and sex
422 Client information clerks 3.3819183 0.4079113 sector, year, age and sex
265 Creative and performing artists 1.7171084 0.4046591 sector, year, age and sex
241 Accountants, financial analysts and fund managers 1.9650332 0.3867492 sector, year, age and sex
311 Physical and engineering science technicians 3.0661705 0.3303477 sector, year, age and sex
611 Market gardeners and crop growers 2.1758845 0.1794678 sector, year, age and sex
351 ICT operations and user support technicians 3.3472478 0.1238188 sector, year, age and sex
332 Insurance advisers, sales and purchasing agents 2.2161856 0.1214610 sector, year, age and sex
251 ICT architects, systems analysts and test managers 2.1371036 0.1080593 sector, year, age and sex
534 Attendants, personal assistants and related workers 2.3576411 0.0748416 sector, year, age and sex
532 Personal care workers in health services 2.6448524 0.0675532 sector, year, age and sex
231 University and higher education teachers 2.5212252 0.0231719 sector, year, age and sex
243 Marketing and public relations professionals 2.1626640 0.0083390 sector, year, age and sex

Let’s check what we have found.

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

Highest F-value sector, Specialists within environmental and health protection

Figure 3: Highest F-value sector, Specialists within environmental and health protection

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

Lowest F-value sector, Cooks and cold-buffet managers

Figure 4: Lowest F-value sector, Cooks and cold-buffet managers

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

Highest F-value interaction sector and gender, Cleaners and helpers

Figure 5: Highest F-value interaction sector and gender, Cleaners and helpers

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

Lowest F-value interaction sector and gender, Cabin crew, guides and related workers

Figure 6: Lowest F-value interaction sector and gender, Cabin crew, guides and related workers

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

Highest F-value interaction sector and age, ICT architects, systems analysts and test managers

Figure 7: Highest F-value interaction sector and age, ICT architects, systems analysts and test managers

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

Lowest F-value interaction sector and age, Market gardeners and crop growers

Figure 8: Lowest F-value interaction sector and age, Market gardeners and crop growers

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

Highest F-value interaction sector and year, Nursing professionals

Figure 9: Highest F-value interaction sector and year, Nursing professionals

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

Lowest F-value interaction sector and year, Specialists within environmental and health protection

Figure 10: Lowest F-value interaction sector and year, Specialists within environmental and health protection

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

Highest F-value interaction sector, age, year and gender, Engineering professionals

Figure 11: Highest F-value interaction sector, age, year and gender, Engineering professionals

## TableGrob (2 x 1) "arrange": 2 grobs
##   z     cells    name           grob
## 1 1 (1-1,1-1) arrange gtable[layout]
## 2 2 (2-2,1-1) arrange gtable[layout]
temp <- tb %>%
  filter(`occuptional  (SSYK 2012)` == "243 Marketing and public relations professionals")
 
model <- lm (log(salary) ~ year_n * poly(age_n, 3) * sector * sex, data = temp) 
 
plot_model(model, type = "pred", terms = c("age_n", "year_n", "sex", "sector"))
## Model has log-transformed response. Back-transforming predictions to original response scale. Standard errors are still on the log-scale.

Lowest F-value interaction sector, age, year and gender, Marketing and public relations professionals

Figure 12: Lowest F-value interaction sector, age, year and gender, Marketing and public relations professionals

## TableGrob (2 x 1) "arrange": 2 grobs
##   z     cells    name           grob
## 1 1 (1-1,1-1) arrange gtable[layout]
## 2 2 (2-2,1-1) arrange gtable[layout]

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.



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers

Sponsors

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)