Introduction

Association Rules learning method are conducted on the data obtained from the European Social Survey, in particular the ESS round 11 in 2023. This particular survey measures Social inequalities in health, Gender in contemporary Europe. This task has set hincfel or “Feeling about household’s income nowadays” as the rule consequent.

Library and Data Import

#install.packages("arulesViz")

library(dplyr)
library(arules)
library(moments)
library(arulesViz)
data <- read.csv("ESS11/ESS11.csv")
head(data,5)
##       name essround edition   proddate  idno cntry   dweight   pspwght
## 1 ESS11e02       11       2 20.11.2024 50014    AT 1.1851145 0.3928906
## 2 ESS11e02       11       2 20.11.2024 50030    AT 0.6098981 0.3251533
## 3 ESS11e02       11       2 20.11.2024 50057    AT 1.3923296 4.0000234
## 4 ESS11e02       11       2 20.11.2024 50106    AT 0.5560615 0.1762276
## 5 ESS11e02       11       2 20.11.2024 50145    AT 0.7227953 1.0609399
##     pweight   anweight nwspol netusoft netustm ppltrst pplfair pplhlp polintr
## 1 0.3309145 0.13001321     90        5     180       5       5      5       1
## 2 0.3309145 0.10759795     90        5     570      10       0      1       2
## 3 0.3309145 1.32366590     30        5      30       6       9      8       2
## 4 0.3309145 0.05831629     15        1    6666       6       6      6       3
## 5 0.3309145 0.35108042     60        5     120       6       3      8       2
##   psppsgva actrolga psppipla cptppola trstprl trstlgl trstplc trstplt trstprt
## 1        4        5        4        5       6       9      10       5       5
## 2        3        2        3        2       6       6       4       1       0
## 3        4        4        4        3       7       5       8       4       4
## 4        2        2        2        3       5       6       9       3       3
## 5        3        1        4        3       6       8       8       5       5
##   trstep trstun vote prtvtdat prtvtebe prtvtchr prtvtccy prtvtffi prtvtffr
## 1      5      5    1        1       NA       NA       NA       NA       NA
## 2      5      5    1        5       NA       NA       NA       NA       NA
## 3      7      5    1        5       NA       NA       NA       NA       NA
## 4      4      4    2       66       NA       NA       NA       NA       NA
## 5      6      8    1        5       NA       NA       NA       NA       NA
##   prtvgde1 prtvgde2 prtvtegr prtvthhu prtvteis prtvteie prtvteit prtvclt1
## 1       NA       NA       NA       NA       NA       NA       NA       NA
## 2       NA       NA       NA       NA       NA       NA       NA       NA
## 3       NA       NA       NA       NA       NA       NA       NA       NA
## 4       NA       NA       NA       NA       NA       NA       NA       NA
## 5       NA       NA       NA       NA       NA       NA       NA       NA
##   prtvclt2 prtvclt3 prtvtinl prtvtcno prtvtfpl prtvtept prtvtbrs prtvtesk
## 1       NA       NA       NA       NA       NA       NA       NA       NA
## 2       NA       NA       NA       NA       NA       NA       NA       NA
## 3       NA       NA       NA       NA       NA       NA       NA       NA
## 4       NA       NA       NA       NA       NA       NA       NA       NA
## 5       NA       NA       NA       NA       NA       NA       NA       NA
##   prtvtgsi prtvtges prtvtdse prtvthch prtvtdgb contplt donprty badge sgnptit
## 1       NA       NA       NA       NA       NA       2       2     2       2
## 2       NA       NA       NA       NA       NA       2       2     1       1
## 3       NA       NA       NA       NA       NA       1       1     2       1
## 4       NA       NA       NA       NA       NA       2       2     2       2
## 5       NA       NA       NA       NA       NA       2       2     2       1
##   pbldmna bctprd pstplonl volunfp clsprty prtcleat prtclebe prtclbhr prtclccy
## 1       2      2        2       2       1        1       NA       NA       NA
## 2       1      1        2       1       1        5       NA       NA       NA
## 3       1      1        1       1       1        5       NA       NA       NA
## 4       2      2        2       2       2       66       NA       NA       NA
## 5       2      2        2       2       1        5       NA       NA       NA
##   prtclgfi prtclgfr prtclgde prtclegr prtclihu prtcleis prtclfie prtclfit
## 1       NA       NA       NA       NA       NA       NA       NA       NA
## 2       NA       NA       NA       NA       NA       NA       NA       NA
## 3       NA       NA       NA       NA       NA       NA       NA       NA
## 4       NA       NA       NA       NA       NA       NA       NA       NA
## 5       NA       NA       NA       NA       NA       NA       NA       NA
##   prtclclt prtclhnl prtclcno prtcljpl prtclgpt prtclbrs prtclesk prtclgsi
## 1       NA       NA       NA       NA       NA       NA       NA       NA
## 2       NA       NA       NA       NA       NA       NA       NA       NA
## 3       NA       NA       NA       NA       NA       NA       NA       NA
## 4       NA       NA       NA       NA       NA       NA       NA       NA
## 5       NA       NA       NA       NA       NA       NA       NA       NA
##   prtclhes prtcldse prtclhch prtcldgb prtdgcl lrscale stflife stfeco stfgov
## 1       NA       NA       NA       NA       2       5       8      6      4
## 2       NA       NA       NA       NA       2       0       9      2      5
## 3       NA       NA       NA       NA       2       3      10      6      5
## 4       NA       NA       NA       NA       6       5       7      4      4
## 5       NA       NA       NA       NA       2       2       9      6      7
##   stfdem stfedu stfhlth gincdif freehms hmsfmlsh hmsacld euftf lrnobed loylead
## 1      6      8       8       2       2        4       3     6       4       4
## 2      7     10      10       1       1        5       1     9       2       5
## 3      6      5       8       1       1        5       1     7       5       3
## 4      6      5       2       1       2        4       3     5       2       9
## 5      8      9       9       2       2        4       2    10       1       2
##   imsmetn imdfetn impcntr imbgeco imueclt imwbcnt happy sclmeet inprdsc sclact
## 1       2       2       3       7       3       5     8       4       1      3
## 2       2       2       2       6       5       9     9       7       4      4
## 3       1       1       1       9       9       8     9       4       4      3
## 4       2       2       2       6       6       5     7       6       3      3
## 5       1       1       2      10      10      10     9       5       4      3
##   crmvct aesfdrk health hlthhmp atchctr atcherp rlgblg rlgdnm rlgdnbat rlgdnacy
## 1      2       2      3       3      10       5      1      1        1       NA
## 2      1       3      2       2       8       8      2     66     6666       NA
## 3      2       3      1       3       9       7      2     66     6666       NA
## 4      2       3      3       3      10       8      1      3       10       NA
## 5      2       1      2       3      10      10      1      1        1       NA
##   rlgdnafi rlgdnade rlgdnagr rlgdnhu rlgdnais rlgdnie rlgdnlt rlgdnanl rlgdnno
## 1       NA       NA       NA      NA       NA      NA      NA       NA      NA
## 2       NA       NA       NA      NA       NA      NA      NA       NA      NA
## 3       NA       NA       NA      NA       NA      NA      NA       NA      NA
## 4       NA       NA       NA      NA       NA      NA      NA       NA      NA
## 5       NA       NA       NA      NA       NA      NA      NA       NA      NA
##   rlgdnapl rlgdnapt rlgdnrs rlgdnask rlgdnase rlgdnach rlgdngb rlgblge rlgdnme
## 1       NA       NA      NA       NA       NA       NA      NA       6      66
## 2       NA       NA      NA       NA       NA       NA      NA       2      66
## 3       NA       NA      NA       NA       NA       NA      NA       1       1
## 4       NA       NA      NA       NA       NA       NA      NA       6      66
## 5       NA       NA      NA       NA       NA       NA      NA       6      66
##   rlgdebat rlgdeacy rlgdeafi rlgdeade rlgdeagr rlgdehu rlgdeais rlgdeie rlgdelt
## 1     6666       NA       NA       NA       NA      NA       NA      NA      NA
## 2     6666       NA       NA       NA       NA      NA       NA      NA      NA
## 3        1       NA       NA       NA       NA      NA       NA      NA      NA
## 4     6666       NA       NA       NA       NA      NA       NA      NA      NA
## 5     6666       NA       NA       NA       NA      NA       NA      NA      NA
##   rlgdeanl rlgdeno rlgdeapl rlgdeapt rlgders rlgdeask rlgdease rlgdeach rlgdegb
## 1       NA      NA       NA       NA      NA       NA       NA       NA      NA
## 2       NA      NA       NA       NA      NA       NA       NA       NA      NA
## 3       NA      NA       NA       NA      NA       NA       NA       NA      NA
## 4       NA      NA       NA       NA      NA       NA       NA       NA      NA
## 5       NA      NA       NA       NA      NA       NA       NA       NA      NA
##   rlgdgr rlgatnd pray dscrgrp dscrrce dscrntn dscrrlg dscrlng dscretn dscrage
## 1      5       6    5       2       0       0       0       0       0       0
## 2      0       7    6       2       0       0       0       0       0       0
## 3      8       5    3       1       0       0       0       0       0       0
## 4      6       6    3       2       0       0       0       0       0       0
## 5      1       7    7       2       0       0       0       0       0       0
##   dscrgnd dscrsex dscrdsb dscroth dscrdk dscrref dscrnap dscrna ctzcntr brncntr
## 1       0       0       0       0      0       0       1      0       1       1
## 2       0       0       0       0      0       0       1      0       1       1
## 3       1       0       0       0      0       0       0      0       1       1
## 4       0       0       0       0      0       0       1      0       2       2
## 5       0       0       0       0      0       0       1      0       1       1
##   cntbrthd livecnta lnghom1 lnghom2 feethngr facntr fbrncntc mocntr mbrncntc
## 1     6666     6666     GER     000        1      1     6666      1     6666
## 2     6666     6666     GER     ENG        8      1     6666      1     6666
## 3     6666     6666     GER     ENG        1      1     6666      1     6666
## 4       RO     1989     GER     RUM        2      2       RO      2       RO
## 5     6666     6666     GER     000        1      1     6666      1     6666
##   ccnthum ccrdprs wrclmch admrclc testjc34 testjc35 testjc36 testjc37 testjc38
## 1       4       4       4       2       66       66       66        2        2
## 2       3      10       5       3       66       66       66        6        6
## 3       4       8       5       2       66       66       66        3        4
## 4       4       6       4       2       66       66       66        4        4
## 5       5      10       4       3       66       66       66        6        6
##   testjc39 testjc40 testjc41 testjc42 vteurmmb vteubcmb ctrlife etfruit eatveg
## 1        3        6        6        6        1       NA       8       3      3
## 2        6        3        3        2       55       NA       8       1      1
## 3        3        6        6        6        1       NA       9       4      3
## 4        4        6        6        6       55       NA       8       2      2
## 5        6        4        2        1        1       NA       9       3      3
##   dosprt cgtsmok alcfreq alcwkdy alcwknd icgndra alcbnge height weighta dshltgp
## 1      3       4       3      20      22       1       5    178      90       1
## 2      5       5       3      70      64       2       2    168      74       1
## 3      3       1       4      72      72       2       5    180      95       1
## 4      3       6       7    6666    6666       6       6    167      70       1
## 5      3       1       2      24      48       2       4    168      67       0
##   dshltms dshltnt dshltref dshltdk dshltna medtrun medtrnp medtrnt medtroc
## 1       1       0        0       0       0       2       0       0       0
## 2       0       0        0       0       0       2       0       0       0
## 3       1       0        0       0       0       2       0       0       0
## 4       1       0        0       0       0       2       0       0       0
## 5       1       0        0       0       0       2       0       0       0
##   medtrnl medtrwl medtrnaa medtroth medtrnap medtrref medtrdk medtrna medtrnu
## 1       0       0        0        0        1        0       0       0       1
## 2       0       0        0        0        1        0       0       0       2
## 3       0       0        0        0        1        0       0       0       1
## 4       0       0        0        0        1        0       0       0       1
## 5       0       0        0        0        1        0       0       0       1
##   hlpfmly hlpfmhr trhltacu trhltacp trhltcm trhltch trhltos trhltho trhltht
## 1       2      66        0        0       0       0       0       0       0
## 2       1       2        0        0       0       0       0       0       0
## 3       1       1        0        0       1       0       0       0       0
## 4       2      66        0        0       0       0       0       0       0
## 5       2      66        0        0       0       0       0       1       1
##   trhlthy trhltmt trhltpt trhltre trhltsh trhltnt trhltref trhltdk trhltna
## 1       0       0       0       0       0       1        0       0       0
## 2       0       0       0       0       0       1        0       0       0
## 3       0       0       0       0       0       0        0       0       0
## 4       0       0       0       0       0       1        0       0       0
## 5       0       0       0       0       0       0        0       0       0
##   fltdpr flteeff slprl wrhpp fltlnl enjlf fltsd cldgng hltprhc hltprhb hltprbp
## 1      1       1     1     3      1     3     1      1       0       1       0
## 2      2       2     3     3      3     4     2      2       1       0       0
## 3      2       2     3     3      1     3     1      2       0       0       0
## 4      2       2     3     2      2     2     2      2       0       1       0
## 5      1       1     1     3      1     3     1      1       0       0       0
##   hltpral hltprbn hltprpa hltprpf hltprsd hltprsc hltprsh hltprdi hltprnt
## 1       0       0       0       0       0       0       0       0       0
## 2       0       0       0       0       0       0       0       0       0
## 3       0       0       0       1       0       0       0       0       0
## 4       0       1       0       0       0       0       0       1       0
## 5       0       0       0       0       0       0       0       0       1
##   hltprref hltprdk hltprna hltphhc hltphhb hltphbp hltphal hltphbn hltphpa
## 1        0       0       0       0       0       0       0       0       0
## 2        0       0       0       0       0       0       0       0       0
## 3        0       0       0       0       0       0       0       0       1
## 4        0       0       0       0       0       0       0       1       0
## 5        0       0       0       0       0       0       0       0       0
##   hltphpf hltphsd hltphsc hltphsh hltphdi hltphnt hltphnap hltphref hltphdk
## 1       0       0       0       0       0       1        0        0       0
## 2       0       0       0       0       0       0        0        1       0
## 3       1       0       0       0       0       0        0        0       0
## 4       0       0       0       0       1       0        0        0       0
## 5       0       0       0       0       0       0        1        0       0
##   hltphna hltprca cancfre cnfpplh fnsdfml jbexpvi jbexpti jbexpml jbexpmc
## 1       0       3       6       4       5       0       0       0       0
## 2       0       3       6       2       4       0       0       0       0
## 3       0       3       6       4       2       0       0       0       0
## 4       0       3       6       4       3       0       1       1       0
## 5       0       3       6       5       5       0       0       0       0
##   jbexpnt jbexpnap jbexpref jbexpdk jbexpna jbexevl jbexevh jbexevc jbexera
## 1       0        1        0       0       0       0       0       0       0
## 2       1        0        0       0       0       0       0       0       0
## 3       1        0        0       0       0       0       0       0       0
## 4       0        0        0       0       0       0       0       0       0
## 5       1        0        0       0       0       0       0       0       0
##   jbexecp jbexebs jbexent jbexenap jbexeref jbexedk jbexena nobingnd likrisk
## 1       0       0       0        1        0       0       0        1       2
## 2       0       0       1        0        0       0       0        2       0
## 3       0       0       1        0        0       0       0        2       0
## 4       1       1       0        0        0       0       0        2       0
## 5       0       0       1        0        0       0       0        2       1
##   liklead sothnds actcomp mascfel femifel impbemw trmedmw trwrkmw trplcmw
## 1       4       4       5       4       0       3       3       3       3
## 2       0       6       6       3       6       3       3       2       3
## 3       3       6       6       0       6       5       3       3       3
## 4       1       6       6       0       6       5       3       1       3
## 5       0       6       6       0       5       5       3       3       3
##   trmdcnt trwkcnt trplcnt eqwrkbg eqpolbg eqmgmbg eqpaybg eqparep eqparlv
## 1       3       3       3       6       6       6       6       4       4
## 2       1       1       8       6       5       5       5       2       4
## 3       1       1       1       5       6       6       6       2       8
## 4       3       1       2       5       5       5       6       1       8
## 5       3       1       3       6       6       6       6       1       5
##   freinsw fineqpy wsekpwr weasoff wlespdm wexashr wprtbym wbrgwrm hhmmb gndr
## 1       4       3       2       3       2       2       2       2     2    1
## 2       1       2       3       3       4       2       2       3     1    2
## 3       2       1       2       2       4       2       4       2     3    2
## 4       4       1       3       3       4       2       3       2     1    2
## 5       1       1       2       2       4       1       3       3     2    1
##   gndr2 gndr3 gndr4 gndr5 gndr6 gndr7 gndr8 gndr9 gndr10 gndr11 gndr12 yrbrn
## 1     2     6     6     6     6     6    NA    NA     NA     NA     NA  1958
## 2     6     6     6     6     6     6    NA    NA     NA     NA     NA  2002
## 3     1     2     6     6     6     6    NA    NA     NA     NA     NA  1970
## 4     6     6     6     6     6     6    NA    NA     NA     NA     NA  1945
## 5     1     6     6     6     6     6    NA    NA     NA     NA     NA  1959
##   agea yrbrn2 yrbrn3 yrbrn4 yrbrn5 yrbrn6 yrbrn7 yrbrn8 yrbrn9 yrbrn10 yrbrn11
## 1   65   1957   6666   6666   6666   6666   6666     NA     NA      NA      NA
## 2   21   6666   6666   6666   6666   6666   6666     NA     NA      NA      NA
## 3   53   1970   2001   6666   6666   6666   6666     NA     NA      NA      NA
## 4   78   6666   6666   6666   6666   6666   6666     NA     NA      NA      NA
## 5   64   1962   6666   6666   6666   6666   6666     NA     NA      NA      NA
##   yrbrn12 rshipa2 rshipa3 rshipa4 rshipa5 rshipa6 rshipa7 rshipa8 rshipa9
## 1      NA       1      66      66      66      66      66      NA      NA
## 2      NA      66      66      66      66      66      66      NA      NA
## 3      NA       1       2      66      66      66      66      NA      NA
## 4      NA      66      66      66      66      66      66      NA      NA
## 5      NA       1      66      66      66      66      66      NA      NA
##   rshipa10 rshipa11 rshipa12 rshpsts rshpsgb lvgptnea dvrcdeva marsts marstgb
## 1       NA       NA       NA       1      NA        1        2     66      NA
## 2       NA       NA       NA      66      NA        2        2      6      NA
## 3       NA       NA       NA       1      NA        1        2     66      NA
## 4       NA       NA       NA      66      NA        1        1      4      NA
## 5       NA       NA       NA       1      NA        1        2     66      NA
##   maritalb chldhhe domicil paccmoro paccdwlr pacclift paccnbsh paccocrw
## 1        1       1       3        0        0        0        0        0
## 2        6       2       1        1        0        0        0        0
## 3        1       6       3        0        0        0        0        0
## 4        4       1       1        0        0        0        0        0
## 5        1       1       4        0        0        0        0        0
##   paccxhoc paccnois paccinro paccnt paccref paccdk paccna edulvlb eisced
## 1        0        0        0      1       0      0      0     322      3
## 2        0        0        0      0       0      0      0     423      5
## 3        0        0        0      1       0      0      0     610      6
## 4        0        0        0      1       0      0      0     422      5
## 5        0        0        0      1       0      0      0     322      3
##   edlveat edlvebe edlvehr edlvgcy edlvdfi edlvdfr edudde1 educde2 edlvegr
## 1       6      NA      NA      NA      NA      NA      NA      NA      NA
## 2      10      NA      NA      NA      NA      NA      NA      NA      NA
## 3      12      NA      NA      NA      NA      NA      NA      NA      NA
## 4       9      NA      NA      NA      NA      NA      NA      NA      NA
## 5       6      NA      NA      NA      NA      NA      NA      NA      NA
##   edlvdahu edlvdis edlvdie edlvfit edlvdlt edlvenl edlveno edlvipl edlvept
## 1       NA      NA      NA      NA      NA      NA      NA      NA      NA
## 2       NA      NA      NA      NA      NA      NA      NA      NA      NA
## 3       NA      NA      NA      NA      NA      NA      NA      NA      NA
## 4       NA      NA      NA      NA      NA      NA      NA      NA      NA
## 5       NA      NA      NA      NA      NA      NA      NA      NA      NA
##   edlvdrs edlvdsk edlvesi edlvies edlvdse edlvdch educgb1 edubgb2 edagegb
## 1      NA      NA      NA      NA      NA      NA      NA      NA      NA
## 2      NA      NA      NA      NA      NA      NA      NA      NA      NA
## 3      NA      NA      NA      NA      NA      NA      NA      NA      NA
## 4      NA      NA      NA      NA      NA      NA      NA      NA      NA
## 5      NA      NA      NA      NA      NA      NA      NA      NA      NA
##   eduyrs pdwrk edctn uempla uempli dsbld rtrd cmsrv hswrk dngoth dngref dngdk
## 1     12     0     0      0      0     0    1     0     0      0      0     0
## 2     14     0     1      0      0     0    0     0     0      0      0     0
## 3     16     1     0      0      0     0    0     0     0      0      0     0
## 4     14     0     0      0      0     0    1     0     0      0      0     0
## 5     12     0     0      0      0     0    1     0     0      0      0     0
##   dngna mainact mnactic crpdwk pdjobev pdjobyr emplrel emplno wrkctra estsz
## 1     0      66       6      2       2    6666       6  66666       6     6
## 2     0      66       2      2       1    2023       1  66666       2     2
## 3     0      66       1      6       6    6666       1  66666       1     1
## 4     0      66       6      2       1    2005       1  66666       1     5
## 5     0      66       6      2       1    2021       1  66666       1     2
##   jbspv njbspv wkdcorga iorgact wkhct wkhtot nacer2 tporgwk isco08 wrkac6m
## 1     6  66666       66      66   666    666    666      66  66666       6
## 2     2  66666        0       0    32     32     14       4   5249       2
## 3     1      4       10       9    25     25     88       6   2635       2
## 4     2  66666        5       0    39     39     87       2   2221       2
## 5     2  66666        7       7    40     35     47       4   5223       2
##   uemp3m uemp12m uemp5yr mbtru hincsrca hinctnta hincfel edulvlpb eiscedp
## 1      2       6       6     3        4        6       1      322       3
## 2      2       6       6     3        8        1       2     6666      66
## 3      2       6       6     3        1        5       1      520       5
## 4      2       6       6     3        4        2       2     6666      66
## 5      2       6       6     2        4       77       2      322       3
##   edlvpfat edlvpebe edlvpehr edlvpgcy edlvpdfi edlvpdfr edupdde1 edupcde2
## 1        6       NA       NA       NA       NA       NA       NA       NA
## 2     6666       NA       NA       NA       NA       NA       NA       NA
## 3       11       NA       NA       NA       NA       NA       NA       NA
## 4     6666       NA       NA       NA       NA       NA       NA       NA
## 5        6       NA       NA       NA       NA       NA       NA       NA
##   edlvpegr edlvpdahu edlvpdis edlvpdie edlvpfit edlvpdlt edlvpenl edlvpeno
## 1       NA        NA       NA       NA       NA       NA       NA       NA
## 2       NA        NA       NA       NA       NA       NA       NA       NA
## 3       NA        NA       NA       NA       NA       NA       NA       NA
## 4       NA        NA       NA       NA       NA       NA       NA       NA
## 5       NA        NA       NA       NA       NA       NA       NA       NA
##   edlvphpl edlvpept edlvpdrs edlvpdsk edlvpesi edlvphes edlvpdse edlvpdch
## 1       NA       NA       NA       NA       NA       NA       NA       NA
## 2       NA       NA       NA       NA       NA       NA       NA       NA
## 3       NA       NA       NA       NA       NA       NA       NA       NA
## 4       NA       NA       NA       NA       NA       NA       NA       NA
## 5       NA       NA       NA       NA       NA       NA       NA       NA
##   edupcgb1 edupbgb2 edagepgb pdwrkp edctnp uemplap uemplip dsbldp rtrdp cmsrvp
## 1       NA       NA       NA      0      0       0       0      0     1      0
## 2       NA       NA       NA      0      0       0       0      0     0      0
## 3       NA       NA       NA      1      0       0       0      0     0      0
## 4       NA       NA       NA      0      0       0       0      0     0      0
## 5       NA       NA       NA      0      0       0       0      0     1      0
##   hswrkp dngothp dngdkp dngnapp dngrefp dngnap mnactp crpdwkp isco08p emprelp
## 1      0       0      0       0       0      0     66       2   66666       6
## 2      0       0      0       1       0      0     66       6   66666       6
## 3      0       0      0       0       0      0     66       6    2635       1
## 4      0       0      0       1       0      0     66       6   66666       6
## 5      0       0      0       0       0      0     66       2   66666       6
##   wkhtotp edulvlfb eiscedf edlvfeat edlvfebe edlvfehr edlvfgcy edlvfdfi
## 1     666      322       3        7       NA       NA       NA       NA
## 2     666      322       3        6       NA       NA       NA       NA
## 3       1      322       3        6       NA       NA       NA       NA
## 4     666      322       3        6       NA       NA       NA       NA
## 5     666      322       3        6       NA       NA       NA       NA
##   edlvfdfr edufcde1 edufbde2 edlvfegr edlvfdahu edlvfdis edlvfdie edlvffit
## 1       NA       NA       NA       NA        NA       NA       NA       NA
## 2       NA       NA       NA       NA        NA       NA       NA       NA
## 3       NA       NA       NA       NA        NA       NA       NA       NA
## 4       NA       NA       NA       NA        NA       NA       NA       NA
## 5       NA       NA       NA       NA        NA       NA       NA       NA
##   edlvfdlt edlvfenl edlvfeno edlvfgpl edlvfept edlvfdrs edlvfdsk edlvfesi
## 1       NA       NA       NA       NA       NA       NA       NA       NA
## 2       NA       NA       NA       NA       NA       NA       NA       NA
## 3       NA       NA       NA       NA       NA       NA       NA       NA
## 4       NA       NA       NA       NA       NA       NA       NA       NA
## 5       NA       NA       NA       NA       NA       NA       NA       NA
##   edlvfges edlvfdse edlvfdch edufcgb1 edufbgb2 edagefgb emprf14 occf14b
## 1       NA       NA       NA       NA       NA       NA       2       9
## 2       NA       NA       NA       NA       NA       NA       2       9
## 3       NA       NA       NA       NA       NA       NA       1       6
## 4       NA       NA       NA       NA       NA       NA       1       5
## 5       NA       NA       NA       NA       NA       NA       1       4
##   edulvlmb eiscedm edlvmeat edlvmebe edlvmehr edlvmgcy edlvmdfi edlvmdfr
## 1      212       2        3       NA       NA       NA       NA       NA
## 2      322       3        6       NA       NA       NA       NA       NA
## 3      322       3        7       NA       NA       NA       NA       NA
## 4      212       2        3       NA       NA       NA       NA       NA
## 5      212       2        3       NA       NA       NA       NA       NA
##   edumcde1 edumbde2 edlvmegr edlvmdahu edlvmdis edlvmdie edlvmfit edlvmdlt
## 1       NA       NA       NA        NA       NA       NA       NA       NA
## 2       NA       NA       NA        NA       NA       NA       NA       NA
## 3       NA       NA       NA        NA       NA       NA       NA       NA
## 4       NA       NA       NA        NA       NA       NA       NA       NA
## 5       NA       NA       NA        NA       NA       NA       NA       NA
##   edlvmenl edlvmeno edlvmgpl edlvmept edlvmdrs edlvmdsk edlvmesi edlvmges
## 1       NA       NA       NA       NA       NA       NA       NA       NA
## 2       NA       NA       NA       NA       NA       NA       NA       NA
## 3       NA       NA       NA       NA       NA       NA       NA       NA
## 4       NA       NA       NA       NA       NA       NA       NA       NA
## 5       NA       NA       NA       NA       NA       NA       NA       NA
##   edlvmdse edlvmdch edumcgb1 edumbgb2 edagemgb emprm14 occm14b atncrse anctrya1
## 1       NA       NA       NA       NA       NA       2       9       2    11010
## 2       NA       NA       NA       NA       NA       2       9       2    11010
## 3       NA       NA       NA       NA       NA       3      66       1    11010
## 4       NA       NA       NA       NA       NA       1       4       2    14090
## 5       NA       NA       NA       NA       NA       1       7       2    11010
##   anctrya2 regunit region ipcrtiva impricha ipeqopta ipshabta impsafea impdiffa
## 1   555555       2   AT31        3        5        2        2        2        4
## 2   555555       2   AT22        2        4        2        4        4        4
## 3    11070       2   AT33        1        4        1        3        2        4
## 4    11010       2   AT31        3        4        2        3        1        4
## 5    11018       2   AT32        3        4        2        2        2        4
##   ipfrulea ipudrsta ipmodsta ipgdtima impfreea iphlppla ipsucesa ipstrgva
## 1        2        2        2        2        2        2        3        2
## 2        4        2        2        2        2        1        4        2
## 3        3        1        3        3        2        1        3        2
## 4        3        3        2        3        2        2        3        3
## 5        5        2        3        3        2        2        2        2
##   ipadvnta ipbhprpa iprspota iplylfra impenva imptrada impfuna testji1 testji2
## 1        5        2        2        2       2        3       3       6       6
## 2        4        2        4        1       1        4       2       6       6
## 3        4        3        3        1       1        3       2       6       6
## 4        4        3        3        2       2        2       3       6       6
## 5        4        2        2        2       2        2       2       6       6
##   testji3 testji4 testji5 testji6 testji7 testji8 testji9 respc19a symtc19
## 1       6       3       3       2      66      66      66        1       2
## 2       6       6       6       6      10       2       2        1       2
## 3       6       8       8       8      66      66      66        1       2
## 4       6       1       1       1      66      66      66        1       2
## 5       6       6       6       6       8       4       3        3       6
##   symtnc19 vacc19 recon               inwds               ainws
## 1        6      1     2 2023-11-12 14:49:50 2023-11-12 14:49:50
## 2        6      1     1 2023-10-18 09:56:32 2023-10-18 09:56:32
## 3        6      1     1 2023-09-30 13:22:49 2023-09-30 13:22:49
## 4        6      1     2 2023-06-30 14:31:46 2023-06-30 14:31:46
## 5        6      1     2 2023-07-11 10:11:00 2023-07-11 10:11:00
##                 ainwe               binwe               cinwe
## 1 2023-11-12 14:50:23 2023-11-12 15:01:14 2023-11-12 15:03:07
## 2 2023-10-18 09:58:32 2023-10-18 10:07:21 2023-10-18 10:11:42
## 3 2023-09-30 13:24:24 2023-09-30 13:34:23 2023-09-30 13:41:50
## 4 2023-06-30 14:32:40 2023-06-30 14:42:30 2023-06-30 14:50:31
## 5 2023-07-11 10:13:36 2023-07-11 10:18:33 2023-07-11 10:23:56
##                 dinwe               einwe               finwe
## 1 2023-11-12 15:08:28 2023-11-12 15:14:58 2023-11-12 15:18:41
## 2 2023-10-18 10:19:27 2023-10-18 10:25:47 2023-10-18 10:32:34
## 3 2023-09-30 13:50:25 2023-09-30 13:56:10 2023-09-30 14:03:15
## 4 2023-06-30 14:53:56 2023-06-30 14:57:00 2023-06-30 15:04:03
## 5 2023-07-11 10:43:23 2023-07-11 10:56:16 2023-07-11 11:03:31
##                 hinwe               iinwe               kinwe rinwe
## 1 2023-11-12 15:20:19 2023-11-12 15:20:37 2023-11-12 15:20:46      
## 2 2023-10-18 10:36:39 2023-10-18 10:37:18 2023-10-18 10:37:49      
## 3 2023-09-30 14:05:12 2023-09-30 14:05:27 2023-09-30 14:05:41      
## 4 2023-06-30 15:05:22 2023-06-30 15:05:41 2023-06-30 15:06:02      
## 5 2023-07-11 11:07:49 2023-07-11 11:08:12 2023-07-11 11:08:26      
##                 inwde               jinws               jinwe inwtm mode domain
## 1 2023-11-12 15:26:55 2023-11-12 15:21:28 2023-11-12 15:26:55    30    1      2
## 2 2023-10-18 10:44:18 2023-10-18 10:42:22 2023-10-18 10:44:18    40    1      1
## 3 2023-09-30 14:13:33 2023-09-30 14:08:31 2023-09-30 14:13:33    42    1      2
## 4 2023-06-30 15:11:21 2023-06-30 15:08:05 2023-06-30 15:11:21    34    1      1
## 5 2023-07-11 11:14:03 2023-07-11 11:10:02 2023-07-11 11:14:03    57    1      2
##           prob stratum psu
## 1 0.0005786479     107 317
## 2 0.0011243912      69 128
## 3 0.0004925300      18 418
## 4 0.0012332522     101 295
## 5 0.0009487666     115 344

