Exit Models

Author

Sharon & Nir

Published

April 17, 2023

Code
knitr::opts_chunk$set(warning = FALSE, message = FALSE)
Code
library(sjPlot)
library(sjmisc)
library(sjlabelled)
library(lme4)
library(regclass)
library(stargazer)
library(dplyr)
library(tidyr)
library(effects)
library(lavaan)
library(ggplot2)
library(stringr)
library(labelled)
Code
data <- read.csv("data_for_analysis_extended_17.4.csv", header = TRUE)
new_data <- read.csv("new_data.csv", header = TRUE)

A Distribution of Perceptions of Civil Service Exit

Code
data <- read.csv("data_for_analysis_extended_17.4.csv", header = TRUE)
new_data <- read.csv("new_data.csv", header = TRUE)

A Distribution of Perceptions of Civil Service Exit

A Distribution of Perceptions of Influence (Future)

Code
Q5 <- as.data.frame(
  new_data %>%
    group_by(Q5) %>%
    filter(!is.na(Q5))%>%
    summarize(N = n()))

Q5_merged <- 
  Q5 %>%
  mutate(Q5 = case_when(Q5 %in% c("1","2") ~ "1",
                        Q5 %in% "3" ~ "2",
                        Q5 %in% c("4","5") ~ "3"))

Q5_new <- Q5_merged %>% 
  type.convert(as.is=TRUE) %>% 
  group_by(Q5) %>% 
  summarise(N=sum(N, na.rm = TRUE))%>% 
  mutate(freq = N / sum(N))%>% round(2)%>%
  mutate(freq.lab=str_c(100*freq,"%"))


ggplot(Q5_new) +
  geom_bar(aes(x=factor(Q5), y=freq), stat="identity")+
  geom_text(aes(x=factor(Q5), y=freq, label = freq.lab),vjust=-0.3,size=4)+
  scale_x_discrete(labels = c("החלשות והחלשות משמעותית", "ללא שינוי" ,"התחזקות והתחזקות משמעותית"))+
  scale_y_continuous(labels = function(x) paste0(x*100, "%"), limits=c(0,1))+
  theme(
        text = element_text(family="Optima"),
        strip.text = element_text(size=24),
        axis.text = element_text(size =12),
        axis.line = element_line(colour = "black"),
        panel.grid.major = element_blank(),
        panel.grid.minor = element_blank(),
        legend.title=element_blank(),
        legend.text=element_text(size=14),
        legend.position='bottom',
        legend.direction ='horizontal',
        legend.key=element_blank(),
        legend.margin = unit(0.2, "line"),
        legend.key.height=unit(0.6,"line"), 
        plot.title=element_text(size=12,face="bold", hjust = 0.5),
        axis.title.x=element_text(size=24),
        axis.title.y=element_text(size=24))+
  xlab("")+
  ylab("")+
  ggtitle("במבט קדימה על חמש השנים הבאות, באיזו מידה אתה צופה שתהיה התחזקות או החלשות \n ?במידת ההשפעה של הדרג המקצועי ביחידה שלך על מדיניות המשרד בתחום הפעילות של היחידה")

A Distribution of Perceptions of Meritiocracy (Future)

Code
Q11 <- as.data.frame(
  new_data %>%
    group_by(Q11) %>%
    filter(!is.na(Q11))  %>%
    summarize(N = n()))

Q11_merged <- 
  Q11 %>%
  mutate(Q11 = case_when(Q11 %in% c("1","2") ~ "1",
                        Q11 %in% "3" ~ "2",
                        Q11 %in% c("4","5") ~ "3"))

Q11_new <- Q11_merged %>% 
  type.convert(as.is=TRUE) %>% 
  group_by(Q11) %>% 
  summarise(N=sum(N, na.rm = TRUE))%>% 
  mutate(freq = N / sum(N))%>% round(2)%>%
  mutate(freq.lab=str_c(100*freq,"%"))

