library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
## ✓ ggplot2 3.3.5     ✓ purrr   0.3.4
## ✓ tibble  3.1.6     ✓ dplyr   1.0.7
## ✓ tidyr   1.1.4     ✓ stringr 1.4.0
## ✓ readr   2.1.1     ✓ forcats 0.5.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
library(writexl) # export excel
library(haven) # read sav
library(labelled) # variable label
library(rmarkdown) # html table
library(naniar) # missing data
library(mice) # fill missing data
## 
## Attaching package: 'mice'
## The following object is masked from 'package:stats':
## 
##     filter
## The following objects are masked from 'package:base':
## 
##     cbind, rbind
library(plm) # panel regression
## 
## Attaching package: 'plm'
## The following objects are masked from 'package:dplyr':
## 
##     between, lag, lead
library(lmtest) # homoskedasticity
## Loading required package: zoo
## 
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
## 
##     as.Date, as.Date.numeric
library(tseries)
## Registered S3 method overwritten by 'quantmod':
##   method            from
##   as.zoo.data.frame zoo

1. Import và reshape ban đầu dữ liệu

1.1. Đọc dữ liệu từ file csv và sav

dat <- read.csv("ENTCo.csv")

var.label <- read_sav("ENTCo.sav") %>%
  var_label(unlist = T) %>%
  data.frame(var = names(dat), label = .)
rownames(var.label) <- NULL

var_label(dat) <- var_label(read_sav("ENTCo.sav"))

test <- head(dat)

paged_table(var.label)

1.2. Reshape data với các biến câu hỏi

Bọn em dự định reshape lại bộ dữ liệu thành dạng panel data với N = 499 trong 4 giai đoạn (T = 4)

Trước tiên bọn em tách các biến ra thành 2 phần là các biến câu hỏi (có chữ q ở đầu tên biến) và những biến khác trong file csv để thực hiện reshape theo 2 cách khác nhau ạ.

dat_reshape1 <- dat %>% 
  mutate(id = as.numeric(rownames(.)), .before = 1) %>%
  select(
    id, 
    grep("CollectorNm", names(.)),
    grep("respondent_id", names(.)),
    grep("collector_id", names(.)),
    grep("date_created", names(.)),
    grep("date_modified", names(.)),
    grep("ip_address", names(.)),
    grep("email_address", names(.)),
    grep("first_name", names(.)),
    grep("last_name", names(.)),
    grep("custom_1", names(.)),
    grep("q", names(.))
  ) %>%
  rename(q0093_Tasks.S1 = q0093.S1_Tasks.S1) %>%
  rename(q0107_0001.S2 = q0107_0001.S) %>%
  rename(
    q0114_0002i.S1 = q0114_0002.S1i,
    q0114_0003i.S1 = q0114_0003.S1i
  ) %>%
  gather(key, value, -id) %>%
  arrange(key) %>%
  mutate(key = case_when(
    grepl(".S", key) == F ~ paste(key, ".S0", sep =""),
    TRUE ~ key
  )) %>%
  separate(key, into = c("key", "stage"), sep = ".S", convert = T) %>%
  spread(key, value, convert = T) %>%
  relocate(id, respondent_id) %>%
  arrange(id, stage)
## Warning: attributes are not identical across measure variables;
## they will be dropped

1.3. Reshape data với các biến còn lại