Data Preprocessing

Remove unecessary variables

remove_admin_var <- c("recon", "inwds", "ainws", "ainwe", "binwe", "cinwe", "dinwe", 
                    "einwe", "finwe", "hinwe", "iinwe", "kinwe", "rinwe", "inwde", 
                    "jinws", "jinwe", "inwtm")

remove_stats_var <- c("domain", "prob", "stratum","psu","name","essround","edition","proddate","idno")

remove_covid19 <- c("respc19a", "symtc19", "symtnc19", "vacc19")

data <- data %>% select(-all_of(remove_admin_var))
data <- data %>% select(-all_of(remove_stats_var))
data <- data %>% select(-all_of(remove_covid19))

Features Selection

I selected these variables to capture a comprehensive view of financial perception, combining demographic, economic, political, and subjective factors. My goal is to understand how personal characteristics, employment conditions, social trust, and psychological well-being influence financial stability across different income levels.

1. Socio-Demographics - gndr, agea, marsts: Individual characteristics affecting financial perception.
- cntry, region, cntbrthd: Geographic and migration effects on economic well-being.
- hhmmb, chldhhe, domicil: Household structure impacts financial security.

2. Socio-Economics - eisced, edulvlb, edulvlpb: Education levels influence job opportunities and income.
- emplrel, emprelp, wrkctra: Employment stability determines financial security.
- fnsdfml, hinctnta, hincfel, hincsrca: Direct measures of income and financial well-being.
- uemp12m, uemp5yr, pdjobev, pdwrkp, isco08, isco08p, tporgwk, wkhtotp: Work history, job type, and work hours impact financial resilience.

