Residents Vs Attendings Life Satisfaction

Ibrahim Hassan

2024-06-09

Loading libraries

library(tidyverse)
library(gtsummary)
library(readxl)
library(ggsci)
library(ggthemes)
library(hrbrthemes)
library(GGally)
library(ggpubr)
library(envalysis)

Loading the dataset

df <- read_excel("Final data.xlsx")

Statistical difference of the Questions

df %>% 
    select(c(1,10:81)) %>% 
    select(-c( Psychological, Emotional, Social, Physical, Spirituality, 
           Intelect, Autonomy, `Environmental mastery`, `Personal growth`,
           `Positive relations with others`, `Purpose in life`,
           `Self-acceptance`)) %>% 
    tbl_summary( 
        by = Group,
        type = everything() ~ "continuous2",
        statistic = all_continuous2() ~ c( "{mean} (±{sd})"),
        missing_text = "missing"
        ) %>% 
    modify_header(all_stat_cols() ~ {"**{level}**,<br> N = {n}"}) %>% 
    add_p() %>%
    bold_p(t = 0.05, q = FALSE) 
Characteristic Attending,
N = 20
Resident,
N = 57
p-value1
I engage my intelligence in new areas, i.e., go to museums, history exhibits, sports events, auctions, theater performances.

0·26
    Mean (±SD) 60 (±25) 50 (±27)
    missing 3 1
I have time for self reflection.

0·091
    Mean (±SD) 66 (±17) 55 (±27)
    missing 2 3
I have time to speak with people I trust about important issues.

0·38
    Mean (±SD) 73 (±18) 66 (±24)
    missing 2 2
Things will not work out the way I want them to in the future.

0·090
    Mean (±SD) 41 (±23) 32 (±20)
    missing 4 2
I am always optimistic about my career in medicine.

0·95
    Mean (±SD) 63 (±16) 62 (±24)
    missing 4 1
There have been times when I felt inferior to most of the people I knew.

0·020
    Mean (±SD) 65 (±18) 51 (±26)
    missing 4 0
I feel confident about my abilities.

0·65
    Mean (±SD) 66 (±15) 63 (±18)
    missing 3 2
I spend time with others whose company I enjoy.

0·64
    Mean (±SD) 74 (±15) 75 (±19)
    missing 3 2
I stay in contact with important people in my life.

0·29
    Mean (±SD) 73 (±16) 67 (±23)
    missing 3 2
I have time to find things that make me laugh.

0·84
    Mean (±SD) 69 (±15) 68 (±21)
    missing 2 1
My co-workers have been available to support me.

0·92
    Mean (±SD) 74 (±14) 74 (±21)
    missing 3 4
I have engaging interactions with my co-workers.

0·91
    Mean (±SD) 76 (±14) 74 (±20)
    missing 3 3
I have engaging interactions with my superiors.

0·089
    Mean (±SD) 74 (±13) 64 (±21)
    missing 3 1
I have engaging interactions with my peers.

0·75
    Mean (±SD) 73 (±13) 72 (±20)
    missing 3 2
My peers know they can always confide in me and ask me for advice.

0·83
    Mean (±SD) 75 (±12) 73 (±19)
    missing 3 1
My physical health is excellent.

0·046
    Mean (±SD) 60 (±22) 47 (±26)
    missing 4 1
I expect to be physically healthy throughout the duration of my career.

0·20
    Mean (±SD) 71 (±14) 60 (±26)
    missing 4 1
Take time to be sexual- with yourself, with a partner.

0·41
    Mean (±SD) 59 (±16) 61 (±24)
    missing 6 6
I eat healthy foods and exercise often.

0·80
    Mean (±SD) 48 (±19) 52 (±27)
    missing 5 4
I get enough sleep.

0·73
    Mean (±SD) 41 (±19) 43 (±25)
    missing 4 2
Life does not hold much future promise for me.

0·094
    Mean (±SD) 67 (±32) 81 (±17)
    missing 3 1
I find spiritual connection or community in my daily life

0·15
    Mean (±SD) 61 (±18) 51 (±27)
    missing 5 4