unuse_var <- c(
  # "q0093.S1_Tasks.S1",
  "Burnout.chg.S1.S0",
  "Changes.chg.S1.S0",
  "Chg.Harmonie",
  "Code_region",
  "coef_vari",
  "coef_volatil",
  "Coping.Avoid.S1.S0",
  "Coping.Emo.S1.S0",
  "Coping.Task.S1.S0",
  "Couple",
  # "email_address",
  "Ethnie",
  "Genre",
  "Hybrid",
  "Immigrant",
  "Innovation",
  "Oppt",
  "piege_burnout_WB",
  "Piege_CA.S0.S1_cat",
  "Piege_date_naissance_cat",
  "piege_defi_CTF",
  "Piege_Empl.S0.S1_ampleur",
  "Piege_Empl.S0.S1_ampleur_cat",
  "piege_fatigue",
  "piege_heures",
  "Piege_nb_enfants_cat",
  "piege_oppt_vente",
  "piege_optim_CA",
  "piege_optim_profit",
  "piege_optim_reuss",
  "Piege_secteur_cat",
  "piege_ventes_CA",
  "Proactive",
  "Psy_Deta",
  "PsyCap_Hope",
  "PsyCap_M",
  "PsyCap_Optim",
  "PsyCap_Resil",
  "PsyCap_SelfEff",
  "Rel.Chg.Coping.Avoid",
  "Rel.Chg.Coping.Emo",
  "Rel.Chg.Coping.Task",
  "Resilience.chg.S1.S0",
  "Resources",
  "Resources_IntraOrg",
  "Resources_IntraOrg.chg.S1.S0",
  "Resources_Relation.chg.S1.S0",
  "Resources.chg.S1.S0",
  "Sleep.chg.S1.S0",
  "Somme_err",
  "Stress.chg.S1.S0",
  "SUM.Abs.erreurs",
  "Tasks.chg.S1.S0",
  "Team",
  "Techno_Avant_Apres",
  "Temps_completion_S0",
  "Temps_completion_S0_cat",
  "Temps_completion_S1",
  "Temps_completion_S1_cat",
  "tendance_moy",
  "Wellbeing.chg.S1.S0"
)
dat_reshape2 <- dat %>% 
  mutate(id = as.numeric(rownames(.)), .before = 1) %>%
  select(
    - grep("CollectorNm", names(.)),
    - grep("respondent_id", names(.)),
    - grep("collector_id", names(.)),
    - grep("date_created", names(.)),
    - grep("date_modified", names(.)),
    - grep("ip_address", names(.)),
    - grep("email_address", names(.)),
    - grep("first_name", names(.)),
    - grep("last_name", names(.)),
    - grep("custom_1", names(.)),
    -grep("q", names(.)),
  ) %>%
  gather(key, value, -id, -unuse_var) %>%
  arrange(key) %>%
  mutate(key = case_when(
    grepl(".S", key) == F ~ paste(key, ".S0", sep =""),
    TRUE ~ key
  )) %>%
  separate(key, into = c("key", "stage"), sep = ".S", convert = T) %>%
  spread(key, value, convert = T) %>%
  relocate(id, stage) %>%
  arrange(id, stage)
## Note: Using an external vector in selections is ambiguous.
## ℹ Use `all_of(unuse_var)` instead of `unuse_var` to silence this message.
## ℹ See <https://tidyselect.r-lib.org/reference/faq-external-vector.html>.
## This message is displayed once per session.
## Warning: attributes are not identical across measure variables;
## they will be dropped
## Warning: Expected 2 pieces. Additional pieces discarded in 499 rows [33933,
## 33934, 33935, 33936, 33937, 33938, 33939, 33940, 33941, 33942, 33943, 33944,
## 33945, 33946, 33947, 33948, 33949, 33950, 33951, 33952, ...].

1.4. Merge 2 bộ số liệu

Sau khi đã reshape, bọn em tiến hành merge 2 bộ số liệu lại ạ. Kết quả về bộ số liệu đã reshape thành dạng panel như bên dưới ạ.

dat_reshaped <- dat_reshape1 %>% 
  left_join(dat_reshape2)
## Joining, by = c("id", "stage")
paged_table(head(dat_reshaped, n = 10))

2. Nhân tố

Các nhân tố được sử dụng trong mô hình hồi quy phân tích các nhân tố tác động đến Career Commitment

=> Với mô hình theo ảnh bên dưới này cần phải thực hiện nhiều mô hình hồi quy nhỏ lẻ nên bọn em quyết định tách các biến có trong mô hình này ra từ bộ dữ liệu gốc (đã reshape ở bên trên) thành bộ dữ liệu reg_dat có các biến trong mô hình.

Mô hình nghiên cứu

2.1. Career shock

  1. Career shock có thể được đo lường bởi q0084, hoặc q0085, hoặc q0084*q0085, hoặc q0084*q0093;

(q0084) Since last June, how much has your business environment changed? (Curseur de 0-No change to 10-Complete and radical change)

(q0085) Since last June, are the changes in your business environment primarily threats or opportunities for your business? (curseur de -10 à +10, avec -10-Big threats à + 10-Big opportunities, 0=Threats equal opportunities)