3. Socio-Political - netusoft: Media exposure shapes financial perspectives.
- ppltrst, pplfair, pplhlp: Social trust influences financial behavior.
- polintr, psppsgva, actrolga, psppipla, vote, lrscale: Political engagement links to financial stability.
- trstprl, trstlgl, trstplt, trstprt, trstep: Institutional trust may impact economic security.
- gincdif, stfdem, freehms, hmsfmlsh, hmsacld, euftf, imbgeco, imueclt, imwbcnt: Perceptions of economy, housing, and inclusivity relate to financial well-being.

4. Subjectiveness and Human Values - happy, enjlf: Life satisfaction influences financial perception.
- ctrlife, fltdpr, flteeff, fltlnl, fltsd: Psychological factors affect economic decision-making.
- dscrgrp, dscrrce, dscrntn, dscrrlg, dscretn, dscrgnd, dscrsex: Perceived discrimination may impact financial opportunities.
- impricha, ipeqopta, impdiffa, impsafea, ipfrulea, ipudrsta: Personal values shape financial and social behaviors.

data_selected <- data %>% 
  select(
    # 1. Socio-Demographics - Age, Gender, Marital Status, Country, Country of Birth, Household Size, Ever had Child?, Domicile size
      gndr, agea, marsts, cntry, region, cntbrthd, hhmmb, chldhhe, domicil,

    # 2. Socio-Economics: Education Level, Employment Status, Occupation-Related, Income-Related
    eisced, edulvlb, emplrel, fnsdfml, uemp12m, uemp5yr, emprelp, pdjobev, edulvlpb, wrkctra, isco08, isco08p, tporgwk, pdwrkp, hinctnta, hincfel, wkhtotp, hincsrca,

    # 3. Socio-Political: Media Exposure, Social Trust, Political Trust, Democracy Perception, Perception for Minorities
    netusoft, ppltrst, pplfair, pplhlp, polintr, psppsgva, actrolga, psppipla, trstprl, trstlgl, trstplt, trstprt, trstep,        vote, lrscale, gincdif, stfdem, freehms, hmsfmlsh, hmsacld, euftf, imbgeco, imueclt, imwbcnt, 
    
    # 4 Subjectiveness and Human Values
    happy, dscrgrp, dscrrce, dscrntn, dscrrlg, dscretn, dscrgnd, dscrsex, ctrlife, fltdpr, flteeff, fltlnl, enjlf, fltsd, impricha, ipeqopta, impdiffa, impsafea, ipfrulea,  ipudrsta
    )