I possess optimism and hope.

0·97
    Mean (±SD) 70 (±13) 67 (±23)
    missing 4 2
I contribute to causes in which I believe.

0·31
    Mean (±SD) 67 (±18) 59 (±26)
    missing 4 3
I read or listen to inspirational literature (talks, music, etc).

0·13
    Mean (±SD) 59 (±15) 50 (±28)
    missing 4 2
I will always seek out activities that challenge me to think and reason.

0·78
    Mean (±SD) 63 (±15) 63 (±21)
    missing 5 2
I avoid activities that require me to concentrate.

0·0004
    Mean (±SD) 64 (±20) 38 (±24)
    missing 4 1
I feel pleased with the amount of intellectual stimulation I receive in my career.

0·54
    Mean (±SD) 68 (±18) 73 (±16)
    missing 5 2
My life has often seemed void of positive mental stimulation.

0·33
    Mean (±SD) 67 (±28) 76 (±20)
    missing 5 2
I can identify projects or tasks that are exciting and rewarding to me.

0·37
    Mean (±SD) 71 (±15) 67 (±18)
    missing 3 2
I am not afraid to voice my opinions, even when they are in opposition to the opinions of my peers.

0·0012
    Mean (±SD) 76 (±18) 56 (±22)
    missing 3 2
I tend to worry about what other people think of me.

0·059
    Mean (±SD) 51 (±18) 41 (±24)
    missing 4 2
It's difficult for me to voice my own opinions on controversial matters.

0·028
    Mean (±SD) 65 (±21) 51 (±23)
    missing 3 2
I often change my mind about decisions if my peers disagree.

0·65
    Mean (±SD) 55 (±17) 58 (±19)
    missing 5 2
I am concerned about how other people evaluate the choices I have made in my career.

0·016
    Mean (±SD) 42 (±19) 57 (±23)
    missing 4 2
In general, I feel I am in charge of the situation in which I live.

>0·99
    Mean (±SD) 55 (±15) 55 (±25)
    missing 4 2
The demands of everyday life often get me down.

0·68
    Mean (±SD) 53 (±18) 51 (±25)
    missing 4 1
I do not fit very well with the people and the community around me.

0·61
    Mean (±SD) 69 (±21) 72 (±22)
    missing 2 2
I am quite good at managing the many responsibilities of my daily life.

0·90
    Mean (±SD) 64 (±18) 62 (±22)
    missing 4 1
I often feel overwhelmed by my responsibilities.

0·53
    Mean (±SD) 54 (±25) 50 (±25)
    missing 1 1
I am the kind of person who likes to give new things a try.

0·17
    Mean (±SD) 62 (±21) 69 (±20)
    missing 5 2
When I think about it, I haven't really improved much as a person over the years.

0·55
    Mean (±SD) 69 (±28) 74 (±25)
    missing 1 1
With time, I have gained a lot of insight about life that has made me a stronger, more capable person.

0·96
    Mean (±SD) 73 (±20) 73 (±21)
    missing 3 3
I do not enjoy being in new situations that require me to change my old familiar ways of doing things.

0·56
    Mean (±SD) 68 (±22) 65 (±22)
    missing 1 2
I enjoy seeing how my views have changed and matured over the years.

0·10
    Mean (±SD) 66 (±17) 74 (±18)
    missing 5 4
Maintaining close relationships has been difficult and frustrating for me.

0·32
    Mean (±SD) 62 (±23) 67 (±25)
    missing 2 2
I enjoy personal and mutual conversations with my peers.

0·38
    Mean (±SD) 74 (±13) 76 (±20)
    missing 4 3
I don't have many people who want to listen when I need to talk.

0·69
    Mean (±SD) 75 (±20) 75 (±26)
    missing 2 2
I know that I can trust my peers, and they know they can trust me.

0·66
    Mean (±SD) 74 (±16) 72 (±20)
    missing 3 1
I find it difficult to really open up when I talk with others.

0·44
    Mean (±SD) 73 (±19) 66 (±24)
    missing 2 2
