The significance of the sector 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 sector has a significant impact on the salary of engineers. Is the significance of the sector unique to engineers or are there similar correlations in other occupational groups?

Statistics Sweden use NUTS (Nomenclature des Unités Territoriales Statistiques), which is the EU’s hierarchical regional division, to specify the regions.

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 (swemaps) # devtools::install_github('reinholdsson/swemaps')
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
## #refugeeswelcome
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))
}
nuts <-read_csv ("nuts.csv", col_types = cols(), locale = readr::locale (encoding = "latin1"), na = c("..", "NA")) %>%
  mutate(NUTS2_sh = substr(NUTS2, 1, 4))
## Warning: Missing column names filled in: 'X1' [1]
nuts %>% 
  distinct (NUTS2_en) %>%
  knitr::kable(
    booktabs = TRUE,
    caption = 'Nomenclature des Unités Territoriales Statistiques (NUTS)')
Table 1: Nomenclature des Unités Territoriales Statistiques (NUTS)
NUTS2_en
SE11 Stockholm
SE12 East-Central Sweden
SE21 Småland and islands
SE22 South Sweden
SE23 West Sweden
SE31 North-Central Sweden
SE32 Central Norrland
SE33 Upper Norrland
map_ln_n <- map_ln %>%
  mutate(lnkod_n = as.numeric(lnkod)) 

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

I have renamed the file to 000000CG_sector.csv because the filename 000000CG.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 region, sector, occupational group (SSYK 2012) and sex. Year 2014 – 2018 Monthly salary 1-3 public sector 4-5 private sector

Only 17 occupational groups have employees in both the public and the private sector in all regions and both genders.

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 ("000000CG_sector.csv") %>%
  left_join(nuts %>% distinct (NUTS2_en, NUTS2_sh), by = c("region" = "NUTS2_en")) 
  