Check Missing Values Before Conversion

Because there are so many NAs (missing values) I’m looking to see which variables has the highest percentage of missing value. Later, I’m removing values that are not correlated

na_counts_before <- colSums(is.na(data_selected))
na_columns_before <- na_counts_before[na_counts_before > 0]
na_percentage_before <- (na_columns_before / nrow(data_selected)) * 100
na_summary_before <- data.frame(Variable = names(na_columns_before), 
                                NA_Count = na_columns_before, 
                                NA_Percentage_From_Total = na_percentage_before)

na_summary_before
##          Variable NA_Count NA_Percentage_From_Total
## cntbrthd cntbrthd        3              0.007470864

From this we can see that only one variable (cntbrthd) has missing values and it’s very low so we are good to proceed.

Checking Unique Values in each variables

unique_values <- lapply(data_selected, unique)

unique_values_df <- data.frame(
  Variable = names(unique_values),
  Unique_Values = sapply(unique_values, function(x) paste(head(x, 10), collapse = ", ")),
  Unique_Count = sapply(data_selected, function(x) length(unique(x))) 
)

unique_values_df
##          Variable                                               Unique_Values
## gndr         gndr                                                        1, 2
## agea         agea                      65, 21, 53, 78, 64, 59, 77, 69, 52, 75
## marsts     marsts                            66, 6, 4, 5, 1, 2, 77, 88, 99, 3
## cntry       cntry                      AT, BE, CH, CY, DE, ES, FI, FR, GB, GR
## region     region  AT31, AT22, AT33, AT32, AT12, AT11, AT13, AT34, AT21, BE24
## cntbrthd cntbrthd                    6666, RO, CZ, IR, MA, MK, DE, XK, RS, SI
## hhmmb       hhmmb                               2, 1, 3, 4, 5, 7, 0, 6, 8, 77
## chldhhe   chldhhe                                            1, 2, 6, 7, 9, 8
## domicil   domicil                                      3, 1, 4, 5, 2, 8, 7, 9
## eisced     eisced                             3, 5, 6, 4, 2, 7, 55, 1, 77, 88
## edulvlb   edulvlb            322, 423, 610, 422, 313, 212, 720, 213, 520, 710
## emplrel   emplrel                                         6, 1, 2, 3, 7, 8, 9
## fnsdfml   fnsdfml                                      5, 4, 2, 3, 1, 7, 8, 9
## uemp12m   uemp12m                                            6, 2, 1, 7, 8, 9
## uemp5yr   uemp5yr                                            6, 2, 1, 7, 9, 8
## emprelp   emprelp                                         6, 1, 2, 3, 9, 8, 7
## pdjobev   pdjobev                                            2, 1, 6, 7, 9, 8
## edulvlpb edulvlpb           322, 6666, 520, 720, 313, 610, 113, 212, 423, 422
## wrkctra   wrkctra                                         6, 2, 1, 3, 8, 9, 7
## isco08     isco08 66666, 5249, 2635, 2221, 5223, 1112, 8219, 2330, 4226, 9629
## isco08p   isco08p 66666, 2635, 3321, 3343, 4110, 7412, 2149, 2341, 5246, 5223
## tporgwk   tporgwk                            66, 4, 6, 2, 1, 5, 3, 88, 77, 99
## pdwrkp     pdwrkp                                                        0, 1
## hinctnta hinctnta                              6, 1, 5, 2, 77, 9, 3, 10, 8, 4
## hincfel   hincfel                                         1, 2, 4, 3, 8, 7, 9
## wkhtotp   wkhtotp                      666, 1, 88, 77, 45, 40, 39, 50, 32, 38
## hincsrca hincsrca                              4, 8, 1, 5, 2, 3, 6, 7, 77, 88
## netusoft netusoft                                      5, 1, 2, 3, 4, 7, 8, 9
## ppltrst   ppltrst                               5, 10, 6, 8, 7, 3, 4, 2, 1, 9
## pplfair   pplfair                               5, 0, 9, 6, 3, 8, 7, 4, 2, 10
## pplhlp     pplhlp                               5, 1, 8, 6, 4, 7, 3, 9, 2, 10
## polintr   polintr                                         1, 2, 3, 4, 8, 9, 7
## psppsgva psppsgva                                      4, 3, 2, 1, 7, 8, 5, 9
## actrolga actrolga                                      5, 2, 4, 1, 3, 8, 7, 9
## psppipla psppipla                                      4, 3, 2, 1, 5, 8, 7, 9
## trstprl   trstprl                               6, 7, 5, 3, 9, 8, 2, 4, 0, 77
## trstlgl   trstlgl                              9, 6, 5, 8, 7, 4, 2, 88, 3, 10
## trstplt   trstplt                                5, 1, 4, 3, 7, 8, 6, 9, 0, 2
## trstprt   trstprt                                5, 0, 4, 3, 6, 2, 8, 9, 7, 1
## trstep     trstep                               5, 7, 4, 6, 8, 2, 3, 88, 0, 1
## vote         vote                                            1, 2, 3, 7, 8, 9
## lrscale   lrscale                              5, 0, 3, 2, 4, 77, 6, 88, 9, 7
## gincdif   gincdif                                      2, 1, 3, 5, 8, 7, 4, 9
## stfdem     stfdem                                6, 7, 8, 3, 9, 0, 4, 1, 2, 5
## freehms   freehms                                      2, 1, 3, 4, 5, 7, 8, 9
## hmsfmlsh hmsfmlsh                                      4, 5, 3, 2, 7, 8, 1, 9
## hmsacld   hmsacld                                      3, 1, 2, 4, 8, 5, 7, 9
## euftf       euftf                              6, 9, 7, 5, 10, 3, 1, 4, 8, 88
## imbgeco   imbgeco                              7, 6, 9, 10, 5, 88, 8, 3, 1, 4
## imueclt   imueclt                               3, 5, 9, 6, 10, 8, 0, 7, 4, 1
## imwbcnt   imwbcnt                               5, 9, 8, 10, 6, 2, 7, 0, 3, 4
## happy       happy                               8, 9, 7, 5, 10, 6, 3, 4, 0, 1
## dscrgrp   dscrgrp                                               2, 1, 7, 8, 9
## dscrrce   dscrrce                                                        0, 1
## dscrntn   dscrntn                                                        0, 1
## dscrrlg   dscrrlg                                                        0, 1
## dscretn   dscretn                                                        0, 1
## dscrgnd   dscrgnd                                                        0, 1
## dscrsex   dscrsex                                                        0, 1
## ctrlife   ctrlife                               8, 9, 6, 10, 5, 7, 4, 2, 1, 3
## fltdpr     fltdpr                                         1, 2, 3, 4, 8, 7, 9
## flteeff   flteeff                                         1, 2, 3, 8, 4, 7, 9
## fltlnl     fltlnl                                         1, 3, 2, 4, 8, 7, 9
## enjlf       enjlf                                         3, 4, 2, 1, 8, 7, 9
## fltsd       fltsd                                         1, 2, 3, 4, 8, 7, 9
## impricha impricha                            5, 4, 2, 6, 3, 88, 77, 1, 66, 99
## ipeqopta ipeqopta                            2, 1, 3, 88, 4, 5, 6, 77, 66, 99
## impdiffa impdiffa                            4, 2, 3, 1, 88, 6, 5, 77, 66, 99
## impsafea impsafea                            2, 4, 1, 3, 88, 77, 5, 6, 66, 99
## ipfrulea ipfrulea                            2, 4, 3, 5, 1, 88, 6, 77, 66, 99
## ipudrsta ipudrsta                            2, 1, 3, 4, 88, 5, 6, 77, 66, 99
##          Unique_Count
## gndr                2
## agea               77
## marsts             10
## cntry              24
## region            264
## cntbrthd          196
## hhmmb              16
## chldhhe             6
## domicil             8
## eisced             11
## edulvlb            31
## emplrel             7
## fnsdfml             8
## uemp12m             6
## uemp5yr             6
## emprelp             7
## pdjobev             6
## edulvlpb           32
## wrkctra             7
## isco08            568
## isco08p           523
## tporgwk            10
## pdwrkp              2
## hinctnta           13
## hincfel             7
## wkhtotp            95
## hincsrca           11
## netusoft            8
## ppltrst            14
## pplfair            14
## pplhlp             14
## polintr             7
## psppsgva            8
## actrolga            8
## psppipla            8
## trstprl            14
## trstlgl            14
## trstplt            14
## trstprt            14
## trstep             14
## vote                6
## lrscale            14
## gincdif             8
## stfdem             14
## freehms             8
## hmsfmlsh            8
## hmsacld             8
## euftf              14
## imbgeco            14
## imueclt            14
## imwbcnt            14
## happy              14
## dscrgrp             5
## dscrrce             2
## dscrntn             2
## dscrrlg             2
## dscretn             2
## dscrgnd             2
## dscrsex             2
## ctrlife            14
## fltdpr              7
## flteeff             7
## fltlnl              7
## enjlf               7
## fltsd               7
## impricha           10
## ipeqopta           10
## impdiffa           10
## impsafea           10
## ipfrulea           10
## ipudrsta           10