I feel good when I think of what I've done in the past and what I hope to do in the future.

0·93
    Mean (±SD) 73 (±14) 72 (±20)
    missing 4 3
I have a sense of direction and purpose in my career.

0·98
    Mean (±SD) 77 (±10) 73 (±22)
    missing 3 3
My daily activities often seem trivial and unimportant to me.

0·53
    Mean (±SD) 70 (±18) 66 (±21)
    missing 2 1
I don't have a good sense of what it is I'm trying to accomplish in my career.

0·85
    Mean (±SD) 76 (±18) 74 (±22)
    missing 2 2
I am intentional about the decisions I make day to day.

0·31
    Mean (±SD) 71 (±12) 64 (±22)
    missing 4 2
When I look at the story of my career, I am pleased with how things have turned out.

0·70
    Mean (±SD) 71 (±16) 69 (±24)
    missing 4 2
In general, I feel confident and positive about myself.

0·58
    Mean (±SD) 72 (±13) 68 (±22)
    missing 3 3
I feel like many of the people I know have gotten more out of life than I have.

0·26
    Mean (±SD) 31 (±15) 40 (±27)
    missing 4 1
When I compare myself to my peers, it makes me feel good about who I am.

0·093
    Mean (±SD) 66 (±16) 57 (±21)
    missing 5 3
Everyone has their weaknesses, but I feel like I have more than my share.

0·71
    Mean (±SD) 66 (±26) 65 (±21)
    missing 2 1
1 Wilcoxon rank sum test

Statistical difference of the Domains

df %>% 
    select(Group, Psychological, Emotional, Social, Physical, Spirituality, 
           Intelect, Autonomy, `Environmental mastery`, `Personal growth`,
           `Positive relations with others`, `Purpose in life`,
           `Self-acceptance`) %>% 
    tbl_summary( 
        by = Group,
        type = everything() ~ "continuous2",
        statistic = all_continuous2() ~ c( "{mean} (±{sd})"),
        missing_text = "missing"
        ) %>% 
    modify_header(all_stat_cols() ~ {"**{level}**,<br> N = {n}"}) %>% 
    add_p() %>%
    bold_p(t = 0.05, q = FALSE) 
Characteristic Attending,
N = 20
Resident,
N = 57
p-value1
Psychological

0·026
    Mean (±SD) 61 (±13) 53 (±15)
    missing 1 1
Emotional

0·26
    Mean (±SD) 70 (±13) 65 (±15)
    missing 2 0
Social

0·50
    Mean (±SD) 74 (±11) 71 (±17)
    missing 3 1
Physical

0·34
    Mean (±SD) 57 (±13) 52 (±20)
    missing 2 1
Spirituality

0·45
    Mean (±SD) 63 (±19) 62 (±20)
    missing 2 1
Intelect

0·24
    Mean (±SD) 67 (±14) 63 (±11)
    missing 3 1
Autonomy

0·17
    Mean (±SD) 59 (±11) 53 (±15)
    missing 3 2
Environmental mastery

0·83
    Mean (±SD) 59 (±13) 58 (±18)
    missing 1 1
Personal growth

0·65
    Mean (±SD) 69 (±17) 70 (±16)
    missing 1 1
Positive relations with others

0·92
    Mean (±SD) 73 (±15) 71 (±16)
    missing 2 1
Purpose in life

0·33
    Mean (±SD) 75 (±13) 69 (±18)
    missing 2 1
Self-acceptance

0·46
    Mean (±SD) 64 (±14) 60 (±12)
    missing 2 1
1 Wilcoxon rank sum test

Parallel Coordinates plot 1