tb_map <- readfile ("000000CG_sector.csv") %>%
  left_join(nuts, by = c("region" = "NUTS2_en")) %>%  
  right_join(map_ln_n, by = c("Länskod" = "lnkod_n"))


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] > 150){
    model <- lm(log(salary) ~ region + 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) ~ region + sex + year_n * sector, 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) ~ region + year_n + sex * sector, data = temp)
    summary_table <- rbind (summary_table, mutate (tidy (summary (model)), ssyk = i, interaction = "sex and sector"))
    anova_table <- rbind (anova_table, mutate (tidy (Anova (model, type = 2)), ssyk = i, interaction = "sex and sector"))   
    
    model <- lm(log(salary) ~ region * sector + year_n + sex, data = temp)
    summary_table <- rbind (summary_table, mutate (tidy (summary (model)), ssyk = i, interaction = "region and sector"))
    anova_table <- rbind (anova_table, mutate (tidy (Anova (model, type = 2)), ssyk = i, interaction = "region and sector"))
    
    model <- lm(log(salary) ~ region * sector * year_n * sex, data = temp)
    summary_table <- rbind (summary_table, mutate (tidy (summary (model)), ssyk = i, interaction = "region, sector, year and sex"))
    anova_table <- rbind (anova_table, mutate (tidy (Anova (model, type = 2)), ssyk = i, interaction = "region, sector, year and sex"))    
  }
}
## 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 region, sector, year and sex
  filter (!(contcol.y < 3 & interaction == "region, sector, year 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, region, 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, region, 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 2: Correlation for F-value (sector) and the yearly increase in salaries
ssykIncrease in salaryF-valueinteraction
962 Newspaper distributors, janitors and other service workers2.109153606.2792907none
331 Financial and accounting associate professionals1.994107429.7668310none
411 Office assistants and other secretaries2.237594350.7420490none
251 ICT architects, systems analysts and test managers2.316554337.4390522none
241 Accountants, financial analysts and fund managers2.142349325.6103179none
321 Medical and pharmaceutical technicians2.609024160.8870308none
242 Organisation analysts, policy administrators and human resource specialists2.064925160.8111547none
351 ICT operations and user support technicians2.310435121.7693426none
214 Engineering professionals2.57558487.3548855none
541 Other surveillance and security workers2.39183967.5617978none
432 Stores and transport clerks1.54157262.6562426none
534 Attendants, personal assistants and related workers1.85052340.6132964none
911 Cleaners and helpers2.08775328.9529104none
311 Physical and engineering science technicians2.74346823.7179785none
422 Client information clerks2.5499899.7604793none
941 Fast-food workers, food preparation assistants2.1443534.3115207none
332 Insurance advisers, sales and purchasing agents2.2287460.9809486none
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 3: Correlation for F-value (sector and year) and the yearly increase in salaries
ssykIncrease in salaryF-valueinteraction
422 Client information clerks3.43351633.8973413sector and year
534 Attendants, personal assistants and related workers2.30715529.5467642sector and year
351 ICT operations and user support technicians3.10510415.0659029sector and year
214 Engineering professionals3.20741413.0526621sector and year
962 Newspaper distributors, janitors and other service workers2.5160749.1796329sector and year
311 Physical and engineering science technicians3.0069412.5233548sector and year
332 Insurance advisers, sales and purchasing agents2.5745382.3362535sector and year
321 Medical and pharmaceutical technicians2.2746182.1961501sector and year
411 Office assistants and other secretaries2.4518361.8814544sector and year
241 Accountants, financial analysts and fund managers2.3735360.7836435sector and year
432 Stores and transport clerks1.3466730.7147906sector and year
251 ICT architects, systems analysts and test managers2.4196510.4459847sector and year
541 Other surveillance and security workers2.3317940.1848832sector and year
242 Organisation analysts, policy administrators and human resource specialists2.1942000.1846190sector and year
911 Cleaners and helpers2.0223340.1743591sector and year
941 Fast-food workers, food preparation assistants2.1615040.0068543sector and year
331 Financial and accounting associate professionals1.9691490.0050259sector and year
merge(summary_table, anova_table, c("ssyk", "interaction"), all = TRUE) %>%
  filter (term.x == "year_n") %>%
  filter (contcol.y > 0) %>%   
  filter (interaction == "sex and sector") %>%
  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 (sex and sector) and the yearly increase in salaries')
Table 4: Correlation for F-value (sex and sector) and the yearly increase in salaries
ssykIncrease in salaryF-valueinteraction
241 Accountants, financial analysts and fund managers2.13341079.736907sex and sector
332 Insurance advisers, sales and purchasing agents2.22874675.904108sex and sector
911 Cleaners and helpers2.08775368.455216sex and sector
331 Financial and accounting associate professionals1.99410767.051008sex and sector
351 ICT operations and user support technicians2.27905238.608554sex and sector
321 Medical and pharmaceutical technicians2.59231230.583657sex and sector
941 Fast-food workers, food preparation assistants2.14435322.396698sex and sector
541 Other surveillance and security workers2.38347116.198924sex and sector
242 Organisation analysts, policy administrators and human resource specialists2.08350815.156166sex and sector
432 Stores and transport clerks1.54157213.144544sex and sector
534 Attendants, personal assistants and related workers1.85052311.478531sex and sector
251 ICT architects, systems analysts and test managers2.3165549.349359sex and sector
411 Office assistants and other secretaries2.2349483.109736sex and sector
962 Newspaper distributors, janitors and other service workers2.1091532.668667sex and sector
311 Physical and engineering science technicians2.7434682.370694sex and sector
214 Engineering professionals2.5755841.834672sex and sector
422 Client information clerks2.5499891.337874sex and sector
merge(summary_table, anova_table, c("ssyk", "interaction"), all = TRUE) %>%
  filter (term.x == "year_n") %>%
  filter (contcol.y > 0) %>%   
  filter (interaction == "region and sector") %>%
  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 (region and sector) and the yearly increase in salaries')
Table 5: Correlation for F-value (region and sector) and the yearly increase in salaries
ssykIncrease in salaryF-valueinteraction
432 Stores and transport clerks1.54157216.7817739region and sector
251 ICT architects, systems analysts and test managers2.31655415.6603633region and sector
242 Organisation analysts, policy administrators and human resource specialists1.98716714.5447961region and sector
214 Engineering professionals2.57558410.9929801region and sector
321 Medical and pharmaceutical technicians2.6359869.9897434region and sector
331 Financial and accounting associate professionals1.9941079.9608534region and sector
332 Insurance advisers, sales and purchasing agents2.2287468.3539434region and sector
411 Office assistants and other secretaries2.2380725.7558819region and sector
241 Accountants, financial analysts and fund managers2.1433905.6578803region and sector
541 Other surveillance and security workers2.3763114.6423707region and sector
351 ICT operations and user support technicians2.3075313.8460603region and sector
311 Physical and engineering science technicians2.7370613.5329715region and sector
534 Attendants, personal assistants and related workers1.8505233.0881293region and sector
422 Client information clerks2.5499892.2991877region and sector
911 Cleaners and helpers2.0877531.4424330region and sector
962 Newspaper distributors, janitors and other service workers2.1091531.3179558region and sector
941 Fast-food workers, food preparation assistants2.1552410.8264589region and sector
merge(summary_table, anova_table, c("ssyk", "interaction"), all = TRUE) %>%
  filter (term.x == "year_n") %>%
  filter (contcol.y > 1) %>%   
  filter (interaction == "region and sector") %>%
  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 (region, year and sex) and the yearly increase in salaries')
Table 6: Correlation for F-value (region, year and sex) and the yearly increase in salaries
ssykIncrease in salaryF-valueinteraction
merge(summary_table, anova_table, c("ssyk", "interaction"), all = TRUE) %>%
  filter (term.x == "year_n") %>%
  filter (contcol.y > 1) %>%   
  filter (interaction == "region, sector, year and sex") %>%
  filter (!(contcol.y < 3 & interaction == "region, sector, year 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 (region, year and sex) and the yearly increase in salaries')
Table 7: Correlation for F-value (region, year and sex) and the yearly increase in salaries
ssykIncrease in salaryF-valueinteraction
351 ICT operations and user support technicians5.2183262.7426159region, sector, year and sex
411 Office assistants and other secretaries2.2763192.6593769region, sector, year and sex
331 Financial and accounting associate professionals1.6293542.4639758region, sector, year and sex
941 Fast-food workers, food preparation assistants2.3646532.2289954region, sector, year and sex
251 ICT architects, systems analysts and test managers2.6297732.2261226region, sector, year and sex
332 Insurance advisers, sales and purchasing agents2.0368912.0868544region, sector, year and sex
242 Organisation analysts, policy administrators and human resource specialists1.8675321.8789097region, sector, year and sex
541 Other surveillance and security workers2.1470191.7672297region, sector, year and sex
911 Cleaners and helpers2.2708521.6781257region, sector, year and sex
321 Medical and pharmaceutical technicians2.5943890.9665480region, sector, year and sex
241 Accountants, financial analysts and fund managers2.0286980.7221792region, sector, year and sex
432 Stores and transport clerks1.0674570.6784005region, sector, year and sex
962 Newspaper distributors, janitors and other service workers2.8854360.5793881region, sector, year and sex
214 Engineering professionals3.1695260.4994580region, sector, year and sex
311 Physical and engineering science technicians2.0711110.4768272region, sector, year and sex
534 Attendants, personal assistants and related workers2.3490010.3542025region, sector, year and sex
422 Client information clerks2.4895420.2528065region, sector, year and sex

Let’s check what we have found.

temp <- tb %>%
  filter(`occuptional  (SSYK 2012)` == "962 Newspaper distributors, janitors and other service workers")
 
model <-lm (log(salary) ~ year_n + sex + NUTS2_sh + sector, data = temp) 
 
plot_model(model, type = "pred", terms = c("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, Newspaper distributors, janitors and other service workers

Figure 3: Highest F-value sector, Newspaper distributors, janitors and other service workers

tb_map %>%
    filter(`occuptional  (SSYK 2012)` == "962 Newspaper distributors, janitors and other service workers") %>%
  ggplot() +
    geom_polygon(mapping = aes(x = ggplot_long, y = ggplot_lat, group = lnkod, fill = salary)) +
      facet_grid(. ~ sector) + 
    coord_equal() 

Highest F-value sector, Newspaper distributors, janitors and other service workers

Figure 4: Highest F-value sector, Newspaper distributors, janitors and other service workers

temp <- tb %>%
  filter(`occuptional  (SSYK 2012)` == "332 Insurance advisers, sales and purchasing agents")
 
model <-lm (log(salary) ~ year_n + sex + NUTS2_sh + sector, data = temp) 
 
plot_model(model, type = "pred", terms = c("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, Insurance advisers, sales and purchasing agents

Figure 5: Lowest F-value sector, Insurance advisers, sales and purchasing agents

temp <- tb %>%
  filter(`occuptional  (SSYK 2012)` == "241 Accountants, financial analysts and fund managers")
 
model <-lm (log(salary) ~ year_n + sex * sector + NUTS2_sh, data = temp) 
 
plot_model(model, type = "pred", terms = c("sector", "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 gender and sector, Accountants, financial analysts and fund managers

Figure 6: Highest F-value interaction gender and sector, Accountants, financial analysts and fund managers

tb_map %>%
    filter(`occuptional  (SSYK 2012)` == "241 Accountants, financial analysts and fund managers") %>%
  filter (sector == "1-3 public sector") %>%
  ggplot() +
    geom_polygon(mapping = aes(x = ggplot_long, y = ggplot_lat, group = lnkod, fill = salary)) +
      facet_grid(. ~ sex) + 
    coord_equal() 

Highest F-value interaction gender and sector, Accountants, financial analysts and fund managers

Figure 7: Highest F-value interaction gender and sector, Accountants, financial analysts and fund managers

tb_map %>%
    filter(`occuptional  (SSYK 2012)` == "241 Accountants, financial analysts and fund managers") %>%
  filter (sector == "4-5 private sector") %>%  
  ggplot() +
    geom_polygon(mapping = aes(x = ggplot_long, y = ggplot_lat, group = lnkod, fill = salary)) +
      facet_grid(. ~ sex) + 
    coord_equal() 

Highest F-value interaction gender and sector, Accountants, financial analysts and fund managers

Figure 8: Highest F-value interaction gender and sector, Accountants, financial analysts and fund managers

temp <- tb %>%
  filter(`occuptional  (SSYK 2012)` == "422 Client information clerks")
 
model <-lm (log(salary) ~ year_n + sex * sector + NUTS2_sh, data = temp) 
 
plot_model(model, type = "pred", terms = c("sector", "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 gender and sector, Client information clerks

Figure 9: Lowest F-value interaction gender and sector, Client information clerks

temp <- tb %>%
  filter(`occuptional  (SSYK 2012)` == "422 Client information clerks")
 
model <-lm (log(salary) ~ year_n * sector + NUTS2_sh + sex , data = temp) 
 
plot_model(model, type = "pred", terms = c("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 year and sector, Client information clerks

Figure 10: Highest F-value interaction year and sector, Client information clerks

tb_map %>%
  filter(`occuptional  (SSYK 2012)` == "422 Client information clerks") %>%
  filter (sector == "1-3 public sector") %>%  
  ggplot() +
    geom_polygon(mapping = aes(x = ggplot_long, y = ggplot_lat, group = lnkod, fill = salary)) +
      facet_grid(. ~ year) + 
    coord_equal() 

Highest F-value interaction year and sector, Client information clerks

Figure 11: Highest F-value interaction year and sector, Client information clerks

tb_map %>%
  filter(`occuptional  (SSYK 2012)` == "422 Client information clerks") %>%
  filter (sector == "4-5 private sector") %>%  
  ggplot() +
    geom_polygon(mapping = aes(x = ggplot_long, y = ggplot_lat, group = lnkod, fill = salary)) +
      facet_grid(. ~ year) + 
    coord_equal() 

Highest F-value interaction year and sector, Client information clerks

Figure 12: Highest F-value interaction year and sector, Client information clerks

temp <- tb %>%
  filter(`occuptional  (SSYK 2012)` == "331 Financial and accounting associate professionals")
 
model <-lm (log(salary) ~ year_n * sector + NUTS2_sh + sex , data = temp) 
 
plot_model(model, type = "pred", terms = c("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 year and sector, Financial and accounting associate professionals

Figure 13: Lowest F-value interaction year and sector, Financial and accounting associate professionals

temp <- tb %>%
  filter(`occuptional  (SSYK 2012)` == "432 Stores and transport clerks")
 
model <-lm (log(salary) ~ year_n + sector * NUTS2_sh + sex , data = temp) 
 
plot_model(model, type = "pred", terms = c("NUTS2_sh", "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 region and sector, Stores and transport clerks

Figure 14: Highest F-value interaction region and sector, Stores and transport clerks

tb_map %>%
  filter(`occuptional  (SSYK 2012)` == "432 Stores and transport clerks") %>%
  ggplot() +
    geom_polygon(mapping = aes(x = ggplot_long, y = ggplot_lat, group = lnkod, fill = salary)) +
      facet_grid(. ~ sector) + 
    coord_equal() 

Highest F-value interaction region and sector, Stores and transport clerks

Figure 15: Highest F-value interaction region and sector, Stores and transport clerks

temp <- tb %>%
  filter(`occuptional  (SSYK 2012)` == "941 Fast-food workers, food preparation assistants")
 
model <-lm (log(salary) ~ year_n + sector * NUTS2_sh + sex , data = temp) 
 
plot_model(model, type = "pred", terms = c("NUTS2_sh", "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 region, Fast-food workers, food preparation assistants

Figure 16: Lowest F-value interaction sector and region, Fast-food workers, food preparation assistants

temp <- tb %>%
  filter(`occuptional  (SSYK 2012)` == "351 ICT operations and user support technicians")
 
model <-lm (log(salary) ~ year_n * NUTS2_sh * sex * sector, data = temp) 
 
plot_model(model, type = "pred", terms = c("NUTS2_sh", "year_n", "sector",  "sex"))
## Model has log-transformed response. Back-transforming predictions to original response scale. Standard errors are still on the log-scale.
## Warning: Package `see` needed to plot multiple panels in one integrated figure.
## Please install it by typing `install.packages("see", dependencies = TRUE)` into
## the console.
## [[1]]

Highest F-value interaction sector, region, year and gender, ICT operations and user support technicians

Figure 17: Highest F-value interaction sector, region, year and gender, ICT operations and user support technicians

## 
## [[2]]

Highest F-value interaction sector, region, year and gender, ICT operations and user support technicians

Figure 18: Highest F-value interaction sector, region, year and gender, ICT operations and user support technicians

tb_map %>%
  filter(`occuptional  (SSYK 2012)` == "351 ICT operations and user support technicians") %>%
  filter (sector == "1-3 public sector") %>%
  ggplot() +
    geom_polygon(mapping = aes(x = ggplot_long, y = ggplot_lat, group = lnkod, fill = salary)) +
      facet_grid(. ~ year) + 
    coord_equal() 

Highest F-value interaction sector, region, year and gender, ICT operations and user support technicians

Figure 19: Highest F-value interaction sector, region, year and gender, ICT operations and user support technicians

tb_map %>%
    filter(`occuptional  (SSYK 2012)` == "351 ICT operations and user support technicians") %>%
  filter (sector == "4-5 private sector") %>%  
  ggplot() +
    geom_polygon(mapping = aes(x = ggplot_long, y = ggplot_lat, group = lnkod, fill = salary)) +
      facet_grid(. ~ year) + 
    coord_equal() 

Highest F-value interaction sector, region, year and gender, ICT operations and user support technicians

Figure 20: Highest F-value interaction sector, region, year and gender, ICT operations and user support technicians

  temp <- tb %>%
  filter(`occuptional  (SSYK 2012)` == "422 Client information clerks")
 
model <-lm (log(salary) ~ year_n * NUTS2_sh * sex * sector, data = temp) 
 
plot_model(model, type = "pred", terms = c("NUTS2_sh", "year_n", "sector",  "sex"))
## Model has log-transformed response. Back-transforming predictions to original response scale. Standard errors are still on the log-scale.
## Warning: Package `see` needed to plot multiple panels in one integrated figure.
## Please install it by typing `install.packages("see", dependencies = TRUE)` into
## the console.
## [[1]]

Lowest F-value interaction sector, region, year and gender, Client information clerks

Figure 21: Lowest F-value interaction sector, region, year and gender, Client information clerks

## 
## [[2]]

Lowest F-value interaction sector, region, year and gender, Client information clerks

Figure 22: Lowest F-value interaction sector, region, year and gender, Client information clerks

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)