This table above indicate that there are some variables that have obscenely high unique value counts within them. Upon doing rechecks, I discover that some of them are designed to have multiple levels within, although some e.g. age (agea), number of people living regularly as member of household (hhmmb), hours normally worked a week in main job overtime included, partner (wkhtotp) are inherently numerical. Thus, I have to do further preprocessing on those features, before converting them into transactional format.

Inspection Consequent Variable

str(data_selected$hincfel)
##  int [1:40156] 1 2 1 2 2 1 2 1 2 2 ...

From here we can see that hincfel or “Feeling about household’s income nowadays” is categorized into 7 levels. For the purpose of this project, I am keeping only 4

  • 1 Living comfortably on present income
  • 2 Coping on present income
  • 3 Difficult on present income
  • 4 Very difficult on present income

Next I am converting all of the variables to factor before converting to transaction.

vars_exclude <- c("agea", "hhmmb", "wkhtotp")

data_selected <- data_selected %>%
  mutate(across(-all_of(vars_exclude), as.factor))
str(data_selected$agea)
##  int [1:40156] 65 21 53 78 64 59 77 69 52 75 ...
str(data_selected$hhmmb)
##  int [1:40156] 2 1 3 1 2 2 1 2 3 2 ...
str(data_selected$wkhtotp)
##  int [1:40156] 666 666 1 666 666 1 666 666 1 666 ...

Encoding Variables

Firstly, there are some invalid values within this dataset, so I have to filter them out.

# Handle invalid values for hhmmb (Household members)
data_selected$hhmmb[data_selected$hhmmb %in% c(77, 88, 99)] <- NA

# Handle invalid values for agea (Age)
data_selected$agea[data_selected$agea > 120 | data_selected$agea == 999] <- NA  # Age should be realistic

# Handle invalid values for wkhtotp (Weekly working hours)
data_selected$wkhtotp[data_selected$wkhtotp > 168 | data_selected$wkhtotp %in% c(666, 777, 888, 999)] <- NA

Then I proceed with the encoding

data_selected <- data_selected %>%
  mutate(agea = case_when(
    agea < 18 ~ "Under 18",
    agea >= 18 & agea <= 29 ~ "18-29",
    agea >= 30 & agea <= 39 ~ "30-39",
    agea >= 40 & agea <= 49 ~ "40-49",
    agea >= 50 & agea <= 59 ~ "50-59",
    agea >= 60 & agea <= 69 ~ "60-69",
    agea >= 70 ~ "70+",
    TRUE ~ as.character(NA)  # Keeps NA for missing or invalid values
  )) 

data_selected <- data_selected %>%
  mutate(wkhtotp = case_when(
    wkhtotp == 0 ~ "Unemployed / No Work",
    wkhtotp > 0 & wkhtotp <= 10 ~ "1-10 hrs (Very Part-Time)",
    wkhtotp > 10 & wkhtotp <= 20 ~ "11-20 hrs (Part-Time)",
    wkhtotp > 20 & wkhtotp <= 35 ~ "21-35 hrs (Reduced Full-Time)",
    wkhtotp > 35 & wkhtotp <= 45 ~ "36-45 hrs (Standard Full-Time)",
    wkhtotp > 45 & wkhtotp <= 60 ~ "46-60 hrs (Overtime Heavy)",
    wkhtotp > 60 & wkhtotp <= 80 ~ "61-80 hrs (Extreme Workload)",
    wkhtotp > 80 & wkhtotp <= 168 ~ "80+ hrs (Workaholic)",
    TRUE ~ as.character(NA)  # Keeps NA for missing or invalid values
  ))

data_selected <- data_selected %>%
  mutate(hhmmb = case_when(
    hhmmb == 1 ~ "Living Alone",
    hhmmb == 2 ~ "Couple / Two People",
    hhmmb >= 3 & hhmmb <= 4 ~ "Small Household (3-4)",
    hhmmb >= 5 & hhmmb <= 6 ~ "Medium Household (5-6)",
    hhmmb >= 7 ~ "Large Household (7+)",
    TRUE ~ as.character(NA)  # Keeps NA for missing or invalid values
  ))


data_selected$agea <- as.factor(data_selected$agea)
data_selected$wkhtotp <- as.factor(data_selected$wkhtotp)
data_selected$hhmmb <- as.factor(data_selected$hhmmb)

Read as Transaction