(q0093) Since last June, have the changes you have had to make in your business been difficult or easy to implement? (scale of -5 to +5, with -5-Changes very difficult to implement to +5-Changes very easy to implement, 0=Neither difficult nor easy)

career_shock <- dat_reshaped %>% 
  select(id, stage, q0084, q0085, q0093) %>%
  mutate(
    q0084 = scale(q0084),
    q0084 = scale(q0085),
    q0093 = scale(q0093)
  ) %>% 
  mutate(q0084xq0085 = q0084*q0085) %>%
  mutate(q0084xq0093 = q0084*q0093) %>%
  select(-q0093)
paged_table(head(career_shock, n = 10))

2.2. Increased Workload

Increased Workload là số bình quân của q0086, q0087, q0088, q0089, q0090

(q0086) Since last June, how different were your sales compared to the same period in 2019? (Curseur : 10-point scale, from -5-Significant decrease in sales to +5-Significant increase in sales, 0=Same sales)

Since last June, what is the level of change on the following aspects of your business? (q0087) Clientele: 10-point scale, from 0-Clientele remains unchanged, to 10-Clientele completely new (q0088) Products/services: 10-point scale, from 0-No changes to products/services to 10- Completely new products/services (q0089) Procurement from suppliers: 10-point scale, from 0-No changes in procurement to 10-Major changes in procurement (q0090) Work organization: 10-point scale, from 0-No changes to work organization to 10-Completely different work organization

increased_workload <- dat_reshaped %>% 
  select(id, stage, q0086, q0087, q0088, q0089, q0090) %>%
  mutate(
    q0086 = scale(q0086),
    q0086 = scale(q0087),
    q0086 = scale(q0088),
    q0086 = scale(q0089),
    q0086 = scale(q0090)
  ) %>% 
  mutate(increased_workload = (q0086 + q0087 + q0088 + q0089 + q0090) / 5, .keep = "unused")
 paged_table(head(increased_workload, n = 10))

2.3. Stress, Burnout và Career commitment

StressBurnout có sẵn trong bộ số liệu

Career commitment bọn em chưa tìm được từ tài liệu thầy gửi về lý giải cách tích chi tiết của biến này nên bọn em theo bọn em hiểu (có thể sai sót) rằng công thức để tính toán cho biến này là:

  1. q0035 \(\times\) q0102: nếu người trả lời là nhân viên làm công tại các doanh nghiệp

  2. q0103: nếu người trả lời là doanh nhân

reg_dat <- dat_reshaped %>% 
  select(id, stage, Stress, Burnout, q0101, q0035, q0102, q0103) %>% 
  mutate(
    commit = case_when(
      (q0101 == 1) ~ (q0035*q0102),
      (q0101 == 2 | q0101 == 3) ~ (q0103)
    ), 
    .keep = "unused"
  ) %>% 
  left_join(increased_workload) %>%
  left_join(
    select(
      career_shock, 
      id, 
      stage,
      q0084xq0093
    )
  ) %>% 
  rename(
    career_shock = q0084xq0093
  ) %>% 
  mutate(
    career_shock = as.numeric(career_shock),
    increased_workload = as.numeric(increased_workload)
  )
## Joining, by = c("id", "stage")
## Joining, by = c("id", "stage")
paged_table(head(reg_dat, n = 10))

3. Missing Data và Outliers

3.1. Missing Data

Điền missing data ở biến career_shockincreased_workload bằng thuật toán decision tree

reg_dat %>%
  gg_miss_var()
## Warning: It is deprecated to specify `guide = FALSE` to remove a guide. Please
## use `guide = "none"` instead.

fill_miss <- reg_dat %>% 
  select(id, stage, career_shock, increased_workload) %>% 
  mice(method = "cart") %>% 
  complete()
