To investigate the factors influencing individuals’ quality of life during the COVID-19 pandemic.
Quality of Life Index (created as an average of the responses to QoL1-QoL7)
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.3 ✔ readr 2.1.4
## ✔ forcats 1.0.0 ✔ stringr 1.5.0
## ✔ ggplot2 3.4.4 ✔ tibble 3.2.1
## ✔ lubridate 1.9.3 ✔ tidyr 1.3.0
## ✔ purrr 1.0.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(haven)
library(dplyr)
library(knitr)
# Loading the dataset
data <- read_sav("C:\\Users\\CKW\\Desktop\\MPH5003\\COVID Behavioral Health_Data Deposit.sav")
# Data Cleaning
# Convert labelled columns to factor or character
data <- data %>%
mutate(across(where(is.labelled), as_factor))
# Renaming variables for clarity
data <- data %>%
rename(
Age = age,
MaritalStatus = marital,
Gender = gender,
EducationLevel = education,
AnnualIncome = income,
PhysicalHealthProblems = PHprob,
MentalHealthProblems = MHprob,
AlcoholRelatedProblems = etoh,
ZipcodePrefix = zipcode_prefix,
COVIDDiagnosisRate = COVIDrate,
COVIDDeathRate = COVIDdeathrate,
ExcessiveDrinkingRate = ExcessiveDrinking
)
# Recoding categorical variables
data$Gender <- recode(data$Gender, '1' = 'Male', '2' = 'Female', '3' = 'Other')
data$MaritalStatus <- recode(data$MaritalStatus, '1' = 'Single', '2' = 'Married', '3' = 'Divorced', '4' = 'Widowed')
# Ensure Quality of Life columns are numeric
qol_columns <- c("QoL1", "QoL2", "QoL3", "QoL4", "QoL5", "QoL6", "QoL7")
data[qol_columns] <- lapply(data[qol_columns], as.numeric)
# Ensure AnnualIncome is numeric
data$AnnualIncome <- as.numeric(data$AnnualIncome)
# Creating Quality of Life Index
data$QoL_index <- rowMeans(data[, c("QoL1", "QoL2", "QoL3", "QoL4", "QoL5", "QoL6", "QoL7")], na.rm = TRUE)
## Assumption Checking for Bivariate Tests
# Filtering the dataset to remove missing values for Age and QoL_index
clean_data <- data %>%
filter(!is.na(Age) & !is.na(QoL_index))
# Fit the linear model using the cleaned data
model <- lm(QoL_index ~ Age, data = clean_data)
# Plot the residuals from the linear model
residuals_data <- data.frame(Age = clean_data$Age, Residuals = residuals(model))
ggplot(residuals_data, aes(x = Age, y = Residuals)) +
geom_point() +
geom_hline(yintercept = 0, color = "red") +
labs(x = "Age", y = "Residuals", title = "Residuals vs Age")
# Linearity check through scatter plots with fitted lines
# Example for Age and Quality of Life
ggplot(data, aes(x = Age, y = QoL_index)) +
geom_point() +
geom_smooth(method = 'lm', se = FALSE, color = 'blue')
## Bivariate Tests
# Pearson correlation test for Age and Quality of Life Index
cor.test(data$Age, data$QoL_index, method = "pearson")
##
## Pearson's product-moment correlation
##
## data: data$Age and data$QoL_index
## t = 1.7712, df = 323, p-value = 0.07747
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.01083065 0.20468539
## sample estimates:
## cor
## 0.09807715
# ANOVA for Gender and Quality of Life Index
anova_result <- aov(QoL_index ~ Gender, data = data)
summary(anova_result)
## Df Sum Sq Mean Sq F value Pr(>F)
## Gender 2 1.27 0.6336 1.283 0.279
## Residuals 326 160.95 0.4937
# ANOVA for Education Level and Quality of Life Index
anova(lm(QoL_index ~ EducationLevel, data = data))
## Analysis of Variance Table
##
## Response: QoL_index
## Df Sum Sq Mean Sq F value Pr(>F)
## EducationLevel 7 8.569 1.22412 2.5574 0.01415 *
## Residuals 321 153.652 0.47867
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# ANOVA for Annual Income and Quality of Life Index
anova(lm(QoL_index ~ AnnualIncome, data = data))
## Analysis of Variance Table
##
## Response: QoL_index
## Df Sum Sq Mean Sq F value Pr(>F)
## AnnualIncome 1 6.335 6.3349 13.353 0.0003015 ***
## Residuals 320 151.817 0.4744
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Interpretation of Bivariate Tests
## Pearson Correlation Test (Age vs Quality of Life Index)
###The Pearson correlation test between Age and the Quality of Life Index resulted in a correlation coefficient (r) of 0.098, suggesting a very weak positive correlation. However, with a p-value of 0.07747, this correlation is not statistically significant (p > 0.05). Therefore, we cannot conclude that age is a significant predictor of Quality of Life in this context.
## ANOVA Test (Gender vs Quality of Life Index)
###The ANOVA test for Gender categories against Quality of Life Index yielded an F-value of 1.283 and a p-value of 0.279. This indicates that there are no statistically significant differences in Quality of Life scores across gender categories (p > 0.05).
## ANOVA Test (Education Level vs Quality of Life Index)
###The ANOVA test comparing different levels of Education with the Quality of Life Index showed an F-value of 2.5574 and a p-value of 0.01415. This result is statistically significant (p < 0.05), suggesting that individuals' education levels are associated with differences in their perceived Quality of Life.
## ANOVA Test (Annual Income vs Quality of Life Index)
###For the relationship between Annual Income and Quality of Life Index, the ANOVA test revealed an F-value of 13.353 and a p-value of 0.0003015. This highly significant result (p < 0.001) indicates that annual income is a substantial factor influencing individuals' Quality of Life, with varying income levels corresponding to differences in Quality of Life scores.
###These findings highlight the complex interplay between socioeconomic factors and perceived Quality of Life. While age and gender may not significantly influence Quality of Life perceptions in this sample, education level and annual income appear to play crucial roles. This analysis contributes to the broader understanding of Quality of Life determinants during the COVID-19 pandemic and suggests potential areas for targeted interventions and further research.
## Answering the Research Question
#By examining the multitude of factors that impact the quality of life of individuals amidst the COVID-19 pandemic, one can uncover nuanced insights. Age and the Quality of Life Index exhibited a faint and insignificant positive correlation, as determined by the Pearson correlation test. This suggests that although age may influence the perception of quality of life to some degree, it is not the determining factor. This discovery is consistent to some extent with the general consensus that people of all ages were impacted by the pandemic; however, the precise nature of these consequences differs (Liu et al., 2021).
#It is noteworthy that the ANOVA tests conducted on the Quality of Life Index did not identify any statistically significant variations based on gender. This contradicts the findings of certain prior investigations that identified disparities in pandemic impacts according to gender (Arab-Zozani et al., 2020).[^2]. This may suggest that, as a result of the pandemic's global reach, conventional gender roles and their consequences may have been modified. Conversely, substantial disparities in quality of life were noted when annual income and level of education were taken into account. The results of this study align with previous research that has highlighted the significance of socioeconomic status in influencing health outcomes in the context of COVID-19 [3] (Nguyen et al., 2020; Ke-Yang et al., 2020).[^4]. An elevated level of education and income were found to be correlated with a higher Quality of Life Index, indicating that socioeconomic determinants significantly influenced the experiences of individuals throughout the pandemic.
#The findings presented herein collectively address the research inquiry by emphasizing the intricate and diverse characteristics of elements that impact the standard of living amidst the pandemic. Although demographic variables such as age and gender exhibited variability in their influence, socioeconomic factors including income and education emerged as more substantial determinants. The findings of this study contribute to the expanding corpus of evidence indicating the necessity for focused interventions that rectify these inequalities, particularly in the context of public health strategies and responses to pandemics.
### References
#[^1]: Liu, C., Lee, Y., Lin, Y., & Yang, S. (2021). Factors associated with anxiety and quality of life of the Wuhan populace during the Covid‐19 pandemic. Stress and Health, 37(5), 887–897. https://doi.org/10.1002/smi.3040
#[^2]: Arab-Zozani, M., Hashemi, F., Safari, H., Yousefi, M., & Ameri, H. (2020). Health-related quality of life and its associated factors in COVID-19 patients. Osong Public Health and Research Perspectives, 11(5), 296–302. https://doi.org/10.24171/j.phrp.2020.11.5.05
#[^3]: Nguyen, H. C., Nguyen, M. H., Do, B. N., Tran, C. Q., Nguyen, T. T. P., Pham, K. M., Pham, L. V., Tran, K. V., Duong, T. T., Tran, T. V., Duong, T. H., Nguyen, T. T., Nguyen, Q. H., Hoang, T. M., Nguyen, K. T., Pham, T. T. M., Yang, S. H., Chao, J. C., & Duong, T. V. (2020). People with Suspected COVID-19 Symptoms Were More Likely Depressed and Had Lower Health-Related Quality of Life: The Potential Benefit of Health Literacy. Journal of clinical medicine, 9(4), 965. https://doi.org/10.3390/jcm9040965
#[^4]: Chen, K.-Y., Li, T., Gong, F.-H., Zhang, J.-S., & Li, X.-K. (2020). Predictors of health-related quality of life and influencing factors for COVID-19 patients, a follow-up at one month. Frontiers in Psychiatry, 11. https://doi.org/10.3389/fpsyt.2020.00668
#[^5]: Ferreira, L. N., Pereira, L. N., da Fé Brás, M., & Ilchuk, K. (2021). Quality of life under the covid-19 quarantine. Quality of Life Research, 30(5), 1389–1405. https://doi.org/10.1007/s11136-020-02724-x
## Descriptive Statistics
library(knitr)
# Calculate descriptive statistics
descriptive_stats <- data %>%
summarise(
Mean_Age = mean(Age, na.rm = TRUE),
SD_Age = sd(Age, na.rm = TRUE),
Median_Income = median(AnnualIncome, na.rm = TRUE)
)
# Display the statistics in a table
kable(descriptive_stats, caption = "Descriptive Statistics of Key Variables", format = "html", align = 'c')
| Mean_Age | SD_Age | Median_Income |
|---|---|---|
| 46.29231 | 14.56522 | 7 |
## Visual Analysis
# Load necessary library
library(ggplot2)
## Quality of Life Index Distribution
ggplot(data, aes(x = QoL_index)) +
geom_histogram(fill = "blue", color = "black", bins = 30) +
labs(title = "Distribution of Quality of Life Index", x = "Quality of Life Index", y = "Frequency")
###The histogram showcases the distribution of the Quality of Life Index, with the majority of participants indicating scores around 3.5 to 4.5, suggesting a relatively high perceived quality of life, while a noticeable group also reported scores around 2.5, indicating potential challenges faced by that segment.
## Quality of Life by Age
ggplot(data, aes(x = Age, y = QoL_index)) +
geom_point() +
geom_smooth(method = "lm", se = FALSE, color = "red") +
labs(title = "Quality of Life by Age", x = "Age", y = "Quality of Life Index")
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 4 rows containing non-finite values (`stat_smooth()`).
## Warning: Removed 4 rows containing missing values (`geom_point()`).
###The scatter plot depicts the relationship between age and the Quality of Life Index. The distribution suggests that there is no strong linear correlation between age and perceived quality of life, as the data points are spread across various quality scores regardless of age. The red line indicates a relatively stable average quality of life across different age groups.
## Quality of Life by Gender
ggplot(data, aes(x = Gender, y = QoL_index, fill = Gender)) +
geom_boxplot() +
labs(title = "Quality of Life by Gender", x = "Gender", y = "Quality of Life Index")
###The boxplot illustrates the distribution of the Quality of Life Index across three gender categories. Gender categories 1 and 2 have a similar median Quality of Life Index, with the former having a slightly wider spread. Gender category 3, however, displays a much narrower spread and a lower median value compared to the other two categories.
## Predictor vs. Outcome Visualizations
# Age vs Quality of Life
ggplot(data, aes(x = Age, y = QoL_index)) +
geom_point() +
geom_smooth(method = "lm") +
labs(title = "Age vs Quality of Life", x = "Age", y = "Quality of Life Index")
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 4 rows containing non-finite values (`stat_smooth()`).
## Removed 4 rows containing missing values (`geom_point()`).
##The scatter plot titled "Age vs Quality of Life" displays a distribution of individual Quality of Life Index scores against their ages. The points are spread across the age spectrum, indicating that respondents of varying ages have a wide range of Quality of Life scores. The linear model fitted to the data suggests a slight positive trend, implying that Quality of Life Index may marginally increase with age. However, the confidence band (shaded area) is quite wide, which indicates a high degree of variability and possibly a weak correlation between age and Quality of Life.
# Gender vs Quality of Life
ggplot(data, aes(x = Gender, y = QoL_index, fill = Gender)) +
geom_boxplot() +
labs(title = "Gender vs Quality of Life", x = "Gender", y = "Quality of Life Index")
##In the "Gender vs Quality of Life" boxplot, the spread and median values of Quality of Life Index are compared across three gender categories: Male, Female, and Nonbinary. The median line within each box represents the midpoint of the data, and it appears that the median Quality of Life Index is slightly higher for males and females compared to nonbinary individuals. The range of scores, represented by the length of the boxes and whiskers, seems quite similar across the male and female categories, but it is notably narrower for the nonbinary group. The presence of outliers, particularly for the male category, suggests that there are individuals with Quality of Life Index scores that deviate significantly from the norm within that group.
# Education Level vs Quality of Life
ggplot(data, aes(x = EducationLevel, y = QoL_index, fill = EducationLevel)) +
geom_boxplot() +
labs(title = "Education Level vs Quality of Life", x = "Education Level", y = "Quality of Life Index")
##The boxplot "Education Level vs Quality of Life" compares the Quality of Life Index across several categories of educational attainment. From the visualization, it is evident that higher levels of education, such as professional degrees and doctorates, are associated with a higher median Quality of Life Index. The boxes, which represent the interquartile range, show the middle 50% of scores, and their increasing height with higher education levels could imply a greater diversity in Quality of Life perceptions among the more educated respondents. Additionally, the presence of outliers in almost all categories suggests individual experiences vary widely, regardless of education level.
# Annual Income vs Quality of Life
ggplot(data, aes(x = AnnualIncome, y = QoL_index, fill = AnnualIncome)) +
geom_boxplot() +
labs(title = "Annual Income vs Quality of Life", x = "Annual Income", y = "Quality of Life Index")
## Warning: Continuous x aesthetic
## ℹ did you forget `aes(group = ...)`?
## Warning: Removed 7 rows containing missing values (`stat_boxplot()`).
## Warning: The following aesthetics were dropped during statistical transformation: fill
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
## the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
## variable into a factor?
##The "Annual Income vs Quality of Life" boxplot illustrates the Quality of Life Index across different income brackets. The graph appears to show a single, wide boxplot, which may suggest that the data for Annual Income is not provided in distinct categories or may not have been processed correctly. Typically, one would expect multiple boxplots side-by-side for different income ranges. If the data is indeed continuous, then this boxplot indicates a broad range of Quality of Life scores across various income levels, with a median that suggests a central tendency towards the higher end of the Quality of Life scale. The long whiskers and outliers indicate that there are individuals with both very high and very low Quality of Life Index scores, reflecting the diversity of experiences across different income levels. It's important to ensure that the income data is categorized properly to provide more granular insights into how income levels may correlate with Quality of Life.