data_transaction <- as(data_selected, "transactions")
summary(data_transaction)
## transactions as itemMatrix in sparse format with
##  40156 rows (elements/itemsets/transactions) and
##  2197 columns (items) and a density of 0.03200523 
## 
## most frequent items:
## dscretn=0 dscrsex=0 dscrrce=0 dscrrlg=0 dscrntn=0   (Other) 
##     39767     39767     39675     39660     39575   2625145 
## 
## element (itemset/transaction) length distribution:
## sizes
##    68    69    70    71 
##    38   369 26635 13114 
## 
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   68.00   70.00   70.00   70.32   71.00   71.00 
## 
## includes extended item information - examples:
##       labels variables levels
## 1     gndr=1      gndr      1
## 2     gndr=2      gndr      2
## 3 agea=18-29      agea  18-29
## 
## includes extended transaction information - examples:
##   transactionID
## 1             1
## 2             2
## 3             3
inspect(data_transaction[1:5]) 
##     items                                transactionID
## [1] {gndr=1,                                          
##      agea=60-69,                                      
##      marsts=66,                                       
##      cntry=AT,                                        
##      region=AT31,                                     
##      cntbrthd=6666,                                   
##      hhmmb=Couple / Two People,                       
##      chldhhe=1,                                       
##      domicil=3,                                       
##      eisced=3,                                        
##      edulvlb=322,                                     
##      emplrel=6,                                       
##      fnsdfml=5,                                       
##      uemp12m=6,                                       
##      uemp5yr=6,                                       
##      emprelp=6,                                       
##      pdjobev=2,                                       
##      edulvlpb=322,                                    
##      wrkctra=6,                                       
##      isco08=66666,                                    
##      isco08p=66666,                                   
##      tporgwk=66,                                      
##      pdwrkp=0,                                        
##      hinctnta=6,                                      
##      hincfel=1,                                       
##      hincsrca=4,                                      
##      netusoft=5,                                      
##      ppltrst=5,                                       
##      pplfair=5,                                       
##      pplhlp=5,                                        
##      polintr=1,                                       
##      psppsgva=4,                                      
##      actrolga=5,                                      
##      psppipla=4,                                      
##      trstprl=6,                                       
##      trstlgl=9,                                       
##      trstplt=5,                                       
##      trstprt=5,                                       
##      trstep=5,                                        
##      vote=1,                                          
##      lrscale=5,                                       
##      gincdif=2,                                       
##      stfdem=6,                                        
##      freehms=2,                                       
##      hmsfmlsh=4,                                      
##      hmsacld=3,                                       
##      euftf=6,                                         
##      imbgeco=7,                                       
##      imueclt=3,                                       
##      imwbcnt=5,                                       
##      happy=8,                                         
##      dscrgrp=2,                                       
##      dscrrce=0,                                       
##      dscrntn=0,                                       
##      dscrrlg=0,                                       
##      dscretn=0,                                       
##      dscrgnd=0,                                       
##      dscrsex=0,                                       
##      ctrlife=8,                                       
##      fltdpr=1,                                        
##      flteeff=1,                                       
##      fltlnl=1,                                        
##      enjlf=3,                                         
##      fltsd=1,                                         
##      impricha=5,                                      
##      ipeqopta=2,                                      
##      impdiffa=4,                                      
##      impsafea=2,                                      
##      ipfrulea=2,                                      
##      ipudrsta=2}                                     1
## [2] {gndr=2,                                          
##      agea=18-29,                                      
##      marsts=6,                                        
##      cntry=AT,                                        
##      region=AT22,                                     
##      cntbrthd=6666,                                   
##      hhmmb=Living Alone,                              
##      chldhhe=2,                                       
##      domicil=1,                                       
##      eisced=5,                                        
##      edulvlb=423,                                     
##      emplrel=1,                                       
##      fnsdfml=4,                                       
##      uemp12m=6,                                       
##      uemp5yr=6,                                       
##      emprelp=6,                                       
##      pdjobev=1,                                       
##      edulvlpb=6666,                                   
##      wrkctra=2,                                       
##      isco08=5249,                                     
##      isco08p=66666,                                   
##      tporgwk=4,                                       
##      pdwrkp=0,                                        
##      hinctnta=1,                                      
##      hincfel=2,                                       
##      hincsrca=8,                                      
##      netusoft=5,                                      
##      ppltrst=10,                                      
##      pplfair=0,                                       
##      pplhlp=1,                                        
##      polintr=2,                                       
##      psppsgva=3,                                      
##      actrolga=2,                                      
##      psppipla=3,                                      
##      trstprl=6,                                       
##      trstlgl=6,                                       
##      trstplt=1,                                       
##      trstprt=0,                                       
##      trstep=5,                                        
##      vote=1,                                          
##      lrscale=0,                                       
##      gincdif=1,                                       
##      stfdem=7,                                        
##      freehms=1,                                       
##      hmsfmlsh=5,                                      
##      hmsacld=1,                                       
##      euftf=9,                                         
##      imbgeco=6,                                       
##      imueclt=5,                                       
##      imwbcnt=9,                                       
##      happy=9,                                         
##      dscrgrp=2,                                       
##      dscrrce=0,                                       
##      dscrntn=0,                                       
##      dscrrlg=0,                                       
##      dscretn=0,                                       
##      dscrgnd=0,                                       
##      dscrsex=0,                                       
##      ctrlife=8,                                       
##      fltdpr=2,                                        
##      flteeff=2,                                       
##      fltlnl=3,                                        
##      enjlf=4,                                         
##      fltsd=2,                                         
##      impricha=4,                                      
##      ipeqopta=2,                                      
##      impdiffa=4,                                      
##      impsafea=4,                                      
##      ipfrulea=4,                                      
##      ipudrsta=2}                                     2
## [3] {gndr=2,                                          
##      agea=50-59,                                      
##      marsts=66,                                       
##      cntry=AT,                                        
##      region=AT33,                                     
##      cntbrthd=6666,                                   
##      hhmmb=Small Household (3-4),                     
##      chldhhe=6,                                       
##      domicil=3,                                       
##      eisced=6,                                        
##      edulvlb=610,                                     
##      emplrel=1,                                       
##      fnsdfml=2,                                       
##      uemp12m=6,                                       
##      uemp5yr=6,                                       
##      emprelp=1,                                       
##      pdjobev=6,                                       
##      edulvlpb=520,                                    
##      wrkctra=1,                                       
##      isco08=2635,                                     
##      isco08p=2635,                                    
##      tporgwk=6,                                       
##      pdwrkp=1,                                        
##      hinctnta=5,                                      
##      hincfel=1,                                       
##      wkhtotp=1-10 hrs (Very Part-Time),               
##      hincsrca=1,                                      
##      netusoft=5,                                      
##      ppltrst=6,                                       
##      pplfair=9,                                       
##      pplhlp=8,                                        
##      polintr=2,                                       
##      psppsgva=4,                                      
##      actrolga=4,                                      
##      psppipla=4,                                      
##      trstprl=7,                                       
##      trstlgl=5,                                       
##      trstplt=4,                                       
##      trstprt=4,                                       
##      trstep=7,                                        
##      vote=1,                                          
##      lrscale=3,                                       
##      gincdif=1,                                       
##      stfdem=6,                                        
##      freehms=1,                                       
##      hmsfmlsh=5,                                      
##      hmsacld=1,                                       
##      euftf=7,                                         
##      imbgeco=9,                                       
##      imueclt=9,                                       
##      imwbcnt=8,                                       
##      happy=9,                                         
##      dscrgrp=1,                                       
##      dscrrce=0,                                       
##      dscrntn=0,                                       
##      dscrrlg=0,                                       
##      dscretn=0,                                       
##      dscrgnd=1,                                       
##      dscrsex=0,                                       
##      ctrlife=9,                                       
##      fltdpr=2,                                        
##      flteeff=2,                                       
##      fltlnl=1,                                        
##      enjlf=3,                                         
##      fltsd=1,                                         
##      impricha=4,                                      
##      ipeqopta=1,                                      
##      impdiffa=4,                                      
##      impsafea=2,                                      
##      ipfrulea=3,                                      
##      ipudrsta=1}                                     3
## [4] {gndr=2,                                          
##      agea=70+,                                        
##      marsts=4,                                        
##      cntry=AT,                                        
##      region=AT31,                                     
##      cntbrthd=RO,                                     
##      hhmmb=Living Alone,                              
##      chldhhe=1,                                       
##      domicil=1,                                       
##      eisced=5,                                        
##      edulvlb=422,                                     
##      emplrel=1,                                       
##      fnsdfml=3,                                       
##      uemp12m=6,                                       
##      uemp5yr=6,                                       
##      emprelp=6,                                       
##      pdjobev=1,                                       
##      edulvlpb=6666,                                   
##      wrkctra=1,                                       
##      isco08=2221,                                     
##      isco08p=66666,                                   
##      tporgwk=2,                                       
##      pdwrkp=0,                                        
##      hinctnta=2,                                      
##      hincfel=2,                                       
##      hincsrca=4,                                      
##      netusoft=1,                                      
##      ppltrst=6,                                       
##      pplfair=6,                                       
##      pplhlp=6,                                        
##      polintr=3,                                       
##      psppsgva=2,                                      
##      actrolga=2,                                      
##      psppipla=2,                                      
##      trstprl=5,                                       
##      trstlgl=6,                                       
##      trstplt=3,                                       
##      trstprt=3,                                       
##      trstep=4,                                        
##      vote=2,                                          
##      lrscale=5,                                       
##      gincdif=1,                                       
##      stfdem=6,                                        
##      freehms=2,                                       
##      hmsfmlsh=4,                                      
##      hmsacld=3,                                       
##      euftf=5,                                         
##      imbgeco=6,                                       
##      imueclt=6,                                       
##      imwbcnt=5,                                       
##      happy=7,                                         
##      dscrgrp=2,                                       
##      dscrrce=0,                                       
##      dscrntn=0,                                       
##      dscrrlg=0,                                       
##      dscretn=0,                                       
##      dscrgnd=0,                                       
##      dscrsex=0,                                       
##      ctrlife=8,                                       
##      fltdpr=2,                                        
##      flteeff=2,                                       
##      fltlnl=2,                                        
##      enjlf=2,                                         
##      fltsd=2,                                         
##      impricha=4,                                      
##      ipeqopta=2,                                      
##      impdiffa=4,                                      
##      impsafea=1,                                      
##      ipfrulea=3,                                      
##      ipudrsta=3}                                     4
## [5] {gndr=1,                                          
##      agea=60-69,                                      
##      marsts=66,                                       
##      cntry=AT,                                        
##      region=AT32,                                     
##      cntbrthd=6666,                                   
##      hhmmb=Couple / Two People,                       
##      chldhhe=1,                                       
##      domicil=4,                                       
##      eisced=3,                                        
##      edulvlb=322,                                     
##      emplrel=1,                                       
##      fnsdfml=5,                                       
##      uemp12m=6,                                       
##      uemp5yr=6,                                       
##      emprelp=6,                                       
##      pdjobev=1,                                       
##      edulvlpb=322,                                    
##      wrkctra=1,                                       
##      isco08=5223,                                     
##      isco08p=66666,                                   
##      tporgwk=4,                                       
##      pdwrkp=0,                                        
##      hinctnta=77,                                     
##      hincfel=2,                                       
##      hincsrca=4,                                      
##      netusoft=5,                                      
##      ppltrst=6,                                       
##      pplfair=3,                                       
##      pplhlp=8,                                        
##      polintr=2,                                       
##      psppsgva=3,                                      
##      actrolga=1,                                      
##      psppipla=4,                                      
##      trstprl=6,                                       
##      trstlgl=8,                                       
##      trstplt=5,                                       
##      trstprt=5,                                       
##      trstep=6,                                        
##      vote=1,                                          
##      lrscale=2,                                       
##      gincdif=2,                                       
##      stfdem=8,                                        
##      freehms=2,                                       
##      hmsfmlsh=4,                                      
##      hmsacld=2,                                       
##      euftf=10,                                        
##      imbgeco=10,                                      
##      imueclt=10,                                      
##      imwbcnt=10,                                      
##      happy=9,                                         
##      dscrgrp=2,                                       
##      dscrrce=0,                                       
##      dscrntn=0,                                       
##      dscrrlg=0,                                       
##      dscretn=0,                                       
##      dscrgnd=0,                                       
##      dscrsex=0,                                       
##      ctrlife=9,                                       
##      fltdpr=1,                                        
##      flteeff=1,                                       
##      fltlnl=1,                                        
##      enjlf=3,                                         
##      fltsd=1,                                         
##      impricha=4,                                      
##      ipeqopta=2,                                      
##      impdiffa=4,                                      
##      impsafea=2,                                      
##      ipfrulea=5,                                      
##      ipudrsta=2}                                     5