## 
##  iter imp variable
##   1   1  career_shock  increased_workload
##   1   2  career_shock  increased_workload
##   1   3  career_shock  increased_workload
##   1   4  career_shock  increased_workload
##   1   5  career_shock  increased_workload
##   2   1  career_shock  increased_workload
##   2   2  career_shock  increased_workload
##   2   3  career_shock  increased_workload
##   2   4  career_shock  increased_workload
##   2   5  career_shock  increased_workload
##   3   1  career_shock  increased_workload
##   3   2  career_shock  increased_workload
##   3   3  career_shock  increased_workload
##   3   4  career_shock  increased_workload
##   3   5  career_shock  increased_workload
##   4   1  career_shock  increased_workload
##   4   2  career_shock  increased_workload
##   4   3  career_shock  increased_workload
##   4   4  career_shock  increased_workload
##   4   5  career_shock  increased_workload
##   5   1  career_shock  increased_workload
##   5   2  career_shock  increased_workload
##   5   3  career_shock  increased_workload
##   5   4  career_shock  increased_workload
##   5   5  career_shock  increased_workload

Điền missing data cho các biến còn lại bằng phương pháp hồi quy ngẫu nhiên (giúp giữ được mối quan hệ tương quan giữa các biến)

Mô hình hồi quy được bọn em sử dụng bao gồm career_shockincreased_workload đã được điền các missing data lúc trước làm biến độc lập và các biến còn lại làm biến phục thuộc bao gồm Stress Burnout commit. Cụ thể bọn em tiến hành hồi quy và điền giá trị missing cho 3 biến này ở từng wave khác nhau.

Điền missing data cho các biến còn lại ở Wave 0:

reg_dat[reg_dat$stage == 0, ] <- reg_dat %>% 
  filter(stage == 0) %>% 
  select(-increased_workload, -career_shock) %>% 
  left_join(fill_miss) %>% 
  select(-id, -stage) %>% 
  mice(method = "norm.nob") %>% 
  complete() %>%
  mutate(
    id = as.numeric(rownames(.)),
    stage = 0,
    .before = 1
  )
## Joining, by = c("id", "stage")
## 
##  iter imp variable
##   1   1  Stress  Burnout  commit
##   1   2  Stress  Burnout  commit
##   1   3  Stress  Burnout  commit
##   1   4  Stress  Burnout  commit
##   1   5  Stress  Burnout  commit
##   2   1  Stress  Burnout  commit
##   2   2  Stress  Burnout  commit
##   2   3  Stress  Burnout  commit
##   2   4  Stress  Burnout  commit
##   2   5  Stress  Burnout  commit
##   3   1  Stress  Burnout  commit
##   3   2  Stress  Burnout  commit
##   3   3  Stress  Burnout  commit
##   3   4  Stress  Burnout  commit
##   3   5  Stress  Burnout  commit
##   4   1  Stress  Burnout  commit
##   4   2  Stress  Burnout  commit
##   4   3  Stress  Burnout  commit
##   4   4  Stress  Burnout  commit
##   4   5  Stress  Burnout  commit
##   5   1  Stress  Burnout  commit
##   5   2  Stress  Burnout  commit
##   5   3  Stress  Burnout  commit
##   5   4  Stress  Burnout  commit
##   5   5  Stress  Burnout  commit

Điền missing data cho các biến còn lại ở Wave 1

reg_dat[reg_dat$stage == 1, ] <- reg_dat %>% 
  filter(stage == 1) %>% 
  select(-increased_workload, -career_shock) %>% 
  left_join(fill_miss) %>% 
  select(-id, -stage) %>% 
  mice(method = "norm.nob") %>% 
  complete() %>%
  mutate(
    id = as.numeric(rownames(.)),
    stage = 1,
    .before = 1
  )
## Joining, by = c("id", "stage")
## 
##  iter imp variable
##   1   1  Stress  Burnout  commit
##   1   2  Stress  Burnout  commit
##   1   3  Stress  Burnout  commit
##   1   4  Stress  Burnout  commit
##   1   5  Stress  Burnout  commit
##   2   1  Stress  Burnout  commit
##   2   2  Stress  Burnout  commit
##   2   3  Stress  Burnout  commit
##   2   4  Stress  Burnout  commit
##   2   5  Stress  Burnout  commit
##   3   1  Stress  Burnout  commit
##   3   2  Stress  Burnout  commit
##   3   3  Stress  Burnout  commit
##   3   4  Stress  Burnout  commit
##   3   5  Stress  Burnout  commit
##   4   1  Stress  Burnout  commit
##   4   2  Stress  Burnout  commit
##   4   3  Stress  Burnout  commit
##   4   4  Stress  Burnout  commit
##   4   5  Stress  Burnout  commit
##   5   1  Stress  Burnout  commit
##   5   2  Stress  Burnout  commit
##   5   3  Stress  Burnout  commit
##   5   4  Stress  Burnout  commit
##   5   5  Stress  Burnout  commit

