Introduction

This document presents the results of a statistical analysis on the dataset provided by Eurostat for the year 2018. For both tests we have used the data for GDP, Hours worked per week of full-time employment, Average rating of satisfaction by domain, sex, age and educational attainment level and Population on 1 January for the year 2018 from Eurostat for the given countries.

Navigation. Home - Eurostat. (n.d.). https://ec.europa.eu/eurostat/en/

The goal is to understand if overall life satisfaction is dependent on the GDP status of a country.

Reasearch question1: Does the overall hapiness depend on the residence in a high or low GDP country?

Data Loading and Preparation

library(readxl)
Skupno <- read_excel("C:/Users/PC/Desktop/RMT Zadaća/Skupno.xlsx")
threshold <- median(Skupno$GDP)
Skupno$GDP_Category <- ifelse(Skupno$GDP > threshold, "High GDP", "Low GDP")

T-Test Analysis

We performed a Welch Two Sample t-test to examine the difference in life satisfaction scores between countries with high GDP and low GDP.

t_test_result <- t.test(`Overall life satisfaction (Scale from 1 to 10)` ~ GDP_Category, data = Skupno)
t_test_result
## 
##  Welch Two Sample t-test
## 
## data:  Overall life satisfaction (Scale from 1 to 10) by GDP_Category
## t = 3.3665, df = 30.763, p-value = 0.002058
## alternative hypothesis: true difference in means between group High GDP and group Low GDP is not equal to 0
## 95 percent confidence interval:
##  0.2939012 1.1980105
## sample estimates:
## mean in group High GDP  mean in group Low GDP 
##               7.581250               6.835294

The results indicate a significant difference in life satisfaction scores (p-value = 0.002058), with high GDP countries having a higher mean life satisfaction score.

Wilcoxon Test Analysis

Given the presence of ties in the data, a Wilcoxon Rank Sum Test with continuity correction was performed.

wilcox_test_result <- wilcox.test(`Overall life satisfaction (Scale from 1 to 10)` ~ `GDP_Category`, data = Skupno)
## Warning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot
## compute exact p-value with ties
wilcox_test_result
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  Overall life satisfaction (Scale from 1 to 10) by GDP_Category
## W = 229.5, p-value = 0.0007838
## alternative hypothesis: true location shift is not equal to 0

The test results also show a significant difference in the distributions of life satisfaction between the two GDP categories (p-value = 0.0007838).

Answer 1

The t-test and Wilcoxon test both suggest a significant difference in life satisfaction between high and low GDP countries. Given the significance and alignment in results, both tests are appropriate, but the Wilcoxon test might be more reliable due to its non-parametric nature and the presence of ties.

Reasearch question2: How do GDP and working hours per week influence the overall life satisfaction of individuals across different countries?

Linear Regression Analysis

A multiple linear regression was conducted to predict overall life satisfaction based on GDP and hours worked per week.

model <- lm(`Overall life satisfaction (Scale from 1 to 10)` ~ GDP + `Hours worked per week of full-time employment`, data = Skupno)
summary(model)
## 
## Call:
## lm(formula = `Overall life satisfaction (Scale from 1 to 10)` ~ 
##     GDP + `Hours worked per week of full-time employment`, data = Skupno)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1.78761 -0.39634  0.00391  0.40525  1.20597 
## 
## Coefficients:
##                                                   Estimate Std. Error t value
## (Intercept)                                      1.307e+01  2.723e+00   4.798
## GDP                                              1.549e-07  1.522e-07   1.017
## `Hours worked per week of full-time employment` -1.436e-01  6.558e-02  -2.190
##                                                 Pr(>|t|)    
## (Intercept)                                     4.12e-05 ***
## GDP                                               0.3171    
## `Hours worked per week of full-time employment`   0.0364 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.6932 on 30 degrees of freedom
## Multiple R-squared:  0.1642, Adjusted R-squared:  0.1085 
## F-statistic: 2.947 on 2 and 30 DF,  p-value: 0.06784

The regression results suggest that hours worked per week has a significant negative effect on life satisfaction.

Diagnostic Plots

The following plots are used to diagnose the assumptions of the linear regression model.

par(mfrow=c(2,2))
plot(model)

The plots suggest that the assumptions of linearity and homoscedasticity are reasonably met, and there are no significant outliers influencing the model.

Shapiro-Wilk Normality Test

The normality of residuals was tested using the Shapiro-Wilk test.

shapiro.test(residuals(model))
## 
##  Shapiro-Wilk normality test
## 
## data:  residuals(model)
## W = 0.97889, p-value = 0.752

The p-value of 0.752 indicates that the residuals are normally distributed, supporting the validity of the model.

Conclusion

Both the t-test and Wilcoxon test suggest a significant difference in life satisfaction between high and low GDP countries. The linear regression analysis further indicates that the number of hours worked per week is a significant predictor of life satisfaction, negatively affecting it. Overall, our analysis supports the conclusion that life satisfaction is influenced by economic conditions and work-life balance.