Top Frequent Items

itemFrequencyPlot(data_transaction, topN=20, type="absolute", main="Top 25 Most Frequent Items")

I notice that lack of reported discrimination (dscreth=0, dscrsex=0, dscrrce=0, etc.), foreign-born status (cntbrthd=6666), and long-term unemployment (uemp5yr=6, uemp12m=6) are highly prevalent. Additionally, job instability (isco08p=66666, emprelp=6, wrkctra=1), political participation (vote=1), and low digital engagement (netusoft=5) frequently appear. These attributes likely play a crucial role in shaping association rules, influencing how different socio-economic factors relate to financial perception.

Rule Discovery - Apriori algorithm

Apriori algorith is used to mine the association rules between each transactions. As mentioned, the rule consequent has been set up as such.

First Rule - Comfortable with their Present Income

Feeling about household’s income nowadays: “Living comfortably on present income” Threshold that I have set for this particular consequent are as follows:

  • Support (supp = 0.01): Ensures that rules appear in at least 1% of transactions, filtering out extremely rare patterns while keeping significant ones.
  • Confidence (conf = 0.6): Requires rules to be at least 60% reliable, meaning that when antecedents occur, the consequent (hincfel=1) follows 60% of the time.
rules_comfortable <- apriori(data_transaction, 
                 parameter = list(supp = 0.01, conf = 0.6, minlen = 2),
                 appearance = list(rhs = "hincfel=1", default = "lhs"),
                 control = list(verbose = FALSE))

inspect(sort(rules_comfortable, by = "confidence", decreasing = TRUE)[1:10])
##      lhs                                     rhs         support    confidence
## [1]  {eisced=7, hinctnta=10, hmsacld=1}   => {hincfel=1} 0.01075804 0.8888889 
## [2]  {hinctnta=10, freehms=1, happy=9}    => {hincfel=1} 0.01148023 0.8848369 
## [3]  {hinctnta=10, hmsfmlsh=5, happy=9}   => {hincfel=1} 0.01220241 0.8781362 
## [4]  {hinctnta=10, hmsacld=1, flteeff=1}  => {hincfel=1} 0.01434406 0.8767123 
## [5]  {fnsdfml=5, hinctnta=10, hmsacld=1}  => {hincfel=1} 0.01267557 0.8745704 
## [6]  {tporgwk=4, hinctnta=10, hmsacld=1}  => {hincfel=1} 0.01250125 0.8730435 
## [7]  {hinctnta=10, freehms=1, ctrlife=8}  => {hincfel=1} 0.01177906 0.8726937 
## [8]  {eisced=7, fnsdfml=5, hinctnta=10}   => {hincfel=1} 0.01155494 0.8689139 
## [9]  {hinctnta=10, hmsfmlsh=5, ctrlife=8} => {hincfel=1} 0.01230202 0.8681898 
## [10] {hinctnta=10, pplfair=7, hmsfmlsh=5} => {hincfel=1} 0.01040940 0.8672199 
##      coverage   lift     count
## [1]  0.01210280 2.494529 432  
## [2]  0.01297440 2.483158 461  
## [3]  0.01389581 2.464354 490  
## [4]  0.01636119 2.460358 576  
## [5]  0.01449348 2.454347 509  
## [6]  0.01431916 2.450062 502  
## [7]  0.01349736 2.449080 473  
## [8]  0.01329814 2.438473 464  
## [9]  0.01416974 2.436441 494  
## [10] 0.01200319 2.433719 418

Based on the result obtained from the first consequent condition hincfel=1, which states that people feel, they are living comfortably with their present income, reveal that high income (hinctnta=10) is the strongest predictor, appearing in every rule, indicating that financial stability is essential for comfort. Higher education (eisced=7), financial security (fnsdfml=5), and union membership (tporgwk=4) also play significant roles, suggesting that access to quality education and job stability contribute to financial well-being. Psychological and social factors, including happiness (happy=9), a sense of control over life (ctrlife=8), and fairness perception (pplfair=7), further influence financial comfort, highlighting that financial well-being is not solely income-dependent but also linked to subjective perceptions. Additionally, free housing (freehms=1) and progressive social views (hmsacld=1, support for LGBTQ+ adoption rights) emerge as relevant factors, potentially reflecting the correlation between financial security and social attitudes. With high confidence (86.7%–88.9%) and lift values (~2.4–2.5), these rules confirm that individuals with higher income, education, financial stability, socially-liberal stance, strong social trust, and access to stable housing are significantly more likely to feel financially comfortable.

plot(rules_comfortable[1:10], method = "graph", engine = "igraph")

The graph-based visualization for rules_comfortable (hincfel=1) highlights that high income (hinctnta=10, hinctnta=9), higher education (edulvlpb=710, edulvlpb=720), and residing in wealthier European countries (cntry=NL, cntry=SE, cntry=IS) are key contributors to financial comfort, while the absence of reported racial (dscrrce=0) and national discrimination (dscrntn=0) suggests that economic security in these groups is more strongly linked to education and income rather than experiences of social exclusion.

plot(rules_comfortable, method = "grouped", control = list(k = 20))

The grouped matrix visualization for rules_comfortable (hincfel=1) highlights that high income (hinctnta=10), economic security (imbgeco=8), and strong educational background (edulvlpb=710, edulvlpb=6666) are dominant predictors of financial comfort, while political interest (polintr=3), fairness perception (ipfrulea=2), and perceived economic safety (impsafea=5) also contribute to financial well-being, with larger support values indicating that these patterns are widely observed, and higher lift values suggesting that these factors strongly differentiate those living comfortably from the rest.

Second Rule - Coping with their present Income

Feeling about household’s income nowadays: “Coping on present income” Threshold that I have set for this particular consequent are as follows:

  • Support (supp = 0.01): Ensures that rules appear in at least 1% of transactions, filtering out extremely rare patterns while keeping significant ones.
  • Confidence (conf = 0.6): Requires rules to be at least 60% reliable, meaning that when antecedents occur, the consequent (hincfel=2) follows 60% of the time.
rules_coping <- apriori(data_transaction, 
                 parameter = list(supp = 0.01, conf = 0.6, minlen = 2),
                 appearance = list(rhs = "hincfel=2", default = "lhs"),
                 control = list(verbose = FALSE))

inspect(sort(rules_coping, by = "confidence", decreasing = TRUE)[1:10])
##      lhs                                  rhs         support    confidence
## [1]  {marsts=66, cntry=PL, wrkctra=1}  => {hincfel=2} 0.01108178 0.7685665 
## [2]  {marsts=66, cntry=PL, emplrel=1}  => {hincfel=2} 0.01247634 0.7648855 
## [3]  {cntry=PL, wrkctra=1, flteeff=1}  => {hincfel=2} 0.01038450 0.7637363 
## [4]  {cntry=PL, emplrel=1, fltsd=1}    => {hincfel=2} 0.01200319 0.7626582 
## [5]  {cntry=PL, emplrel=1, ipeqopta=2} => {hincfel=2} 0.01008567 0.7612782 
## [6]  {cntry=PL, wrkctra=1, hincsrca=1} => {hincfel=2} 0.01055882 0.7584973 
## [7]  {cntry=PL, chldhhe=6, dscrgrp=2}  => {hincfel=2} 0.01001096 0.7584906 
## [8]  {cntry=PL, wrkctra=1, fltlnl=1}   => {hincfel=2} 0.01282498 0.7573529 
## [9]  {cntry=PL, vote=1, impsafea=2}    => {hincfel=2} 0.01023508 0.7555147 
## [10] {marsts=66, cntry=PL, fltdpr=1}   => {hincfel=2} 0.01018528 0.7546125 
##      coverage   lift     count
## [1]  0.01441877 1.704360 445  
## [2]  0.01631139 1.696197 501  
## [3]  0.01359697 1.693649 417  
## [4]  0.01573862 1.691258 482  
## [5]  0.01324833 1.688198 405  
## [6]  0.01392071 1.682031 424  
## [7]  0.01319853 1.682016 402  
## [8]  0.01693396 1.679493 515  
## [9]  0.01354717 1.675417 411  
## [10] 0.01349736 1.673416 409

Based on the result obtained from the second consequent condition hincfel=2, which states that people feel, they are coping with their present income, reveal that stable employment (wrkctra=1, unlimited contract; emplrel=1, employee status employed) is a key factor in financial stability, as individuals with steady jobs in Poland (cntry=PL) are significantly more likely to be coping rather than struggling. Psychological resilience (flteeff=1, rarely feeling overwhelmed; fltdpr=1, low depression levels) also plays a major role, suggesting that those with a positive mental state are more likely to manage financially. Additionally, family structure (marsts=66, not in a traditional marriage) and household income sources (hincsrca=1, salary-based income) further contribute to economic stability, reinforcing the importance of both personal and financial security. Social and institutional trust also influence financial perception, as individuals who value safety (impsafea=2) and fairness (pplfair=7) are more likely to report coping rather than experiencing financial hardship. The Polish respondents in these rules exhibit patterns where employment security, psychological well-being, and trust in institutions are critical factors for those managing on their present income. With confidence levels between 75.4%–76.8% and lift values around 1.67–1.70, these rules highlight the importance of job stability and socio-economic perceptions in financial resilience within Poland.

plot(rules_coping[1:10], method = "graph", engine = "igraph")

The graph-based visualization for rules_coping (hincfel=2) shows that living in Poland (cntry=PL), Hungary (cntry=HU), and Lithuania (cntry=LT), having a small household (hhmmb=Small Household (3-4)), and access to free housing (freehms=2) are associated with financial coping, while having an unlimited work contract (wrkctra=1) and moderate political interest (polintr=3) indicate a stable but cautious financial position, with perceived lack of political influence (psppipla=2) and fairness in society (ipfrulea=2) suggesting that while individuals are managing, they may feel disconnected from broader economic and political decision-making.