Điền missing data cho các biến còn lại ở Wave 2

reg_dat[reg_dat$stage == 2, ] <- reg_dat %>% 
  filter(stage == 2) %>% 
  select(-increased_workload, -career_shock) %>% 
  left_join(fill_miss) %>% 
  select(-id, -stage) %>% 
  mice(method = "norm.nob") %>% 
  complete() %>%
  mutate(
    id = as.numeric(rownames(.)),
    stage = 2,
    .before = 1
  )
## Joining, by = c("id", "stage")
## 
##  iter imp variable
##   1   1  Burnout  commit
##   1   2  Burnout  commit
##   1   3  Burnout  commit
##   1   4  Burnout  commit
##   1   5  Burnout  commit
##   2   1  Burnout  commit
##   2   2  Burnout  commit
##   2   3  Burnout  commit
##   2   4  Burnout  commit
##   2   5  Burnout  commit
##   3   1  Burnout  commit
##   3   2  Burnout  commit
##   3   3  Burnout  commit
##   3   4  Burnout  commit
##   3   5  Burnout  commit
##   4   1  Burnout  commit
##   4   2  Burnout  commit
##   4   3  Burnout  commit
##   4   4  Burnout  commit
##   4   5  Burnout  commit
##   5   1  Burnout  commit
##   5   2  Burnout  commit
##   5   3  Burnout  commit
##   5   4  Burnout  commit
##   5   5  Burnout  commit

Điền missing data cho các biến còn lại ở Wave 3:

Bảng dưới thể hiện kết quả sau khi đã điền giá trị trống:

reg_dat[reg_dat$stage == 3, ] <- reg_dat %>% 
  filter(stage == 3) %>% 
  select(-increased_workload, -career_shock) %>% 
  left_join(fill_miss) %>% 
  select(-id, -stage) %>% 
  mice(method = "norm.nob") %>% 
  complete() %>%
  mutate(
    id = as.numeric(rownames(.)),
    stage = 3,
    .before = 1
  )
## Joining, by = c("id", "stage")
## 
##  iter imp variable
##   1   1  Stress  Burnout  commit
##   1   2  Stress  Burnout  commit
##   1   3  Stress  Burnout  commit
##   1   4  Stress  Burnout  commit
##   1   5  Stress  Burnout  commit
##   2   1  Stress  Burnout  commit
##   2   2  Stress  Burnout  commit
##   2   3  Stress  Burnout  commit
##   2   4  Stress  Burnout  commit
##   2   5  Stress  Burnout  commit
##   3   1  Stress  Burnout  commit
##   3   2  Stress  Burnout  commit
##   3   3  Stress  Burnout  commit
##   3   4  Stress  Burnout  commit
##   3   5  Stress  Burnout  commit
##   4   1  Stress  Burnout  commit
##   4   2  Stress  Burnout  commit
##   4   3  Stress  Burnout  commit
##   4   4  Stress  Burnout  commit
##   4   5  Stress  Burnout  commit
##   5   1  Stress  Burnout  commit
##   5   2  Stress  Burnout  commit
##   5   3  Stress  Burnout  commit
##   5   4  Stress  Burnout  commit
##   5   5  Stress  Burnout  commit
paged_table(head(reg_dat, n = 10))

3.2. Outliers

Về vấn đề outliers, bọn em xử lý bằng cách thay các giá trị outliers bằng các phân vị mức 5% và mức 95%

qnt1 <- quantile(reg_dat$increased_workload, probs=c(.25, .75), na.rm = T)
caps1 <- quantile(reg_dat$increased_workload, probs=c(.05, .95), na.rm = T)
H1 <- 1.5 * IQR(reg_dat$increased_workload, na.rm = T)

qnt2 <- quantile(reg_dat$commit, probs=c(.25, .75), na.rm = T)
caps2 <- quantile(reg_dat$commit, probs=c(.05, .95), na.rm = T)
H2 <- 1.5 * IQR(reg_dat$commit, na.rm = T)