df$Group <- factor(df$Group, levels = c("Resident", "Attending"))
df %>% 
    select(Group,`Environmental mastery`, `Personal growth`, Psychological,
           `Positive relations with others`, `Purpose in life`,
           `Self-acceptance`) %>% 
    group_by(Group) %>% 
    summarise_all(mean, na.rm = TRUE) %>% 
    pivot_longer(cols = -Group) %>% 
    pivot_wider(names_from = Group, values_from = value) %>% 
    as_data_frame() %>% 
    ggparcoord( 
        groupColumn = 1,
        columns = 2:3,
        alphaLines = 0.7,
        showPoints = TRUE,
        scale = "globalminmax",
        scaleSummary = "center"
        ) + 
    theme_publish() +
    ggsci::scale_color_futurama()+ 
    labs(title = "Parallel Coordinates Plot", y = "Mean Rating", color = "Domain") +
    theme(
        plot.title = element_text(vjust = .5, size = 18, face = "bold", hjust = 1),
        axis.title.y = element_text(size = 14, face = "bold"),
        axis.title.x = element_blank(),
        axis.text.y = element_text(size = 8, vjust = 3),
        axis.text.x = element_text(size = 12, face = "bold"),
        legend.position = "right"
    )

Parallel Coordinates plot 2

df$Group <- factor(df$Group, levels = c("Resident", "Attending"))
df %>% 
    select(Group, Emotional, Social, Physical, Spirituality, 
           Intelect, Autonomy) %>% 
    group_by(Group) %>% 
    summarise_all(mean, na.rm = TRUE) %>% 
    pivot_longer(cols = -Group) %>% 
    pivot_wider(names_from = Group, values_from = value) %>% 
    as_data_frame() %>% 
    ggparcoord( 
        groupColumn = 1,
        columns = 2:3,
        alphaLines = 0.7,
        showPoints = TRUE,
        scale = "globalminmax",
        scaleSummary = "center"
        ) + 
    theme_publish() +
    ggsci::scale_color_futurama()+ 
    labs(title = "Parallel Coordinates Plot", y = "Mean Rating", color = "Domain") +
    theme(
        plot.title = element_text(vjust = .5, size = 18, face = "bold", hjust = 1),
        axis.title.y = element_text(size = 14, face = "bold"),
        axis.title.x = element_blank(),
        axis.text.y = element_text(size = 8, vjust = 3),
        axis.text.x = element_text(size = 12, face = "bold"),
        legend.position = "right"
    )

Extra Summary statistics 1

df %>% 
    select(1,85) %>% 
    tbl_summary( 
        by = Group,
        type = everything() ~ "continuous2",
        statistic = all_continuous2() ~ c("{mean} (±{sd})"),
        missing_text = "missing"
        ) %>% 
    modify_header(all_stat_cols() ~ {"**{level}**,<br> N = {n}"}) %>% 
    add_p() %>%
    bold_p(t = 0.05, q = FALSE)
Characteristic Resident,
N = 57
Attending,
N = 20
p-value1
What would you rate your current stress level?

0·067
    Mean (±SD) 5·12 (±2·03) 6·29 (±1·36)
    missing 6 3
1 Wilcoxon rank sum test

Extra Summary statistics 2

df %>% 
    select(1,`Are there any significant life events, positive or negative, that have impacted your answers?`) %>% 
    tbl_summary( 
        by = Group,
        missing_text = "missing"
        ) %>% 
    modify_header(all_stat_cols() ~ {"**{level}**,<br> N = {n}"}) %>% 
    add_p() %>%
    bold_p(t = 0.05, q = FALSE)
Characteristic Resident,
N = 571
Attending,
N = 201
p-value2
Are there any significant life events, positive or negative, that have impacted your answers? 17 (33%) 3 (17%) 0·19
    missing 5 2
1 n (%)
2 Pearson’s Chi-squared test

Extra Summary statistics 3

df %>% 
    select(1,`Are you currently participating in therapy or mindful practices such as meditation?`) %>% 
    tbl_summary( 
        by = Group,
        missing_text = "missing"
        ) %>% 
    modify_header(all_stat_cols() ~ {"**{level}**,<br> N = {n}"}) %>% 
    add_p() %>%
    bold_p(t = 0.05, q = FALSE)
Characteristic Resident,
N = 571
Attending,
N = 201
p-value2
Are you currently participating in therapy or mindful practices such as meditation? 11 (21%) 7 (41%) 0·12
    missing 5 3
1 n (%)
2 Fisher’s exact test