plot(rules_coping, method = "grouped", control = list(k = 20))

The grouped matrix visualization for rules_coping (hincfel=2) highlights that moderate household income (hinctnta=2), stable but lower-status employment (emprelp=6, isco08p=66666), and small household size (hhmmb=Small Household (3-4)) are key indicators of financial coping, while perceived fairness (ipfrulea=3), social trust (psppsgva=2), and life satisfaction (enjlf=3) suggest a moderate but stable economic outlook, with lower lift values compared to hincfel=1, indicating that coping individuals experience more variability in financial stability.

Third Rule - Feeling difficult on their present income

Feeling about household’s income nowadays: “Difficult on present income”

Threshold that I have set for this particular consequent are as follows. Additionally, I lower this because I think financial difficulty is less frequent than financial comfort, so a higher threshold would filter out too many potential patterns.

  • Support (supp = 0.005): Lowered to 0.5% to capture less frequent but meaningful patterns, as financial difficulty (hincfel=3) may be less common in the dataset.
  • Confidence (conf = 0.5): Set at 50% to ensure moderately strong rules while allowing for variability in economic hardship factors.
rules_difficult <- apriori(data_transaction, 
                 parameter = list(supp = 0.005, conf = 0.5, minlen = 2),
                 appearance = list(rhs = "hincfel=3", default = "lhs"),
                 control = list(verbose = FALSE))

inspect(sort(rules_difficult, by = "confidence", decreasing = TRUE)[1:10])
##      lhs                                    rhs         support     confidence
## [1]  {region=EL52, uemp12m=6}            => {hincfel=3} 0.005603148 0.5754476 
## [2]  {region=EL52, uemp5yr=6}            => {hincfel=3} 0.005603148 0.5754476 
## [3]  {cntry=GR, region=EL52, uemp12m=6}  => {hincfel=3} 0.005603148 0.5754476 
## [4]  {cntry=GR, region=EL52, uemp5yr=6}  => {hincfel=3} 0.005603148 0.5754476 
## [5]  {region=EL52, uemp12m=6, uemp5yr=6} => {hincfel=3} 0.005603148 0.5754476 
## [6]  {region=EL52, uemp12m=6, dscrgnd=0} => {hincfel=3} 0.005603148 0.5754476 
## [7]  {region=EL52, uemp12m=6, dscrrlg=0} => {hincfel=3} 0.005603148 0.5754476 
## [8]  {region=EL52, uemp12m=6, dscrrce=0} => {hincfel=3} 0.005603148 0.5754476 
## [9]  {region=EL52, uemp12m=6, dscretn=0} => {hincfel=3} 0.005603148 0.5754476 
## [10] {region=EL52, uemp12m=6, dscrsex=0} => {hincfel=3} 0.005603148 0.5754476 
##      coverage    lift     count
## [1]  0.009737026 3.941943 225  
## [2]  0.009737026 3.941943 225  
## [3]  0.009737026 3.941943 225  
## [4]  0.009737026 3.941943 225  
## [5]  0.009737026 3.941943 225  
## [6]  0.009737026 3.941943 225  
## [7]  0.009737026 3.941943 225  
## [8]  0.009737026 3.941943 225  
## [9]  0.009737026 3.941943 225  
## [10] 0.009737026 3.941943 225

Based on the result obtained from the third consequent condition hincfel=3, which states that people feel, they are having difficulties with their present income, reveal that long-term unemployment (uemp12m=6, unemployment lasting 12 months or more) and recent unemployment within the last five years (uemp5yr=6) are strong indicators of financial difficulty. Individuals in Greece (cntry=GR) and specifically in region EL52 (Central Greece Macedonia) are disproportionately represented, suggesting that regional economic conditions significantly impact perceived financial difficulty. Furthermore, discrimination-related factors (dscrrce=0, dscrrlg=0, dscretn=0, dscrsex=0, dscrgnd=0) appear in multiple rules, indicating that individuals who do not perceive discrimination are still struggling financially, pointing to systemic economic challenges rather than social exclusion as the primary driver. With moderate confidence levels (57.5%) but a high lift value of 3.94, these findings suggest that long-term unemployment, regional economic conditions, and systemic financial barriers are critical factors for individuals experiencing financial difficulty in Greece.

plot(rules_difficult[1:10], method = "graph", engine = "igraph")

The graph-based visualization for rules_difficult (hincfel=3) highlights that long-term unemployment (uemp12m=6, uemp5yr=6), being foreign-born (cntbrthd=6666), and residing in Greece (cntry=GR) and region EL52 are key predictors of financial difficulty, with low digital engagement (netusoft=5, infrequent internet use) and perceived discrimination (dscrgrp=2) further reinforcing economic strain, while the presence of voting behavior (vote=1) suggests political participation despite financial struggles, and the absence of reported gender discrimination (dscrgnd=0) indicates that structural economic issues rather than direct social exclusion are driving financial hardship.

plot(rules_difficult, method = "grouped", control = list(k = 20))

The grouped matrix visualization for rules_difficult (hincfel=3) shows that long-term unemployment (uemp12m=6, uemp5yr=6), foreign-born status (cntbrthd=6666), and low occupational status (isco08p=66666, emprelp=6) are strong predictors of financial difficulty, while low digital engagement (netusoft=1), low social trust (dscrgrp=2), and limited financial security (hinscsrca=4) further reinforce economic hardship, with higher lift values (3.5–3.9) indicating that these factors strongly differentiate financially struggling individuals from others.

Fourth Rule - Struggling with their present income

Feeling about household’s income nowadays: “Very difficult on present income”

Threshold that I have set for this particular consequent are as follows. Additionaly, I think that severe financial hardship is rare in this data, so stricter thresholds would eliminate almost all rules.

  • Support (supp = 0.001): Reduced to 0.1% to capture rare but critical patterns, as extreme financial hardship (hincfel=4) is the least frequent category.
  • Confidence (conf = 0.3): Lowered to 30% to retain weaker but still relevant associations, as financial distress can have diverse contributing factors.
rules_very_difficult <- apriori(data_transaction, 
                 parameter = list(supp = 0.001, conf = 0.3, minlen = 2),
                 appearance = list(rhs = "hincfel=4", default = "lhs"),
                 control = list(verbose = FALSE))

inspect(sort(rules_very_difficult, by = "confidence", decreasing = TRUE)[1:10])
##      lhs                                     rhs         support     confidence
## [1]  {fnsdfml=1, hinctnta=1, psppipla=1}  => {hincfel=4} 0.001145532 0.5348837 
## [2]  {cntry=GR, fnsdfml=2, trstprt=0}     => {hincfel=4} 0.001319853 0.5196078 
## [3]  {fnsdfml=1, polintr=4, dscrgrp=1}    => {hincfel=4} 0.001070824 0.5119048 
## [4]  {cntry=GR, fnsdfml=2, trstprl=0}     => {hincfel=4} 0.001120630 0.5113636 
## [5]  {edulvlpb=6666, hinctnta=1, fltsd=4} => {hincfel=4} 0.001120630 0.5056180 
## [6]  {uemp12m=1, hincsrca=6, gincdif=1}   => {hincfel=4} 0.001543978 0.4960000 
## [7]  {cntry=GR, fnsdfml=2, trstplt=0}     => {hincfel=4} 0.001419464 0.4956522 
## [8]  {uemp5yr=1, hincsrca=6, gincdif=1}   => {hincfel=4} 0.001394561 0.4955752 
## [9]  {hinctnta=1, fltsd=4}                => {hincfel=4} 0.001195338 0.4897959 
## [10] {hinctnta=1, dscrgnd=0, fltsd=4}     => {hincfel=4} 0.001195338 0.4897959 
##      coverage    lift     count
## [1]  0.002141648 15.06227 46   
## [2]  0.002540094 14.63210 53   
## [3]  0.002091842 14.41518 43   
## [4]  0.002191453 14.39994 45   
## [5]  0.002216356 14.23815 45   
## [6]  0.003112860 13.96730 62   
## [7]  0.002863831 13.95751 57   
## [8]  0.002814025 13.95534 56   
## [9]  0.002440482 13.79260 48   
## [10] 0.002440482 13.79260 48

Based on the result obtained from the fourth consequent condition hincfel=4, which states that people feel, they are having severe difficulties with their present income, reveal that low income (hinctnta=1, bottom income decile), financial strain (fnsdfml=1, finding it very difficult to make ends meet), and lack of political influence (psppipla=1, believing they have no influence on politics) are key factors strongly associated with extreme financial hardship. Individuals from Greece (cntry=GR) frequently appear in the rules, indicating that regional economic conditions contribute significantly to financial distress. Additionally, low trust in political institutions (trstprl=0, no trust in parliament; trstplt=0, no trust in politicians) is a recurring theme, suggesting a link between financial struggles and political disenchantment. Lower education levels (edulvlpb=6666, incomplete primary education) also appear, reinforcing the correlation between limited education and economic hardship. Employment instability is another crucial factor, as individuals who experienced unemployment in the last 12 months (uemp12m=1) or last five years (uemp5yr=1) are highly likely to struggle financially. With confidence values around 49%–53% and exceptionally high lift values (~13.7–15.0), these findings highlight that low income, unemployment, lack of education, and distrust in political institutions are key predictors of severe financial difficulty, particularly in Greece.

plot(rules_very_difficult[1:10], method = "graph", engine = "igraph")

The graph shows that for rules_very_difficult (hincfel=4) unstable employment (emprelp=6, pdwrkp=0), unclassified occupations (isco08p=66666), and low-income levels (hinctnta=1) are strong predictors of extreme financial difficulty, with foreign-born individuals (cntbrthd=6666) and lack of political trust (trstprl=0, trstplt=0) further reinforcing economic vulnerability, while the absence of reported discrimination (dscrrce=0, dscrrlg=0, dscretn=0) suggests that systemic financial instability, rather than social exclusion, is a primary driver of financial hardship.

plot(rules_very_difficult, method = "grouped", control = list(k = 20))

The grouped matrix visualization for rules_very_difficult (hincfel=4) highlights that low financial security (hinctnta=3), low education levels (eisced=3), and weak occupational stability (wrkctra=1) are key drivers of severe financial difficulty, while living alone (hhmmb=Living Alone), limited savings (hinscsrca=4), and economic dissatisfaction (imueclt=3, eutrfr=0) further contribute to financial struggles, with exceptionally high lift values (10–14) indicating that these characteristics strongly distinguish those experiencing extreme financial hardship from the rest.