reg_dat <- reg_dat %>% 
  mutate(increased_workload = case_when(
    (increased_workload < (qnt1[1] - H1)) ~ caps1[1],
    (increased_workload > (qnt1[2] + H1)) ~ caps1[2],
    TRUE ~ increased_workload
  )) %>% 
  mutate(commit = case_when(
    (commit < (qnt2[1] - H2)) ~ caps2[1],
    (commit > (qnt2[2] + H2)) ~ caps2[2],
    TRUE ~ commit
  ))
reg_dat %>% 
  select(-id, -stage) %>% 
  boxplot()

4. Phân tích

Theo mô hình lý thuyết của thầy gứi, các biến có tác động khác nhau đến biến phụ thuộc nên phải thực hiện phân tích lần lượt nhiều mô hình nhỏ. Tuy nhiên vì giới hạn về kiến thức và thời gian, nên bọn em quyết định chỉ phân tích tác động trực tiếp của Stress đến Career Commitment theo các phương pháp hồi quy dành cho panel data khác nhau để kiểm tra các kết quả từ các mô hình khác nhau này có thực sự tương đồng?

4.1. Panel data

4.1.1. Pooled OLS

m1 <- lm(commit ~ Stress, data = reg_dat)

summary(m1)
## 
## Call:
## lm(formula = commit ~ Stress, data = reg_dat)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -12.155  -3.194  -1.322   1.806  17.395 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   8.7962     0.5230  16.819  < 2e-16 ***
## Stress        0.8718     0.1870   4.663 3.32e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 6.384 on 1994 degrees of freedom
## Multiple R-squared:  0.01079,    Adjusted R-squared:  0.01029 
## F-statistic: 21.75 on 1 and 1994 DF,  p-value: 3.319e-06
anova(m1)
## Analysis of Variance Table
## 
## Response: commit
##             Df Sum Sq Mean Sq F value    Pr(>F)    
## Stress       1    886  886.34  21.746 3.319e-06 ***
## Residuals 1994  81274   40.76                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Theo phương pháp Pooled OLS: Stress có tác động tích cực (có ý nghĩa thống kê) đến career commitment

4.1.2. Fixed Effect

m2 <- plm(
  commit ~ Stress,
  data = reg_dat,
  model = "within"
)

summary(m2)
## Oneway (individual) effect Within Model
## 
## Call:
## plm(formula = commit ~ Stress, data = reg_dat, model = "within")
## 
## Balanced Panel: n = 499, T = 4, N = 1996
## 
## Residuals:
##      Min.   1st Qu.    Median   3rd Qu.      Max. 
## -16.19566  -3.02417  -0.18353   2.02485  18.40777 
## 
## Coefficients:
##        Estimate Std. Error t-value Pr(>|t|)  
## Stress  0.47819    0.28840  1.6581  0.09751 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Total Sum of Squares:    55307
## Residual Sum of Squares: 55205
## R-Squared:      0.0018343
## Adj. R-Squared: -0.33111
## F-statistic: 2.74922 on 1 and 1496 DF, p-value: 0.097512

Theo phương pháp FEM: Stress có tác động tích cực (có ý nghĩa thống kê) đến career commitment

4.1.3. Random Effect

m3 <- plm(
  commit ~ Stress,
  data = reg_dat,
  model = "random"
)

summary(m3)
## Oneway (individual) effect Random Effect Model 
##    (Swamy-Arora's transformation)
## 
## Call:
## plm(formula = commit ~ Stress, data = reg_dat, model = "random")
## 
## Balanced Panel: n = 499, T = 4, N = 1996
## 
## Effects:
##                  var std.dev share
## idiosyncratic 36.902   6.075 0.906
## individual     3.832   1.958 0.094
## theta: 0.1595
## 
## Residuals:
##     Min.  1st Qu.   Median  3rd Qu.     Max. 
## -11.8192  -3.1389  -1.1599   1.6046  16.6618 
## 
## Coefficients:
##             Estimate Std. Error z-value  Pr(>|z|)    
## (Intercept)  8.94075    0.55362 16.1496 < 2.2e-16 ***
## Stress       0.81810    0.19674  4.1582 3.207e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Total Sum of Squares:    74280
## Residual Sum of Squares: 73641
## R-Squared:      0.0085969
## Adj. R-Squared: 0.0080997
## Chisq: 17.2909 on 1 DF, p-value: 3.2072e-05