ggplot(Q11_new) +
  geom_bar(aes(factor(x=Q11), y=freq), stat="identity")+
  geom_text(aes(x=factor(Q11), y=freq, label = freq.lab),vjust=-0.3,size=4)+
  scale_x_discrete(labels = c("שינוי לרעה ושינוי משמעותי לרעה", "ללא שינוי" ,"שינוי לטובה ושינוי משמעותי לטובה"))+
  scale_y_continuous(labels = function(x) paste0(x*100, "%"), limits=c(0,1))+
  theme(strip.text = element_text(size=24),
        axis.text = element_text(size =12),
        axis.line = element_line(colour = "black"),
        panel.grid.major = element_blank(),
        panel.grid.minor = element_blank(),
        legend.title=element_blank(),
        legend.text=element_text(size=20),
        legend.position='bottom',
        legend.direction ='horizontal',
        legend.key=element_blank(),
        legend.margin = unit(0.2, "line"),
        legend.key.height=unit(0.6,"line"), 
        plot.title=element_text(size=12,face="bold", hjust = 0.5),
        axis.title.x=element_text(size=24),
        axis.title.y=element_text(size=24))+
  xlab("")+
  ylab("")+
  ggtitle("במבט קדימה על חמש השנים הבאות, באיזו מידה אתה צופה שיהיה שינוי לטובה\n ?או לרעה במידה שבה קידומים במשרד ייעשו בפועל על בסיס ניסיון רלוונטי, יכולת ועבודה קשה")

Code
t1<-new_data %>% group_by(Q11) %>%
  drop_na(Q11) %>% 
  summarize(n=n())%>%
mutate(freq=(n/sum(n))%>%round(2))%>%
  mutate(freq.lab=str_c(100*freq,"%"))

t1%>%
  #drop_na(trust_in_gov_lab)%>%
  ggplot(aes(x=Q11 %>% as_factor(),y=n))+geom_col(width=0.75,alpha=0.8,fill="dodgerblue2")+
  geom_text(aes(label=freq.lab),colour="gray20",hjust=-0.1,size=3)+
  theme_classic()+
  labs(title=var_label(new_data$Q11) %>% stringr::str_wrap(),x="",y="")+
  coord_flip()  +
  theme_classic()+
  theme(
  plot.title = element_text(hjust = 1),
  plot.subtitle = element_text(hjust = 1),
  plot.caption = element_text(hjust = 0)
  )

Code
ggplot(data = data,aes(Q26))+geom_histogram(binwidth = 1)+
  scale_x_continuous(breaks = 1:5)+
  labs(x="רצון לעזוב את השירות הציבורי לו היתה מוצעת משרה מחוץ לשירות הציבורי בשכר דומה (1 = נכונות נמוכה; 5 = נכונות גבוהה)",
       y = "כמות משיבים")

Omit NA

Code
data_1 <- select(data, c(PAST_INFLUENCE, PAST_MERITOCRATIC,
                         PROJECT_MERITOCRATIC,BACKSLIDING_2,PROJECT_INFLUENCE,
                         INTENT_EXIT_2,position_type,ranking,tenure,ministry,age,gender,religiosity,education))

data_2 <- na.omit(data_1)

Descriptive Statistics

# A tibble: 2 x 2
  gender     N
  <chr>  <int>
1 female   206
2 male     155
# A tibble: 4 x 2
  ranking         N
  <chr>       <int>
1 junior         56
2 middle        180
3 senior        107
4 very senior    18
# A tibble: 5 x 2
  education       N
  <chr>       <int>
1 bachelor       51
2 high-school     3
3 master        274
4 other           6
5 phd            27
# A tibble: 5 x 2
  tenure     N
  <chr>  <int>
1 1-        10
2 1-5      103
3 11-20     91
4 20+       61
5 6-10      96
# A tibble: 4 x 2
  position_type          N
  <chr>              <int>
1 competitive tender   310
2 other                 28
3 replacement           12
4 trust based           11

Models

Code
m1 <- lme4::lmer(INTENT_EXIT_2 ~ 
                   tenure + 
                   position_type + 
                   ranking + 
                   gender + 
                   age + 
                   factor(education)+
                   factor(religiosity) + 
                   (1|ministry), 
                 data_2)


