In this analysis, we explore a European social survey dataset to understand how people’s perceptions of their household income relate to their mental health and social experiences. The data consists of over 40,000 responses, we focus on key variables such as feelings about income, employment status, social interactions, control over life, health, and emotional well-being (depression, loneliness, and motivation).
We begin by selecting the relevant columns and assigning descriptive names to the survey responses to make the data more understandable. After cleaning the dataset and removing missing values, we transform the data into a transactional format suitable for Association Rule Mining. This approach helps us uncover patterns and relationships between the conditions (like being employed, meeting friends, and good health) and outcomes related to income perceptions ranging from living comfortably to experiencing difficulties.
The analysis employs the Apriori algorithm to generate association rules with a minimum support of 1% and a confidence threshold of 30%. We then visualize these rules to examine key metrics such as support, confidence, and lift. This process provides insights into how various aspects of social and personal life are linked to individuals’ feelings about their income, offering a clear picture of the underlying patterns in the data.
First, we load the necessary libraries for data manipulation and analysis.
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ readr 2.1.5
## ✔ forcats 1.0.0 ✔ stringr 1.5.1
## ✔ ggplot2 3.5.1 ✔ tibble 3.2.1
## ✔ lubridate 1.9.3 ✔ tidyr 1.3.1
## ✔ 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(arules)
## Loading required package: Matrix
##
## Attaching package: 'Matrix'
##
## The following objects are masked from 'package:tidyr':
##
## expand, pack, unpack
##
##
## Attaching package: 'arules'
##
## The following object is masked from 'package:dplyr':
##
## recode
##
## The following objects are masked from 'package:base':
##
## abbreviate, write
library(arulesViz)
library(arulesCBA)
We start by reading the data from the CSV file.
data <- read_csv("ESS11.csv")
## Rows: 40156 Columns: 640
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (9): name, proddate, cntry, cntbrthd, lnghom1, lnghom2, fbrncntc, mbr...
## dbl (616): essround, edition, idno, dweight, pspwght, pweight, anweight, nw...
## dttm (15): inwds, ainws, ainwe, binwe, cinwe, dinwe, einwe, finwe, hinwe, i...
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
head(data)
## # A tibble: 6 × 640
## name essround edition proddate idno cntry dweight pspwght pweight anweight
## <chr> <dbl> <dbl> <chr> <dbl> <chr> <dbl> <dbl> <dbl> <dbl>
## 1 ESS11e… 11 2 20.11.2… 50014 AT 1.19 0.393 0.331 0.130
## 2 ESS11e… 11 2 20.11.2… 50030 AT 0.610 0.325 0.331 0.108
## 3 ESS11e… 11 2 20.11.2… 50057 AT 1.39 4.00 0.331 1.32
## 4 ESS11e… 11 2 20.11.2… 50106 AT 0.556 0.176 0.331 0.0583
## 5 ESS11e… 11 2 20.11.2… 50145 AT 0.723 1.06 0.331 0.351
## 6 ESS11e… 11 2 20.11.2… 50158 AT 0.993 1.39 0.331 0.461
## # ℹ 630 more variables: nwspol <dbl>, netusoft <dbl>, netustm <dbl>,
## # ppltrst <dbl>, pplfair <dbl>, pplhlp <dbl>, polintr <dbl>, psppsgva <dbl>,
## # actrolga <dbl>, psppipla <dbl>, cptppola <dbl>, trstprl <dbl>,
## # trstlgl <dbl>, trstplc <dbl>, trstplt <dbl>, trstprt <dbl>, trstep <dbl>,
## # trstun <dbl>, vote <dbl>, prtvtdat <dbl>, prtvtebe <dbl>, prtvtchr <dbl>,
## # prtvtccy <dbl>, prtvtffi <dbl>, prtvtffr <dbl>, prtvgde1 <dbl>,
## # prtvgde2 <dbl>, prtvtegr <dbl>, prtvthhu <dbl>, prtvteis <dbl>, …
The dataset contains 640 columns and 40,156 rows. We will select relevant columns for our analysis.
NewData <- data %>%
select(hincfel, mnactic, sclmeet, ctrlife, fltdpr, fltlnl, cldgng, maritalb, health)
head(NewData)
## # A tibble: 6 × 9
## hincfel mnactic sclmeet ctrlife fltdpr fltlnl cldgng maritalb health
## <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 1 6 4 8 1 1 1 1 3
## 2 2 2 7 8 2 3 2 6 2
## 3 1 1 4 9 2 1 2 1 1
## 4 2 6 6 8 2 2 2 4 3
## 5 2 6 5 9 1 1 1 1 2
## 6 1 1 6 8 1 1 2 1 1
We add descriptive names to the categories based on the survey.
NewData <- NewData %>%
mutate(
hincfel = case_when(
hincfel == 1 ~ "Living Comfortably",
hincfel == 2 ~ "Coping with income",
hincfel == 3 ~ "Difficult coping with income",
hincfel == 4 ~ "Very Difficult coping with income",
TRUE ~ NA_character_
),
mnactic = case_when(
mnactic == 1 ~ "Employed",
mnactic == 2 ~ "Education",
mnactic %in% c(3, 4) ~ "Unemployed",
mnactic == 5 ~ "Permanently sick or disabled",
mnactic == 6 ~ "Retired",
mnactic == 7 ~ "Community or Military",
mnactic == 8 ~ "Housework",
TRUE ~ NA_character_
),
sclmeet = case_when(
sclmeet == 1 ~ "Never meet with friends",
sclmeet %in% c(2, 3) ~ "Occasionally meet with friends",
sclmeet %in% c(4, 5) ~ "Frequently meet with friends",
sclmeet %in% c(6, 7) ~ "Always meet with friends",
TRUE ~ NA_character_
),
ctrlife = case_when(
ctrlife == 0 ~ "I have no control over my life",
ctrlife %in% c(1, 2, 3) ~ "I have limited control over my life",
ctrlife %in% c(4, 5, 6) ~ "I have moderate control over my life",
ctrlife %in% c(7, 8) ~ "I have good control over my life",
ctrlife == 9 ~ "I have complete control over my life",
TRUE ~ NA_character_
),
maritalb = case_when(
maritalb == 1 ~ "Legal Married",
maritalb == 2 ~ "Civil Union",
maritalb %in% c(3, 4) ~ "Legally Seperated or Divorced",
maritalb == 5 ~ "Widowed",
maritalb == 6 ~ "Single",
TRUE ~ NA_character_
),
health = case_when(
health == 1 ~ "My health is very good",
health == 2 ~ "My health is good",
health == 3 ~ "My health is not bad",
health == 4 ~ "My health is bad",
health == 5 ~ "My health is very bad",
TRUE ~ NA_character_
),
fltdpr = case_when(
fltdpr == 1 ~ "Never felt depressed in the past week",
fltdpr == 2 ~ "Sometimes felt depressed in the past week",
fltdpr %in% c(3, 4) ~ "Felt depressed most of the time",
TRUE ~ NA_character_
),
fltlnl = case_when(
fltlnl == 1 ~ "Never felt lonely in the past week",
fltlnl == 2 ~ "Sometimes felt lonely in the past week",
fltlnl %in% c(3, 4) ~ "Felt lonely most of the time",
TRUE ~ NA_character_
),
cldgng = case_when(
cldgng == 1 ~ "Could get going in the past week",
cldgng == 2 ~ "Sometimes Could not get going in the past week",
cldgng %in% c(3, 4) ~ "Could not get going in the past week",
TRUE ~ NA_character_
)
)
head(NewData)
## # A tibble: 6 × 9
## hincfel mnactic sclmeet ctrlife fltdpr fltlnl cldgng maritalb health
## <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
## 1 Living Comfortab… Retired Freque… I have… Never… Never… Could… Legal M… My he…
## 2 Coping with inco… Educat… Always… I have… Somet… Felt … Somet… Single My he…
## 3 Living Comfortab… Employ… Freque… I have… Somet… Never… Somet… Legal M… My he…
## 4 Coping with inco… Retired Always… I have… Somet… Somet… Somet… Legally… My he…
## 5 Coping with inco… Retired Freque… I have… Never… Never… Could… Legal M… My he…
## 6 Living Comfortab… Employ… Always… I have… Never… Never… Somet… Legal M… My he…
We check for missing values in the dataset and drop them.
colSums(is.na(NewData))
## hincfel mnactic sclmeet ctrlife fltdpr fltlnl cldgng maritalb
## 451 659 75 6337 175 173 207 279
## health
## 53
NewData <- NewData %>% drop_na()
After dropping missing values, we have about 32,457 observations left for our analysis.
We prepare the data for association rule mining by transforming it into transactional format.
NewData <- NewData %>%
mutate(transaction_id = row_number())
AltData <- NewData %>%
pivot_longer(cols = -transaction_id, names_to = "Question", values_to = "Response") %>%
select(transaction_id, Response)
write.csv(AltData, "social_survey.csv", row.names = FALSE)
trans1 <- read.transactions("social_survey.csv", format="single", sep=",", cols=c(1,2))
summary(trans1)
## transactions as itemMatrix in sparse format with
## 32458 rows (elements/itemsets/transactions) and
## 40 columns (items) and a density of 0.2249938
##
## most frequent items:
## Never felt lonely in the past week Never felt depressed in the past week
## 21787 20554
## Could get going in the past week Employed
## 17536 17497
## I have good control over my life (Other)
## 17094 197646
##
## element (itemset/transaction) length distribution:
## sizes
## 1 9
## 1 32457
##
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 1 9 9 9 9 9
##
## includes extended item information - examples:
## labels
## 1 Always meet with friends
## 2 Civil Union
## 3 Community or Military
##
## includes extended transaction information - examples:
## transactionID
## 1 1
## 2 10
## 3 100
inspect(head(trans1, 5))
## items transactionID
## [1] {Could get going in the past week,
## Frequently meet with friends,
## I have good control over my life,
## Legal Married,
## Living Comfortably,
## My health is not bad,
## Never felt depressed in the past week,
## Never felt lonely in the past week,
## Retired} 1
## [2] {Coping with income,
## Could get going in the past week,
## I have complete control over my life,
## Legal Married,
## My health is good,
## Never felt depressed in the past week,
## Never felt lonely in the past week,
## Occasionally meet with friends,
## Retired} 10
## [3] {Coping with income,
## Employed,
## Felt depressed most of the time,
## I have moderate control over my life,
## Legal Married,
## My health is bad,
## Never felt lonely in the past week,
## Occasionally meet with friends,
## Sometimes Could not get going in the past week} 100
## [4] {Always meet with friends,
## Coping with income,
## Could get going in the past week,
## Housework,
## I have moderate control over my life,
## Legal Married,
## My health is good,
## Never felt depressed in the past week,
## Never felt lonely in the past week} 1000
## [5] {Could not get going in the past week,
## Education,
## Felt depressed most of the time,
## Felt lonely most of the time,
## Frequently meet with friends,
## I have good control over my life,
## Living Comfortably,
## My health is very good,
## Single} 10000
LIST(head(trans1))
## $`1`
## [1] "Could get going in the past week"
## [2] "Frequently meet with friends"
## [3] "I have good control over my life"
## [4] "Legal Married"
## [5] "Living Comfortably"
## [6] "My health is not bad"
## [7] "Never felt depressed in the past week"
## [8] "Never felt lonely in the past week"
## [9] "Retired"
##
## $`10`
## [1] "Coping with income"
## [2] "Could get going in the past week"
## [3] "I have complete control over my life"
## [4] "Legal Married"
## [5] "My health is good"
## [6] "Never felt depressed in the past week"
## [7] "Never felt lonely in the past week"
## [8] "Occasionally meet with friends"
## [9] "Retired"
##
## $`100`
## [1] "Coping with income"
## [2] "Employed"
## [3] "Felt depressed most of the time"
## [4] "I have moderate control over my life"
## [5] "Legal Married"
## [6] "My health is bad"
## [7] "Never felt lonely in the past week"
## [8] "Occasionally meet with friends"
## [9] "Sometimes Could not get going in the past week"
##
## $`1000`
## [1] "Always meet with friends"
## [2] "Coping with income"
## [3] "Could get going in the past week"
## [4] "Housework"
## [5] "I have moderate control over my life"
## [6] "Legal Married"
## [7] "My health is good"
## [8] "Never felt depressed in the past week"
## [9] "Never felt lonely in the past week"
##
## $`10000`
## [1] "Could not get going in the past week"
## [2] "Education"
## [3] "Felt depressed most of the time"
## [4] "Felt lonely most of the time"
## [5] "Frequently meet with friends"
## [6] "I have good control over my life"
## [7] "Living Comfortably"
## [8] "My health is very good"
## [9] "Single"
##
## $`10001`
## [1] "Always meet with friends"
## [2] "Coping with income"
## [3] "Could not get going in the past week"
## [4] "Employed"
## [5] "I have moderate control over my life"
## [6] "My health is good"
## [7] "Never felt depressed in the past week"
## [8] "Never felt lonely in the past week"
## [9] "Single"
Most frequent frequent items are : Never felt lonely in the past week: 21787 Never felt depressed in the past week: 20554 Could get going in the past week: 17536 Employed: 17497 I have good control over my life: 17094
We visualize the top 10 most frequent items in the transactions.
itemFrequencyPlot(trans1, topN=10, type="absolute", main="Top 10 Most Frequent Items")
itemFrequencyPlot(trans1, topN=10, type="relative", main="Relative Frequency of Top 10 Items")
We start by setting the support to 1% and confidence to 30%.
rules <- apriori(
data = trans1,
parameter = list(supp = 0.01, conf = 0.30),
appearance = list(default = "lhs", rhs = c("Living Comfortably", "Coping with income", "Difficult coping with income", "Very Difficult coping with income")),
control = list(verbose = FALSE)
)
summary(rules)
## set of 3872 rules
##
## rule length distribution (lhs + rhs):sizes
## 1 2 3 4 5 6 7 8
## 2 44 360 1090 1380 751 218 27
##
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 1.000 4.000 5.000 4.824 6.000 8.000
##
## summary of quality measures:
## support confidence coverage lift
## Min. :0.01001 Min. :0.3007 Min. :0.01614 Min. :0.6858
## 1st Qu.:0.01300 1st Qu.:0.4252 1st Qu.:0.02859 1st Qu.:0.9857
## Median :0.01842 Median :0.4678 Median :0.04093 Median :1.0922
## Mean :0.02820 Mean :0.4632 Mean :0.06223 Mean :1.1288
## 3rd Qu.:0.03084 3rd Qu.:0.5057 3rd Qu.:0.06786 3rd Qu.:1.2492
## Max. :0.45982 Max. :0.6336 Max. :1.00000 Max. :2.2710
## count
## Min. : 325.0
## 1st Qu.: 422.0
## Median : 598.0
## Mean : 915.2
## 3rd Qu.: 1001.0
## Max. :14925.0
##
## mining info:
## data ntransactions support confidence
## trans1 32458 0.01 0.3
## call
## apriori(data = trans1, parameter = list(supp = 0.01, conf = 0.3), appearance = list(default = "lhs", rhs = c("Living Comfortably", "Coping with income", "Difficult coping with income", "Very Difficult coping with income")), control = list(verbose = FALSE))
We visualize the rules across support, confidence, and lift.
plot(rules, measure = c("support", "confidence"), shading = "lift")
## To reduce overplotting, jitter is added! Use jitter = 0 to prevent jitter.
plot(rules, shading="order", control=list(main="Two-key plot"))
## To reduce overplotting, jitter is added! Use jitter = 0 to prevent jitter.
We visualize the top 20 rules using different methods.
plot(rules[1:20], method="graph", control=list(type="items"))
## Warning: Unknown control parameters: type
## Available control parameters (with default values):
## layout = stress
## circular = FALSE
## ggraphdots = NULL
## edges = <environment>
## nodes = <environment>
## nodetext = <environment>
## colors = c("#EE0000FF", "#EEEEEEFF")
## engine = ggplot2
## max = 100
## verbose = FALSE
plot(rules[1:22], method="paracoord", control=list(reorder=TRUE))
We will analyze the rules using the hincfel observations as rule consequent.
Let’s analyze rules where the consequent is “Living Comfortably”.
rules_living_comfortably <- sort(subset(rules, rhs %in% "Living Comfortably"), by = "confidence", decreasing = TRUE)
inspect(head(rules_living_comfortably, 20))
## lhs rhs support confidence coverage lift count
## [1] {Always meet with friends,
## Employed,
## I have complete control over my life,
## Legal Married,
## Never felt depressed in the past week,
## Never felt lonely in the past week} => {Living Comfortably} 0.01102964 0.6336283 0.01740711 1.776480 358
## [2] {Always meet with friends,
## Could get going in the past week,
## I have good control over my life,
## Legal Married,
## My health is very good,
## Never felt lonely in the past week} => {Living Comfortably} 0.01019779 0.6316794 0.01614394 1.771016 331
## [3] {My health is very good,
## Never felt depressed in the past week,
## Never felt lonely in the past week,
## Retired} => {Living Comfortably} 0.01050588 0.6314815 0.01663688 1.770461 341
## [4] {Always meet with friends,
## I have good control over my life,
## Legal Married,
## My health is very good,
## Never felt depressed in the past week,
## Never felt lonely in the past week} => {Living Comfortably} 0.01115287 0.6306620 0.01768439 1.768163 362
## [5] {Always meet with friends,
## Employed,
## I have complete control over my life,
## Legal Married,
## Never felt lonely in the past week} => {Living Comfortably} 0.01235443 0.6285266 0.01965617 1.762177 401
## [6] {Always meet with friends,
## Employed,
## I have complete control over my life,
## Legal Married,
## Never felt depressed in the past week} => {Living Comfortably} 0.01170744 0.6270627 0.01867028 1.758072 380
## [7] {Always meet with friends,
## Could get going in the past week,
## I have good control over my life,
## Legal Married,
## My health is very good} => {Living Comfortably} 0.01078317 0.6227758 0.01731468 1.746053 350
## [8] {Always meet with friends,
## I have good control over my life,
## Legal Married,
## My health is very good,
## Never felt depressed in the past week} => {Living Comfortably} 0.01183067 0.6163724 0.01919404 1.728100 384
## [9] {Always meet with friends,
## Could get going in the past week,
## Employed,
## Legal Married,
## My health is very good,
## Never felt depressed in the past week,
## Never felt lonely in the past week} => {Living Comfortably} 0.01223119 0.6136012 0.01993345 1.720331 397
## [10] {My health is very good,
## Never felt lonely in the past week,
## Retired} => {Living Comfortably} 0.01133773 0.6123128 0.01851624 1.716718 368
## [11] {Always meet with friends,
## I have good control over my life,
## Legal Married,
## My health is very good,
## Never felt lonely in the past week} => {Living Comfortably} 0.01235443 0.6122137 0.02017992 1.716441 401
## [12] {Always meet with friends,
## Could get going in the past week,
## Legal Married,
## My health is very good,
## Never felt depressed in the past week,
## Never felt lonely in the past week} => {Living Comfortably} 0.01688336 0.6116071 0.02760490 1.714740 548
## [13] {Always meet with friends,
## Employed,
## Legal Married,
## My health is very good,
## Never felt depressed in the past week,
## Never felt lonely in the past week} => {Living Comfortably} 0.01503481 0.6115288 0.02458562 1.714520 488
## [14] {Always meet with friends,
## Could get going in the past week,
## Employed,
## Legal Married,
## My health is very good,
## Never felt lonely in the past week} => {Living Comfortably} 0.01327870 0.6113475 0.02172038 1.714012 431
## [15] {Always meet with friends,
## Employed,
## I have complete control over my life,
## My health is very good,
## Never felt lonely in the past week} => {Living Comfortably} 0.01041346 0.6101083 0.01706821 1.710538 338
## [16] {Always meet with friends,
## Could get going in the past week,
## Employed,
## Legal Married,
## My health is very good,
## Never felt depressed in the past week} => {Living Comfortably} 0.01284737 0.6096491 0.02107339 1.709250 417
## [17] {Always meet with friends,
## Could get going in the past week,
## Employed,
## Legal Married,
## My health is very good} => {Living Comfortably} 0.01423378 0.6094987 0.02335326 1.708829 462
## [18] {Always meet with friends,
## Could get going in the past week,
## Legal Married,
## My health is very good,
## Never felt lonely in the past week} => {Living Comfortably} 0.01808491 0.6070321 0.02979235 1.701913 587
## [19] {Always meet with friends,
## Could get going in the past week,
## I have complete control over my life,
## Legal Married,
## Never felt depressed in the past week,
## Never felt lonely in the past week} => {Living Comfortably} 0.01293980 0.6069364 0.02131986 1.701645 420
## [20] {Always meet with friends,
## Could get going in the past week,
## Legal Married,
## My health is very good,
## Never felt depressed in the past week} => {Living Comfortably} 0.01768439 0.6067653 0.02914536 1.701165 574
Insights: - Always meeting with friends is consistently associated with Living Comfortably across all rules. - Being legally married and having good control over life appear frequently in the antecedents, linking them to Living Comfortably. - Good health and never feeling lonely or depressed in the past week are important factors in these associations. - Employed individuals and those with complete control over their life are also positively correlated with Living Comfortably. - Support values are generally around 0.01, meaning these associations occur with moderate frequency in the dataset. - Confidence values are typically between 0.6 and 0.7, indicating a moderate to strong likelihood of Living Comfortably given the conditions. - Lift values range from 1.7 to 1.8, suggesting a slight positive correlation between the antecedents and Living Comfortably.
We analyze rules where the consequent is “Coping with income”.
rules_coping <- sort(subset(rules, rhs %in% "Coping with income"), by = "confidence", decreasing = TRUE)
inspect(head(rules_coping, 20))
## lhs rhs support confidence coverage lift count
## [1] {Could get going in the past week,
## Employed,
## My health is good,
## Never felt depressed in the past week,
## Occasionally meet with friends} => {Coping with income} 0.01106045 0.6043771 0.01830057 1.314363 359
## [2] {Employed,
## Never felt lonely in the past week,
## Occasionally meet with friends,
## Sometimes Could not get going in the past week} => {Coping with income} 0.01183067 0.6009390 0.01968698 1.306886 384
## [3] {Could get going in the past week,
## Employed,
## My health is good,
## Never felt lonely in the past week,
## Occasionally meet with friends} => {Coping with income} 0.01109126 0.5990017 0.01851624 1.302673 360
## [4] {Employed,
## My health is good,
## Never felt depressed in the past week,
## Never felt lonely in the past week,
## Occasionally meet with friends} => {Coping with income} 0.01272414 0.5968208 0.02131986 1.297930 413
## [5] {Employed,
## My health is good,
## Never felt lonely in the past week,
## Occasionally meet with friends} => {Coping with income} 0.01771520 0.5940083 0.02982316 1.291814 575
## [6] {Employed,
## Legal Married,
## My health is good,
## Never felt lonely in the past week,
## Occasionally meet with friends} => {Coping with income} 0.01204634 0.5915280 0.02036478 1.286420 391
## [7] {Legal Married,
## My health is not bad,
## Never felt lonely in the past week,
## Occasionally meet with friends} => {Coping with income} 0.01176906 0.5895062 0.01996426 1.282023 382
## [8] {Employed,
## Legal Married,
## Occasionally meet with friends,
## Sometimes Could not get going in the past week} => {Coping with income} 0.01260090 0.5893372 0.02138148 1.281655 409
## [9] {Could get going in the past week,
## My health is good,
## Never felt depressed in the past week,
## Never felt lonely in the past week,
## Occasionally meet with friends} => {Coping with income} 0.01441863 0.5886792 0.02449319 1.280225 468
## [10] {Could get going in the past week,
## My health is good,
## Never felt lonely in the past week,
## Occasionally meet with friends} => {Coping with income} 0.01740711 0.5873181 0.02963830 1.277264 565
## [11] {Employed,
## Legal Married,
## Occasionally meet with friends,
## Sometimes felt depressed in the past week} => {Coping with income} 0.01041346 0.5847751 0.01780763 1.271734 338
## [12] {Employed,
## My health is good,
## Never felt depressed in the past week,
## Occasionally meet with friends} => {Coping with income} 0.01595909 0.5846501 0.02729681 1.271462 518
## [13] {My health is not bad,
## Never felt lonely in the past week,
## Occasionally meet with friends} => {Coping with income} 0.01709902 0.5842105 0.02926859 1.270506 555
## [14] {Could get going in the past week,
## Employed,
## My health is good,
## Occasionally meet with friends} => {Coping with income} 0.01395650 0.5837629 0.02390782 1.269533 453
## [15] {Employed,
## Legal Married,
## My health is good,
## Occasionally meet with friends} => {Coping with income} 0.01626718 0.5827815 0.02791300 1.267398 528
## [16] {I have complete control over my life,
## Never felt lonely in the past week,
## Occasionally meet with friends} => {Coping with income} 0.01019779 0.5817223 0.01753035 1.265095 331
## [17] {Employed,
## Never felt lonely in the past week,
## Occasionally meet with friends} => {Coping with income} 0.03379752 0.5807305 0.05819829 1.262938 1097
## [18] {Could get going in the past week,
## Legal Married,
## My health is good,
## Never felt lonely in the past week,
## Occasionally meet with friends} => {Coping with income} 0.01226200 0.5801749 0.02113501 1.261730 398
## [19] {I have good control over my life,
## Never felt lonely in the past week,
## Occasionally meet with friends,
## Sometimes Could not get going in the past week} => {Coping with income} 0.01115287 0.5801282 0.01922484 1.261628 362
## [20] {Could get going in the past week,
## Legal Married,
## My health is good,
## Occasionally meet with friends} => {Coping with income} 0.01478834 0.5797101 0.02550989 1.260719 480
Insights: - Employed individuals and those with good health are frequently associated with Coping. - Occasionally meeting with friends is a common factor in most rules, indicating its importance in coping. - Never feeling lonely and not feeling depressed in the past week are consistent indicators of better coping abilities. - Legal marriage appears as a positive factor in some associations, contributing to better coping. - Support values are generally low, around 0.01 to 0.03, suggesting these conditions are moderately present in the dataset. - Confidence values hover around 0.58 to 0.60, showing a moderate likelihood of coping given the specified conditions. - Lift values are between 1.26 and 1.31, indicating a slight positive relationship between the conditions and coping. - Occasionally feeling unable to get going is linked to lower coping abilities in some rules.
We analyze rules where the consequent is “Difficult coping with income”.
rules_difficult <- sort(subset(rules, rhs %in% "Difficult coping with income"), by = "confidence", decreasing = TRUE)
inspect(rules_difficult)
## lhs rhs support confidence coverage lift count
## [1] {Could not get going in the past week,
## Felt lonely most of the time} => {Difficult coping with income} 0.01029022 0.3370333 0.03053176 2.271004 334
## [2] {Occasionally meet with friends,
## Sometimes Could not get going in the past week,
## Sometimes felt lonely in the past week} => {Difficult coping with income} 0.01081397 0.3159316 0.03422885 2.128816 351
## [3] {Occasionally meet with friends,
## Sometimes felt depressed in the past week,
## Sometimes felt lonely in the past week} => {Difficult coping with income} 0.01041346 0.3118081 0.03339701 2.101031 338
## [4] {My health is bad,
## Retired} => {Difficult coping with income} 0.01007456 0.3036212 0.03318134 2.045866 327
Insights: - Difficult coping with income are strongly associated with feeling lonely and not being able to get going in the past week. - Occasionally meeting with friends is linked to Difficult conditions in multiple rules, though with a lower frequency of coping. - Feeling depressed or lonely in the past week also correlates with Difficult conditions. - Poor health and retirement are factors that are linked to difficulty in some cases. - Support values range from 0.01 to 0.01, indicating these conditions occur moderately in the dataset. - Confidence values are between 0.30 and 0.34, showing a moderate likelihood of experiencing difficulty given the specified conditions.
Very Difficult coping with income did not generate any rule as it was not frequent in the dataset, not enough transactions were associated with it to form any meaningful association rules
This analysis uncovered clear relationships between how individuals perceive their household income and their mental health and social experiences. Our association rule mining revealed that factors such as strong social ties—especially always meeting with friends—being legally married, and maintaining good health and a sense of life control are consistently linked to living comfortably. Conversely, feelings of loneliness, depression, and low motivation emerged as key indicators of difficulties in coping with income.
These insights underscore the importance of social connections and personal well being in shaping financial perceptions. The patterns observed in the data provide a nuanced understanding of how intertwined our emotional and social lives are with our economic outlook, highlighting potential areas for social support and policy interventions.
Data Source: ESS DATA PORTAL
```