Theo phương pháp REM: Stress có tác động tích cực (có ý nghĩa thống kê) đến career commitment

Kiểm định Hausman

phtest(m2, m3)
## 
##  Hausman Test
## 
## data:  commit ~ Stress
## chisq = 2.598, df = 1, p-value = 0.107
## alternative hypothesis: one model is inconsistent

=> p-value > 5%. Chọn mô hình RE phù hợp hơn (tuy nhiên kết quả mô hình FE vẫn có ý nghĩa, chỉ là việc sử dụng FE trong phân tích sẽ kém hiệu quả hơn)

4.1.4. Kiểm định các mô hình

4.1.4.1. Tương quan chuỗi

pbgtest(m3)
## 
##  Breusch-Godfrey/Wooldridge test for serial correlation in panel models
## 
## data:  commit ~ Stress
## chisq = 3.4551, df = 4, p-value = 0.4847
## alternative hypothesis: serial correlation in idiosyncratic errors

=> Không có hiện tượng tương quan chuỗi

4.1.4.2. Kiểm tra tính dừng

adf.test(reg_dat$commit, k = 0)
## Warning in adf.test(reg_dat$commit, k = 0): p-value smaller than printed p-value
## 
##  Augmented Dickey-Fuller Test
## 
## data:  reg_dat$commit
## Dickey-Fuller = -40.968, Lag order = 0, p-value = 0.01
## alternative hypothesis: stationary
adf.test(reg_dat$Stress, k = 0)
## Warning in adf.test(reg_dat$Stress, k = 0): p-value smaller than printed p-value
## 
##  Augmented Dickey-Fuller Test
## 
## data:  reg_dat$Stress
## Dickey-Fuller = -26.676, Lag order = 0, p-value = 0.01
## alternative hypothesis: stationary

=> Cả 2 đều có p-value < 5% => cả hai biến đều dừng

4.1.4.4 Kiểm tra phụ thuộc giữa các nhóm

pcdtest(m3, test = c("cd"))
## 
##  Pesaran CD test for cross-sectional dependence in panels
## 
## data:  commit ~ Stress
## z = 13.584, p-value < 2.2e-16
## alternative hypothesis: cross-sectional dependence

=> p-value < 5%

=> cross-sectional dependence

Tuy nhiên đây cũng không phải vấn đề quá lớn vì T nhỏ (T = 4) và N lớn (N = 499)

4.1.4.5. Phương sai sai số thay đổi

bptest(
  commit ~ Stress,
  data = reg_dat,
  studentize = F
)
## 
##  Breusch-Pagan test
## 
## data:  commit ~ Stress
## BP = 9.6679, df = 1, p-value = 0.001875

=> p-value < 5%: Có hiệu tượng phương sai sai số thay đổi

4.1.5. FGLS

Mô hình FGLS hiệu quả trong việc xử lý vấn đề phương sai sai số thay đổi và tự tương quan trong mô hình cũ

m4 <- pggls(
  commit ~ Stress,
  data = reg_dat,
  model = "pooling"
)

summary(m4)
## Oneway (individual) effect General FGLS model
## 
## Call:
## pggls(formula = commit ~ Stress, data = reg_dat, model = "pooling")
## 
## Balanced Panel: n = 499, T = 4, N = 1996
## 
## Residuals:
##     Min.  1st Qu.   Median     Mean  3rd Qu.     Max. 
## -10.3357  -2.1341  -0.2676   1.0396   2.8659  17.6352 
## 
## Coefficients:
##             Estimate Std. Error z-value  Pr(>|z|)    
## (Intercept)  8.66558    0.41945 20.6596 < 2.2e-16 ***
## Stress       0.53402    0.15081  3.5409 0.0003987 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Total Sum of Squares: 82161
## Residual Sum of Squares: 83565
## Multiple R-squared: -0.01709

Kết quả cũng cho rằng Stress tác động tích cực đến Career commitment

Tổng hợp các kết quả từ các mô hình -> Kết luận rằng Stress có tác động tích cực đến Career Commitment

4.2. Phân tích với biến phụ thuộc là thang Likert