m2 <- lme4::lmer(INTENT_EXIT_2 ~ 
                   BACKSLIDING_2+
                   tenure + 
                   position_type + 
                   ranking + 
                   gender + 
                   age + 
                   factor(education)+
                   factor(religiosity) + 
                   (1|ministry), 
                 data_2)

m3 <- lme4::lmer(INTENT_EXIT_2 ~ 
                   PROJECT_INFLUENCE + 
                   PAST_INFLUENCE+
                   tenure + 
                   position_type + 
                   ranking + 
                   gender + 
                   age + 
                   factor(education)+
                   factor(religiosity) + 
                   (1|ministry), 
                 data_2)

m4 <- lme4::lmer(INTENT_EXIT_2 ~ 
                   PROJECT_MERITOCRATIC +
                   PAST_MERITOCRATIC + 
                   tenure + 
                   position_type + 
                   ranking + 
                   gender + 
                   age + 
                   factor(education)+
                   factor(religiosity) + 
                   (1|ministry), 
                 data_2)

m5 <- lme4::lmer(INTENT_EXIT_2 ~ 
                   PROJECT_INFLUENCE + 
                   PROJECT_MERITOCRATIC +
                   PAST_MERITOCRATIC + 
                   PAST_INFLUENCE+
                   tenure + 
                   position_type + 
                   ranking + 
                   gender + 
                   age + 
                   factor(education)+
                   factor(religiosity) + 
                   (1|ministry), 
                 data_2)

m6 <- lme4::lmer(INTENT_EXIT_2 ~ 
                   BACKSLIDING_2+
                   PROJECT_INFLUENCE + 
                   PROJECT_MERITOCRATIC+ 
                   PAST_INFLUENCE  + 
                   PAST_MERITOCRATIC + 
                   tenure + 
                   position_type + 
                   ranking + 
                   gender + 
                   age + 
                   factor(education)+
                   factor(religiosity) + 
                   (1|ministry), 
                 data_2)

m7 <- lme4::lmer(INTENT_EXIT_2 ~ 
                   BACKSLIDING_2+
                   PROJECT_MERITOCRATIC+ 
                   PAST_MERITOCRATIC + 
                   tenure + 
                   position_type + 
                   ranking + 
                   gender + 
                   age + 
                   factor(education)+
                   factor(religiosity) + 
                   (1|ministry), 
                 data_2)


#Predictions from model 6
data_2$religiosity <- as.factor(data_2$religiosity)
data_2$education <- as.factor(data_2$education)
m6 <- lme4::lmer(INTENT_EXIT_2 ~ 
                   BACKSLIDING_2+
                   PROJECT_INFLUENCE + 
                   PROJECT_MERITOCRATIC+ 
                   PAST_INFLUENCE  + 
                   PAST_MERITOCRATIC + 
                   tenure + 
                   position_type + 
                   ranking + 
                   gender + 
                   age + 
                   education+
                   religiosity + 
                   (1|ministry), 
                 data_2)

Plot intention to leave

Code
predict <- as.data.frame(effect("BACKSLIDING_2",m6))
predict <- rename(predict,Intention_to_leave ="fit")
predict <- rename(predict,democratic_backsliding ="BACKSLIDING_2")

ggplot(data=predict, aes(x=democratic_backsliding, y=Intention_to_leave))+
  geom_pointrange(aes(ymin=Intention_to_leave-se, ymax=Intention_to_leave+se))+
  scale_x_continuous(breaks = c(0,0.2, 0.5, 0.8,1))

Plot intention to leave

Code
predict <- as.data.frame(effect("PROJECT_MERITOCRATIC",m6))
predict <- rename(predict,Intention_to_leave ="fit")
predict <- rename(predict,expectation_of_future_meritocracy ="PROJECT_MERITOCRATIC")

ggplot(data=predict, aes(x=expectation_of_future_meritocracy, y=Intention_to_leave))+
  geom_pointrange(aes(ymin=Intention_to_leave-se, ymax=Intention_to_leave+se))+
  scale_x_continuous(breaks = c(0,0.2, 0.5, 0.8,1))

Regression table of all 7 models as html

#FE modelling without demographics and ministry affilliations (including regression table as html)