Vì biến phụ thuộc là dạng biến rời rạc với 7 biểu hiện nên nhóm quyết định sử dụng phương pháp hồi quy logistic đa thức (Multinomial Logistic Regression)

Tạo bộ dữ liệu log_dat để tiến hành phân tích. Trong đó commit_likert là đại diện cho career commitment. Vì câu hỏi gốc cho biến phụ thuộc này q0035 chỉ được hỏi cho những đối tượng đang làm công ăn lương (labor) (không có doanh nhân, hay đối tượng khác), nên phạm vi phần phân tích này cũng chỉ thuộc phạm vi đó. Cụ thể:

(q0035) In how many years do you want to leave salaried employment and devote yourself completely to your business?

  1. Never, I want to continue combining work and entrepreneurship

  2. In about 1 year

  3. In about 2 years

  4. In about 3 years

  5. In more than 3 years

  6. As soon as I can make a living from it

  7. I don’t know yet if I want to quit my work

log_dat <- reg_dat %>% 
  select(q0101, q0035, Stress, Burnout) %>% 
  filter(q0101 == 1) %>% 
  drop_na(q0035) %>% 
  select(-q0101) %>% 
  mutate(q0035 = relevel(as.factor(q0035), ref = "1")) %>% 
  rename(commit_likert = q0035)
paged_table(head(log_dat, n = 10))
library(nnet) # package (Multinomial Logistic Regression)

4.2.1. Career commitment vs Stress

log_m1 <- multinom(commit_likert ~ Stress, data = log_dat)
## # weights:  21 (12 variable)
## initial  value 268.535601 
## iter  10 value 246.419409
## final  value 246.185135 
## converged
summary(log_m1)
## Call:
## multinom(formula = commit_likert ~ Stress, data = log_dat)
## 
## Coefficients:
##   (Intercept)      Stress
## 2  -1.7008371  0.47715345
## 3  -2.2171004  0.41494826
## 4  -2.2719029  0.33235246
## 5  -1.2338899 -0.26900156
## 6  -0.5340600  0.15179484
## 7  -0.4965278  0.01195607
## 
## Std. Errors:
##   (Intercept)    Stress
## 2    1.310645 0.4600046
## 3    1.653360 0.5785953
## 4    1.832440 0.6445740
## 5    2.173271 0.8116502
## 6    1.176593 0.4228770
## 7    1.282708 0.4650631
## 
## Residual Deviance: 492.3703 
## AIC: 516.3703

=> Ta thấy được hầu hết các hệ số > 0, chứng tỏ Stress có tác động tích cực đến Career commitment

4.2.2. Career commitment vs Stress & Burnout

Thêm biến Burnout làm biến độc lập của mô hình

log_m2 <- multinom(commit_likert ~ Stress + Burnout, data = log_dat)
## # weights:  28 (18 variable)
## initial  value 268.535601 
## iter  10 value 244.718712
## iter  20 value 242.745430
## final  value 242.744679 
## converged
summary(log_m2)
## Call:
## multinom(formula = commit_likert ~ Stress + Burnout, data = log_dat)
## 
## Coefficients:
##   (Intercept)     Stress    Burnout
## 2  -1.7592495 0.89513428 -0.2760507
## 3  -2.3048288 1.15469148 -0.5108177
## 4  -2.3617022 1.03044439 -0.4777101
## 5  -1.2567214 0.03428045 -0.2032416
## 6  -0.6109629 0.69953021 -0.3666681
## 7  -0.6427422 0.86162047 -0.5816051
## 
## Std. Errors:
##   (Intercept)    Stress   Burnout
## 2    1.329594 0.5936159 0.2481570
## 3    1.659371 0.7234443 0.3039266
## 4    1.834083 0.8027725 0.3375694
## 5    2.205586 1.0753854 0.4479116
## 6    1.198924 0.5537926 0.2321404
## 7    1.303298 0.6016580 0.2560726
## 
## Residual Deviance: 485.4894 
## AIC: 521.4894
  1. Các hệ số của Stress đều > 0 => Stress có tác động tích cực đến Career commitment

  2. Ngược lại với Stress, khi xét thêm yếu tố Burnout, thì các hệ số của Burnout đều < 0 => Burnout có tác động tiêu cực đến Career commitment