The dataset is taken from https://ess.sikt.no/en/, “ES round 11 - 2023. Social
inequalities in health,Gender in contemporary Europe”. This homework is
aimed to search the patterns across European Social Survey, especially
focusing on “Feeling about household’s income nowadays” variable as a
rule consequent. European Social Survey 2002 - 2023 for over 50,000
questions and variables contained in 115 downloadable data files. This
service is a work in progress, to improve the access to ESS data.
To be more precise with associated rules, the following variables are
taken:
gndr - Gender
1 - Male
2 -
Female
9 - No answer (missing value)
cntry - country code
hincsrca - Main source of household income
1
Wages or salaries
2 Income from self-employment (excluding
farming)
3 Income from farming
4 Pensions
5
Unemployment/redundancy benefit
6 Any other social benefits or
grants
7 Income from investments, savings etc.
8 Income from
other sources
77 Refusal
88 Don’t know
99 No
answer*
ipeqopta - Important that people are treated equally and have
equal opportunities
1 Very much like me
2 Like me
3
Somewhat like me
4 A little like me
5 Not like me
6 Not like
me at all
66 Not applicable
77 Refusal
88 Don’t
know
99 No answer
tporgwk - What type of organisation work/worked
for
1 Central or local government
2 Other public sector
(such as education and health)
3 A state owned enterprise
4 A
private firm
5 Self employed
6 Other
66 Not
applicable
77 Refusal
88 Don’t know
99 No
answer
hincfel - Feeling about household’s income
nowadays
1 Living comfortably on present income
2
Coping on present income
3 Difficult on present income
4 Very
difficult on present income
7 Refusal
8 Don’t know
9 No answer*
library(arules)
library(reshape2)
library(Matrix)
library(stringr)
library(ggplot2)
library(arulesViz)
library(tidyverse)
library(dplyr)
Upload the dataset.
setwd("C:/Users/ydmar/Documents/UW/UW - 1 semester/UL")
data<-read.csv("ESS11.csv", header=TRUE,na.strings=c("","NA"))
data <- data.frame(data)
str(data)
## 'data.frame': 40156 obs. of 640 variables:
## $ name : chr "ESS11e02" "ESS11e02" "ESS11e02" "ESS11e02" ...
## $ essround : int 11 11 11 11 11 11 11 11 11 11 ...
## $ edition : num 2 2 2 2 2 2 2 2 2 2 ...
## $ proddate : chr "20.11.2024" "20.11.2024" "20.11.2024" "20.11.2024" ...
## $ idno : int 50014 50030 50057 50106 50145 50158 50211 50212 50213 50235 ...
## $ cntry : chr "AT" "AT" "AT" "AT" ...
## $ dweight : num 1.185 0.61 1.392 0.556 0.723 ...
## $ pspwght : num 0.393 0.325 4 0.176 1.061 ...
## $ pweight : num 0.331 0.331 0.331 0.331 0.331 ...
## $ anweight : num 0.13 0.1076 1.3237 0.0583 0.3511 ...
## $ nwspol : int 90 90 30 15 60 120 45 120 20 120 ...
## $ netusoft : int 5 5 5 1 5 5 1 5 5 1 ...
## $ netustm : int 180 570 30 6666 120 120 6666 240 180 6666 ...
## $ ppltrst : int 5 10 6 6 6 8 7 8 7 3 ...
## $ pplfair : int 5 0 9 6 3 8 7 8 8 4 ...
## $ pplhlp : int 5 1 8 6 8 4 8 8 7 3 ...
## $ polintr : int 1 2 2 3 2 2 2 1 3 2 ...
## $ psppsgva : int 4 3 4 2 3 2 2 4 2 3 ...
## $ actrolga : int 5 2 4 2 1 3 2 4 2 2 ...
## $ psppipla : int 4 3 4 2 4 2 2 4 2 3 ...
## $ cptppola : int 5 2 3 3 3 3 2 5 2 3 ...
## $ trstprl : int 6 6 7 5 6 3 6 9 6 8 ...
## $ trstlgl : int 9 6 5 6 8 5 5 9 7 8 ...
## $ trstplc : int 10 4 8 9 8 7 8 9 8 10 ...
## $ trstplt : int 5 1 4 3 5 5 4 7 3 8 ...
## $ trstprt : int 5 0 4 3 5 5 5 6 2 8 ...
## $ trstep : int 5 5 7 4 6 4 4 7 5 4 ...
## $ trstun : int 5 5 5 4 8 6 6 7 6 8 ...
## $ vote : int 1 1 1 2 1 1 1 1 1 1 ...
## $ prtvtdat : int 1 5 5 66 5 7 1 5 5 2 ...
## $ prtvtebe : int NA NA NA NA NA NA NA NA NA NA ...
## $ prtvtchr : int NA NA NA NA NA NA NA NA NA NA ...
## $ prtvtccy : int NA NA NA NA NA NA NA NA NA NA ...
## $ prtvtffi : int NA NA NA NA NA NA NA NA NA NA ...
## $ prtvtffr : int NA NA NA NA NA NA NA NA NA NA ...
## $ prtvgde1 : int NA NA NA NA NA NA NA NA NA NA ...
## $ prtvgde2 : int NA NA NA NA NA NA NA NA NA NA ...
## $ prtvtegr : int NA NA NA NA NA NA NA NA NA NA ...
## $ prtvthhu : int NA NA NA NA NA NA NA NA NA NA ...
## $ prtvteis : int NA NA NA NA NA NA NA NA NA NA ...
## $ prtvteie : int NA NA NA NA NA NA NA NA NA NA ...
## $ prtvteit : int NA NA NA NA NA NA NA NA NA NA ...
## $ prtvclt1 : int NA NA NA NA NA NA NA NA NA NA ...
## $ prtvclt2 : int NA NA NA NA NA NA NA NA NA NA ...
## $ prtvclt3 : int NA NA NA NA NA NA NA NA NA NA ...
## $ prtvtinl : int NA NA NA NA NA NA NA NA NA NA ...
## $ prtvtcno : int NA NA NA NA NA NA NA NA NA NA ...
## $ prtvtfpl : int NA NA NA NA NA NA NA NA NA NA ...
## $ prtvtept : int NA NA NA NA NA NA NA NA NA NA ...
## $ prtvtbrs : int NA NA NA NA NA NA NA NA NA NA ...
## $ prtvtesk : int NA NA NA NA NA NA NA NA NA NA ...
## $ prtvtgsi : int NA NA NA NA NA NA NA NA NA NA ...
## $ prtvtges : int NA NA NA NA NA NA NA NA NA NA ...
## $ prtvtdse : int NA NA NA NA NA NA NA NA NA NA ...
## $ prtvthch : int NA NA NA NA NA NA NA NA NA NA ...
## $ prtvtdgb : int NA NA NA NA NA NA NA NA NA NA ...
## $ contplt : int 2 2 1 2 2 2 2 1 2 2 ...
## $ donprty : int 2 2 1 2 2 2 2 2 2 2 ...
## $ badge : int 2 1 2 2 2 2 2 2 2 2 ...
## $ sgnptit : int 2 1 1 2 1 2 2 1 2 2 ...
## $ pbldmna : int 2 1 1 2 2 2 2 1 2 2 ...
## $ bctprd : int 2 1 1 2 2 1 2 1 2 2 ...
## $ pstplonl : int 2 2 1 2 2 2 2 1 2 2 ...
## $ volunfp : int 2 1 1 2 2 2 2 1 2 2 ...
## $ clsprty : int 1 1 1 2 1 2 1 1 2 2 ...
## $ prtcleat : int 1 5 5 66 5 66 1 5 66 66 ...
## $ prtclebe : int NA NA NA NA NA NA NA NA NA NA ...
## $ prtclbhr : int NA NA NA NA NA NA NA NA NA NA ...
## $ prtclccy : int NA NA NA NA NA NA NA NA NA NA ...
## $ prtclgfi : int NA NA NA NA NA NA NA NA NA NA ...
## $ prtclgfr : int NA NA NA NA NA NA NA NA NA NA ...
## $ prtclgde : int NA NA NA NA NA NA NA NA NA NA ...
## $ prtclegr : int NA NA NA NA NA NA NA NA NA NA ...
## $ prtclihu : int NA NA NA NA NA NA NA NA NA NA ...
## $ prtcleis : int NA NA NA NA NA NA NA NA NA NA ...
## $ prtclfie : int NA NA NA NA NA NA NA NA NA NA ...
## $ prtclfit : int NA NA NA NA NA NA NA NA NA NA ...
## $ prtclclt : int NA NA NA NA NA NA NA NA NA NA ...
## $ prtclhnl : int NA NA NA NA NA NA NA NA NA NA ...
## $ prtclcno : int NA NA NA NA NA NA NA NA NA NA ...
## $ prtcljpl : int NA NA NA NA NA NA NA NA NA NA ...
## $ prtclgpt : int NA NA NA NA NA NA NA NA NA NA ...
## $ prtclbrs : int NA NA NA NA NA NA NA NA NA NA ...
## $ prtclesk : int NA NA NA NA NA NA NA NA NA NA ...
## $ prtclgsi : int NA NA NA NA NA NA NA NA NA NA ...
## $ prtclhes : int NA NA NA NA NA NA NA NA NA NA ...
## $ prtcldse : int NA NA NA NA NA NA NA NA NA NA ...
## $ prtclhch : int NA NA NA NA NA NA NA NA NA NA ...
## $ prtcldgb : int NA NA NA NA NA NA NA NA NA NA ...
## $ prtdgcl : int 2 2 2 6 2 6 2 2 6 6 ...
## $ lrscale : int 5 0 3 5 2 4 4 3 5 5 ...
## $ stflife : int 8 9 10 7 9 8 8 8 8 8 ...
## $ stfeco : int 6 2 6 4 6 4 6 6 6 7 ...
## $ stfgov : int 4 5 5 4 7 2 3 6 5 8 ...
## $ stfdem : int 6 7 6 6 8 3 6 8 8 7 ...
## $ stfedu : int 8 10 5 5 9 3 88 6 9 8 ...
## $ stfhlth : int 8 10 8 2 9 7 7 7 9 9 ...
## $ gincdif : int 2 1 1 1 2 2 2 2 1 2 ...
## $ freehms : int 2 1 1 2 2 2 2 1 2 2 ...
## [list output truncated]
Check missing values.
n_NAs <- apply(data, 2, function(x){sum(is.na(x))})
n_NAs
## name essround edition proddate idno cntry dweight pspwght
## 0 0 0 0 0 0 0 0
## pweight anweight nwspol netusoft netustm ppltrst pplfair pplhlp
## 0 0 0 0 0 0 0 0
## polintr psppsgva actrolga psppipla cptppola trstprl trstlgl trstplc
## 0 0 0 0 0 0 0 0
## trstplt trstprt trstep trstun vote prtvtdat prtvtebe prtvtchr
## 0 0 0 0 0 37802 38562 38593
## prtvtccy prtvtffi prtvtffr prtvgde1 prtvgde2 prtvtegr prtvthhu prtvteis
## 39471 38593 38385 37736 37736 37399 38038 39314
## prtvteie prtvteit prtvclt1 prtvclt2 prtvclt3 prtvtinl prtvtcno prtvtfpl
## 38139 37291 38791 38791 38791 38461 38819 38714
## prtvtept prtvtbrs prtvtesk prtvtgsi prtvtges prtvtdse prtvthch prtvtdgb
## 38783 38593 38714 38908 38312 38926 38772 38472
## contplt donprty badge sgnptit pbldmna bctprd pstplonl volunfp
## 0 0 0 0 0 0 0 0
## clsprty prtcleat prtclebe prtclbhr prtclccy prtclgfi prtclgfr prtclgde
## 0 37802 38562 38593 39471 38593 38385 37736
## prtclegr prtclihu prtcleis prtclfie prtclfit prtclclt prtclhnl prtclcno
## 37399 38038 39314 38139 37291 38791 38461 38819
## prtcljpl prtclgpt prtclbrs prtclesk prtclgsi prtclhes prtcldse prtclhch
## 38714 38783 38593 38714 38908 38312 38926 38772
## prtcldgb prtdgcl lrscale stflife stfeco stfgov stfdem stfedu
## 38472 1594 0 0 0 0 0 0
## stfhlth gincdif freehms hmsfmlsh hmsacld euftf lrnobed loylead
## 0 0 0 0 0 0 0 0
## imsmetn imdfetn impcntr imbgeco imueclt imwbcnt happy sclmeet
## 0 0 0 0 0 0 0 0
## inprdsc sclact crmvct aesfdrk health hlthhmp atchctr atcherp
## 0 0 0 0 0 0 0 0
## rlgblg rlgdnm rlgdnbat rlgdnacy rlgdnafi rlgdnade rlgdnagr rlgdnhu
## 0 0 37802 39471 38593 37736 37399 38038
## rlgdnais rlgdnie rlgdnlt rlgdnanl rlgdnno rlgdnapl rlgdnapt rlgdnrs
## 39314 38139 38791 38461 38819 38714 38783 38593
## rlgdnask rlgdnase rlgdnach rlgdngb rlgblge rlgdnme rlgdebat rlgdeacy
## 38714 38926 38772 38472 0 0 37802 39471
## rlgdeafi rlgdeade rlgdeagr rlgdehu rlgdeais rlgdeie rlgdelt rlgdeanl
## 38593 37736 37399 38038 39314 38139 38791 38461
## rlgdeno rlgdeapl rlgdeapt rlgders rlgdeask rlgdease rlgdeach rlgdegb
## 38819 38714 38783 38593 38714 38926 38772 38472
## rlgdgr rlgatnd pray dscrgrp dscrrce dscrntn dscrrlg dscrlng
## 0 0 0 0 0 0 0 0
## dscretn dscrage dscrgnd dscrsex dscrdsb dscroth dscrdk dscrref
## 0 0 0 0 0 0 0 0
## dscrnap dscrna ctzcntr brncntr cntbrthd livecnta lnghom1 lnghom2
## 0 0 0 0 3 0 0 0
## feethngr facntr fbrncntc mocntr mbrncntc ccnthum ccrdprs wrclmch
## 0 0 1 0 0 0 0 0
## admrclc testjc34 testjc35 testjc36 testjc37 testjc38 testjc39 testjc40
## 0 0 0 0 0 0 0 0
## testjc41 testjc42 vteurmmb vteubcmb ctrlife etfruit eatveg dosprt
## 0 0 6810 33346 0 0 0 0
## cgtsmok alcfreq alcwkdy alcwknd icgndra alcbnge height weighta
## 0 0 0 0 0 0 0 0
## dshltgp dshltms dshltnt dshltref dshltdk dshltna medtrun medtrnp
## 0 0 0 0 0 0 0 0
## medtrnt medtroc medtrnl medtrwl medtrnaa medtroth medtrnap medtrref
## 0 0 0 0 0 0 0 0
## medtrdk medtrna medtrnu hlpfmly hlpfmhr trhltacu trhltacp trhltcm
## 0 0 0 0 0 0 0 0
## trhltch trhltos trhltho trhltht trhlthy trhltmt trhltpt trhltre
## 0 0 0 0 0 0 0 0
## trhltsh trhltnt trhltref trhltdk trhltna fltdpr flteeff slprl
## 0 0 0 0 0 0 0 0
## wrhpp fltlnl enjlf fltsd cldgng hltprhc hltprhb hltprbp
## 0 0 0 0 0 0 0 0
## hltpral hltprbn hltprpa hltprpf hltprsd hltprsc hltprsh hltprdi
## 0 0 0 0 0 0 0 0
## hltprnt hltprref hltprdk hltprna hltphhc hltphhb hltphbp hltphal
## 0 0 0 0 0 0 0 0
## hltphbn hltphpa hltphpf hltphsd hltphsc hltphsh hltphdi hltphnt
## 0 0 0 0 0 0 0 0
## hltphnap hltphref hltphdk hltphna hltprca cancfre cnfpplh fnsdfml
## 0 0 0 0 0 0 0 0
## jbexpvi jbexpti jbexpml jbexpmc jbexpnt jbexpnap jbexpref jbexpdk
## 0 0 0 0 0 0 0 0
## jbexpna jbexevl jbexevh jbexevc jbexera jbexecp jbexebs jbexent
## 0 0 0 0 0 0 0 0
## jbexenap jbexeref jbexedk jbexena nobingnd likrisk liklead sothnds
## 0 0 0 0 0 0 0 0
## actcomp mascfel femifel impbemw trmedmw trwrkmw trplcmw trmdcnt
## 0 0 0 0 0 0 0 0
## trwkcnt trplcnt eqwrkbg eqpolbg eqmgmbg eqpaybg eqparep eqparlv
## 0 0 0 0 0 0 0 0
## freinsw fineqpy wsekpwr weasoff wlespdm wexashr wprtbym wbrgwrm
## 0 0 0 0 0 0 0 0
## hhmmb gndr gndr2 gndr3 gndr4 gndr5 gndr6 gndr7
## 0 0 0 0 0 0 0 4104
## gndr8 gndr9 gndr10 gndr11 gndr12 yrbrn agea yrbrn2
## 13445 24444 27463 33649 35091 0 0 0
## yrbrn3 yrbrn4 yrbrn5 yrbrn6 yrbrn7 yrbrn8 yrbrn9 yrbrn10
## 0 0 0 0 4104 13445 24444 27463
## yrbrn11 yrbrn12 rshipa2 rshipa3 rshipa4 rshipa5 rshipa6 rshipa7
## 33649 35091 0 0 0 0 0 4104
## rshipa8 rshipa9 rshipa10 rshipa11 rshipa12 rshpsts rshpsgb lvgptnea
## 13445 24444 27463 33649 35091 0 16577 0
## dvrcdeva marsts marstgb maritalb chldhhe domicil paccmoro paccdwlr
## 0 0 29961 0 0 0 0 0
## pacclift paccnbsh paccocrw paccxhoc paccnois paccinro paccnt paccref
## 0 0 0 0 0 0 0 0
## paccdk paccna edulvlb eisced edlveat edlvebe edlvehr edlvgcy
## 0 0 0 0 37802 38562 38593 39471
## edlvdfi edlvdfr edudde1 educde2 edlvegr edlvdahu edlvdis edlvdie
## 38593 38385 37736 37736 37399 38038 39314 38139
## edlvfit edlvdlt edlvenl edlveno edlvipl edlvept edlvdrs edlvdsk
## 37291 38791 38461 38819 38714 38783 38593 38714
## edlvesi edlvies edlvdse edlvdch educgb1 edubgb2 edagegb eduyrs
## 38908 38312 38926 38772 38472 38472 38472 0
## pdwrk edctn uempla uempli dsbld rtrd cmsrv hswrk
## 0 0 0 0 0 0 0 0
## dngoth dngref dngdk dngna mainact mnactic crpdwk pdjobev
## 0 0 0 0 0 0 0 0
## pdjobyr emplrel emplno wrkctra estsz jbspv njbspv wkdcorga
## 0 0 0 0 0 0 0 0
## iorgact wkhct wkhtot nacer2 tporgwk isco08 wrkac6m uemp3m
## 0 0 0 0 0 0 0 0
## uemp12m uemp5yr mbtru hincsrca hinctnta hincfel edulvlpb eiscedp
## 0 0 0 0 0 0 0 0
## edlvpfat edlvpebe edlvpehr edlvpgcy edlvpdfi edlvpdfr edupdde1 edupcde2
## 37802 38562 38593 39471 38593 38385 37736 37736
## edlvpegr edlvpdahu edlvpdis edlvpdie edlvpfit edlvpdlt edlvpenl edlvpeno
## 37399 38038 39314 38139 37291 38791 38461 38819
## edlvphpl edlvpept edlvpdrs edlvpdsk edlvpesi edlvphes edlvpdse edlvpdch
## 38714 38783 38593 38714 38908 38312 38926 38772
## edupcgb1 edupbgb2 edagepgb pdwrkp edctnp uemplap uemplip dsbldp
## 38472 38472 38472 0 0 0 0 0
## rtrdp cmsrvp hswrkp dngothp dngdkp dngnapp dngrefp dngnap
## 0 0 0 0 0 0 0 0
## mnactp crpdwkp isco08p emprelp wkhtotp edulvlfb eiscedf edlvfeat
## 0 0 0 0 0 0 0 37802
## edlvfebe edlvfehr edlvfgcy edlvfdfi edlvfdfr edufcde1 edufbde2 edlvfegr
## 38562 38593 39471 38593 38385 37736 37736 37399
## edlvfdahu edlvfdis edlvfdie edlvffit edlvfdlt edlvfenl edlvfeno edlvfgpl
## 38038 39314 38139 37291 38791 38461 38819 38714
## edlvfept edlvfdrs edlvfdsk edlvfesi edlvfges edlvfdse edlvfdch edufcgb1
## 38783 38593 38714 38908 38312 38926 38772 38472
## edufbgb2 edagefgb emprf14 occf14b edulvlmb eiscedm edlvmeat edlvmebe
## 38472 38472 0 0 0 0 37802 38562
## edlvmehr edlvmgcy edlvmdfi edlvmdfr edumcde1 edumbde2 edlvmegr edlvmdahu
## 38593 39471 38593 38385 37736 37736 37399 38038
## edlvmdis edlvmdie edlvmfit edlvmdlt edlvmenl edlvmeno edlvmgpl edlvmept
## 39314 38139 37291 38791 38461 38819 38714 38783
## edlvmdrs edlvmdsk edlvmesi edlvmges edlvmdse edlvmdch edumcgb1 edumbgb2
## 38593 38714 38908 38312 38926 38772 38472 38472
## edagemgb emprm14 occm14b atncrse anctrya1 anctrya2 regunit region
## 38472 0 0 0 0 0 0 0
## ipcrtiva impricha ipeqopta ipshabta impsafea impdiffa ipfrulea ipudrsta
## 0 0 0 0 0 0 0 0
## ipmodsta ipgdtima impfreea iphlppla ipsucesa ipstrgva ipadvnta ipbhprpa
## 0 0 0 0 0 0 0 0
## iprspota iplylfra impenva imptrada impfuna testji1 testji2 testji3
## 0 0 0 0 0 0 0 0
## testji4 testji5 testji6 testji7 testji8 testji9 respc19a symtc19
## 0 0 0 0 0 0 0 0
## symtnc19 vacc19 recon inwds ainws ainwe binwe cinwe
## 0 0 0 2 9 6 8 95
## dinwe einwe finwe hinwe iinwe kinwe rinwe inwde
## 9 9 54 149 24 76 24613 10
## jinws jinwe inwtm mode domain prob stratum psu
## 30 421 434 0 16250 0 0 0
Check if the number of missing values per column is more than 70% of the total number of values in column. If yes, remove these columns.
threshold <- 0.7
na_percent <- n_NAs / nrow(data)
data <- data %>%
select(names(na_percent[na_percent < threshold]))
str(data)
## 'data.frame': 40156 obs. of 437 variables:
## $ name : chr "ESS11e02" "ESS11e02" "ESS11e02" "ESS11e02" ...
## $ essround: int 11 11 11 11 11 11 11 11 11 11 ...
## $ edition : num 2 2 2 2 2 2 2 2 2 2 ...
## $ proddate: chr "20.11.2024" "20.11.2024" "20.11.2024" "20.11.2024" ...
## $ idno : int 50014 50030 50057 50106 50145 50158 50211 50212 50213 50235 ...
## $ cntry : chr "AT" "AT" "AT" "AT" ...
## $ dweight : num 1.185 0.61 1.392 0.556 0.723 ...
## $ pspwght : num 0.393 0.325 4 0.176 1.061 ...
## $ pweight : num 0.331 0.331 0.331 0.331 0.331 ...
## $ anweight: num 0.13 0.1076 1.3237 0.0583 0.3511 ...
## $ nwspol : int 90 90 30 15 60 120 45 120 20 120 ...
## $ netusoft: int 5 5 5 1 5 5 1 5 5 1 ...
## $ netustm : int 180 570 30 6666 120 120 6666 240 180 6666 ...
## $ ppltrst : int 5 10 6 6 6 8 7 8 7 3 ...
## $ pplfair : int 5 0 9 6 3 8 7 8 8 4 ...
## $ pplhlp : int 5 1 8 6 8 4 8 8 7 3 ...
## $ polintr : int 1 2 2 3 2 2 2 1 3 2 ...
## $ psppsgva: int 4 3 4 2 3 2 2 4 2 3 ...
## $ actrolga: int 5 2 4 2 1 3 2 4 2 2 ...
## $ psppipla: int 4 3 4 2 4 2 2 4 2 3 ...
## $ cptppola: int 5 2 3 3 3 3 2 5 2 3 ...
## $ trstprl : int 6 6 7 5 6 3 6 9 6 8 ...
## $ trstlgl : int 9 6 5 6 8 5 5 9 7 8 ...
## $ trstplc : int 10 4 8 9 8 7 8 9 8 10 ...
## $ trstplt : int 5 1 4 3 5 5 4 7 3 8 ...
## $ trstprt : int 5 0 4 3 5 5 5 6 2 8 ...
## $ trstep : int 5 5 7 4 6 4 4 7 5 4 ...
## $ trstun : int 5 5 5 4 8 6 6 7 6 8 ...
## $ vote : int 1 1 1 2 1 1 1 1 1 1 ...
## $ contplt : int 2 2 1 2 2 2 2 1 2 2 ...
## $ donprty : int 2 2 1 2 2 2 2 2 2 2 ...
## $ badge : int 2 1 2 2 2 2 2 2 2 2 ...
## $ sgnptit : int 2 1 1 2 1 2 2 1 2 2 ...
## $ pbldmna : int 2 1 1 2 2 2 2 1 2 2 ...
## $ bctprd : int 2 1 1 2 2 1 2 1 2 2 ...
## $ pstplonl: int 2 2 1 2 2 2 2 1 2 2 ...
## $ volunfp : int 2 1 1 2 2 2 2 1 2 2 ...
## $ clsprty : int 1 1 1 2 1 2 1 1 2 2 ...
## $ prtdgcl : int 2 2 2 6 2 6 2 2 6 6 ...
## $ lrscale : int 5 0 3 5 2 4 4 3 5 5 ...
## $ stflife : int 8 9 10 7 9 8 8 8 8 8 ...
## $ stfeco : int 6 2 6 4 6 4 6 6 6 7 ...
## $ stfgov : int 4 5 5 4 7 2 3 6 5 8 ...
## $ stfdem : int 6 7 6 6 8 3 6 8 8 7 ...
## $ stfedu : int 8 10 5 5 9 3 88 6 9 8 ...
## $ stfhlth : int 8 10 8 2 9 7 7 7 9 9 ...
## $ gincdif : int 2 1 1 1 2 2 2 2 1 2 ...
## $ freehms : int 2 1 1 2 2 2 2 1 2 2 ...
## $ hmsfmlsh: int 4 5 5 4 4 4 4 5 5 3 ...
## $ hmsacld : int 3 1 1 3 2 2 4 2 3 3 ...
## $ euftf : int 6 9 7 5 10 3 3 5 1 10 ...
## $ lrnobed : int 4 2 5 2 1 2 2 3 2 2 ...
## $ loylead : int 4 5 3 9 2 2 2 3 3 4 ...
## $ imsmetn : int 2 2 1 2 1 2 1 2 2 1 ...
## $ imdfetn : int 2 2 1 2 1 3 3 2 3 2 ...
## $ impcntr : int 3 2 1 2 2 3 3 3 3 3 ...
## $ imbgeco : int 7 6 9 6 10 5 88 6 7 5 ...
## $ imueclt : int 3 5 9 6 10 6 3 8 5 0 ...
## $ imwbcnt : int 5 9 8 5 10 6 2 7 5 0 ...
## $ happy : int 8 9 9 7 9 8 7 8 8 7 ...
## $ sclmeet : int 4 7 4 6 5 6 4 4 4 3 ...
## $ inprdsc : int 1 4 4 3 4 4 2 2 4 1 ...
## $ sclact : int 3 4 3 3 3 2 3 3 3 1 ...
## $ crmvct : int 2 1 2 2 2 2 2 2 2 2 ...
## $ aesfdrk : int 2 3 3 3 1 2 3 2 2 2 ...
## $ health : int 3 2 1 3 2 1 2 2 2 2 ...
## $ hlthhmp : int 3 2 3 3 3 3 3 2 3 2 ...
## $ atchctr : int 10 8 9 10 10 8 9 10 8 10 ...
## $ atcherp : int 5 8 7 8 10 6 6 9 6 7 ...
## $ rlgblg : int 1 2 2 1 1 1 1 1 1 1 ...
## $ rlgdnm : int 1 66 66 3 1 1 1 1 1 1 ...
## $ rlgblge : int 6 2 1 6 6 6 6 6 6 6 ...
## $ rlgdnme : int 66 66 1 66 66 66 66 66 66 66 ...
## $ rlgdgr : int 5 0 8 6 1 3 6 6 5 10 ...
## $ rlgatnd : int 6 7 5 6 7 5 5 5 5 3 ...
## $ pray : int 5 6 3 3 7 1 2 4 1 1 ...
## $ dscrgrp : int 2 2 1 2 2 2 2 2 2 2 ...
## $ dscrrce : int 0 0 0 0 0 0 0 0 0 0 ...
## $ dscrntn : int 0 0 0 0 0 0 0 0 0 0 ...
## $ dscrrlg : int 0 0 0 0 0 0 0 0 0 0 ...
## $ dscrlng : int 0 0 0 0 0 0 0 0 0 0 ...
## $ dscretn : int 0 0 0 0 0 0 0 0 0 0 ...
## $ dscrage : int 0 0 0 0 0 0 0 0 0 0 ...
## $ dscrgnd : int 0 0 1 0 0 0 0 0 0 0 ...
## $ dscrsex : int 0 0 0 0 0 0 0 0 0 0 ...
## $ dscrdsb : int 0 0 0 0 0 0 0 0 0 0 ...
## $ dscroth : int 0 0 0 0 0 0 0 0 0 0 ...
## $ dscrdk : int 0 0 0 0 0 0 0 0 0 0 ...
## $ dscrref : int 0 0 0 0 0 0 0 0 0 0 ...
## $ dscrnap : int 1 1 0 1 1 1 1 1 1 1 ...
## $ dscrna : int 0 0 0 0 0 0 0 0 0 0 ...
## $ ctzcntr : int 1 1 1 2 1 1 1 1 1 1 ...
## $ brncntr : int 1 1 1 2 1 2 1 1 1 1 ...
## $ cntbrthd: chr "6666" "6666" "6666" "RO" ...
## $ livecnta: int 6666 6666 6666 1989 6666 1965 6666 6666 6666 6666 ...
## $ lnghom1 : chr "GER" "GER" "GER" "GER" ...
## $ lnghom2 : chr "000" "ENG" "ENG" "RUM" ...
## $ feethngr: int 1 8 1 2 1 1 1 1 1 1 ...
## $ facntr : int 1 1 1 2 1 2 1 1 1 1 ...
## [list output truncated]
Check how many missing values are left.
n_NAs2 <- apply(data, 2, function(x){sum(is.na(x))})
n_NAs2
## name essround edition proddate idno cntry dweight pspwght
## 0 0 0 0 0 0 0 0
## pweight anweight nwspol netusoft netustm ppltrst pplfair pplhlp
## 0 0 0 0 0 0 0 0
## polintr psppsgva actrolga psppipla cptppola trstprl trstlgl trstplc
## 0 0 0 0 0 0 0 0
## trstplt trstprt trstep trstun vote contplt donprty badge
## 0 0 0 0 0 0 0 0
## sgnptit pbldmna bctprd pstplonl volunfp clsprty prtdgcl lrscale
## 0 0 0 0 0 0 1594 0
## stflife stfeco stfgov stfdem stfedu stfhlth gincdif freehms
## 0 0 0 0 0 0 0 0
## hmsfmlsh hmsacld euftf lrnobed loylead imsmetn imdfetn impcntr
## 0 0 0 0 0 0 0 0
## imbgeco imueclt imwbcnt happy sclmeet inprdsc sclact crmvct
## 0 0 0 0 0 0 0 0
## aesfdrk health hlthhmp atchctr atcherp rlgblg rlgdnm rlgblge
## 0 0 0 0 0 0 0 0
## rlgdnme rlgdgr rlgatnd pray dscrgrp dscrrce dscrntn dscrrlg
## 0 0 0 0 0 0 0 0
## dscrlng dscretn dscrage dscrgnd dscrsex dscrdsb dscroth dscrdk
## 0 0 0 0 0 0 0 0
## dscrref dscrnap dscrna ctzcntr brncntr cntbrthd livecnta lnghom1
## 0 0 0 0 0 3 0 0
## lnghom2 feethngr facntr fbrncntc mocntr mbrncntc ccnthum ccrdprs
## 0 0 0 1 0 0 0 0
## wrclmch admrclc testjc34 testjc35 testjc36 testjc37 testjc38 testjc39
## 0 0 0 0 0 0 0 0
## testjc40 testjc41 testjc42 vteurmmb ctrlife etfruit eatveg dosprt
## 0 0 0 6810 0 0 0 0
## cgtsmok alcfreq alcwkdy alcwknd icgndra alcbnge height weighta
## 0 0 0 0 0 0 0 0
## dshltgp dshltms dshltnt dshltref dshltdk dshltna medtrun medtrnp
## 0 0 0 0 0 0 0 0
## medtrnt medtroc medtrnl medtrwl medtrnaa medtroth medtrnap medtrref
## 0 0 0 0 0 0 0 0
## medtrdk medtrna medtrnu hlpfmly hlpfmhr trhltacu trhltacp trhltcm
## 0 0 0 0 0 0 0 0
## trhltch trhltos trhltho trhltht trhlthy trhltmt trhltpt trhltre
## 0 0 0 0 0 0 0 0
## trhltsh trhltnt trhltref trhltdk trhltna fltdpr flteeff slprl
## 0 0 0 0 0 0 0 0
## wrhpp fltlnl enjlf fltsd cldgng hltprhc hltprhb hltprbp
## 0 0 0 0 0 0 0 0
## hltpral hltprbn hltprpa hltprpf hltprsd hltprsc hltprsh hltprdi
## 0 0 0 0 0 0 0 0
## hltprnt hltprref hltprdk hltprna hltphhc hltphhb hltphbp hltphal
## 0 0 0 0 0 0 0 0
## hltphbn hltphpa hltphpf hltphsd hltphsc hltphsh hltphdi hltphnt
## 0 0 0 0 0 0 0 0
## hltphnap hltphref hltphdk hltphna hltprca cancfre cnfpplh fnsdfml
## 0 0 0 0 0 0 0 0
## jbexpvi jbexpti jbexpml jbexpmc jbexpnt jbexpnap jbexpref jbexpdk
## 0 0 0 0 0 0 0 0
## jbexpna jbexevl jbexevh jbexevc jbexera jbexecp jbexebs jbexent
## 0 0 0 0 0 0 0 0
## jbexenap jbexeref jbexedk jbexena nobingnd likrisk liklead sothnds
## 0 0 0 0 0 0 0 0
## actcomp mascfel femifel impbemw trmedmw trwrkmw trplcmw trmdcnt
## 0 0 0 0 0 0 0 0
## trwkcnt trplcnt eqwrkbg eqpolbg eqmgmbg eqpaybg eqparep eqparlv
## 0 0 0 0 0 0 0 0
## freinsw fineqpy wsekpwr weasoff wlespdm wexashr wprtbym wbrgwrm
## 0 0 0 0 0 0 0 0
## hhmmb gndr gndr2 gndr3 gndr4 gndr5 gndr6 gndr7
## 0 0 0 0 0 0 0 4104
## gndr8 gndr9 gndr10 yrbrn agea yrbrn2 yrbrn3 yrbrn4
## 13445 24444 27463 0 0 0 0 0
## yrbrn5 yrbrn6 yrbrn7 yrbrn8 yrbrn9 yrbrn10 rshipa2 rshipa3
## 0 0 4104 13445 24444 27463 0 0
## rshipa4 rshipa5 rshipa6 rshipa7 rshipa8 rshipa9 rshipa10 rshpsts
## 0 0 0 4104 13445 24444 27463 0
## rshpsgb lvgptnea dvrcdeva marsts maritalb chldhhe domicil paccmoro
## 16577 0 0 0 0 0 0 0
## paccdwlr pacclift paccnbsh paccocrw paccxhoc paccnois paccinro paccnt
## 0 0 0 0 0 0 0 0
## paccref paccdk paccna edulvlb eisced eduyrs pdwrk edctn
## 0 0 0 0 0 0 0 0
## uempla uempli dsbld rtrd cmsrv hswrk dngoth dngref
## 0 0 0 0 0 0 0 0
## dngdk dngna mainact mnactic crpdwk pdjobev pdjobyr emplrel
## 0 0 0 0 0 0 0 0
## emplno wrkctra estsz jbspv njbspv wkdcorga iorgact wkhct
## 0 0 0 0 0 0 0 0
## wkhtot nacer2 tporgwk isco08 wrkac6m uemp3m uemp12m uemp5yr
## 0 0 0 0 0 0 0 0
## mbtru hincsrca hinctnta hincfel edulvlpb eiscedp pdwrkp edctnp
## 0 0 0 0 0 0 0 0
## uemplap uemplip dsbldp rtrdp cmsrvp hswrkp dngothp dngdkp
## 0 0 0 0 0 0 0 0
## dngnapp dngrefp dngnap mnactp crpdwkp isco08p emprelp wkhtotp
## 0 0 0 0 0 0 0 0
## edulvlfb eiscedf emprf14 occf14b edulvlmb eiscedm emprm14 occm14b
## 0 0 0 0 0 0 0 0
## atncrse anctrya1 anctrya2 regunit region ipcrtiva impricha ipeqopta
## 0 0 0 0 0 0 0 0
## ipshabta impsafea impdiffa ipfrulea ipudrsta ipmodsta ipgdtima impfreea
## 0 0 0 0 0 0 0 0
## iphlppla ipsucesa ipstrgva ipadvnta ipbhprpa iprspota iplylfra impenva
## 0 0 0 0 0 0 0 0
## imptrada impfuna testji1 testji2 testji3 testji4 testji5 testji6
## 0 0 0 0 0 0 0 0
## testji7 testji8 testji9 respc19a symtc19 symtnc19 vacc19 recon
## 0 0 0 0 0 0 0 0
## inwds ainws ainwe binwe cinwe dinwe einwe finwe
## 2 9 6 8 95 9 9 54
## hinwe iinwe kinwe rinwe inwde jinws jinwe inwtm
## 149 24 76 24613 10 30 421 434
## mode domain prob stratum psu
## 0 16250 0 0 0
Impute the missing values using the mode.
get_mode <- function(x) {
uniq_vals <- na.omit(unique(x))
uniq_vals[which.max(tabulate(match(x, uniq_vals)))]
}
for (col in names(data)) {
mode_value <- get_mode(data[[col]])
data[[col]][is.na(data[[col]])] <- mode_value
}
Check the missing values again.
str(data)
## 'data.frame': 40156 obs. of 437 variables:
## $ name : chr "ESS11e02" "ESS11e02" "ESS11e02" "ESS11e02" ...
## $ essround: int 11 11 11 11 11 11 11 11 11 11 ...
## $ edition : num 2 2 2 2 2 2 2 2 2 2 ...
## $ proddate: chr "20.11.2024" "20.11.2024" "20.11.2024" "20.11.2024" ...
## $ idno : int 50014 50030 50057 50106 50145 50158 50211 50212 50213 50235 ...
## $ cntry : chr "AT" "AT" "AT" "AT" ...
## $ dweight : num 1.185 0.61 1.392 0.556 0.723 ...
## $ pspwght : num 0.393 0.325 4 0.176 1.061 ...
## $ pweight : num 0.331 0.331 0.331 0.331 0.331 ...
## $ anweight: num 0.13 0.1076 1.3237 0.0583 0.3511 ...
## $ nwspol : int 90 90 30 15 60 120 45 120 20 120 ...
## $ netusoft: int 5 5 5 1 5 5 1 5 5 1 ...
## $ netustm : int 180 570 30 6666 120 120 6666 240 180 6666 ...
## $ ppltrst : int 5 10 6 6 6 8 7 8 7 3 ...
## $ pplfair : int 5 0 9 6 3 8 7 8 8 4 ...
## $ pplhlp : int 5 1 8 6 8 4 8 8 7 3 ...
## $ polintr : int 1 2 2 3 2 2 2 1 3 2 ...
## $ psppsgva: int 4 3 4 2 3 2 2 4 2 3 ...
## $ actrolga: int 5 2 4 2 1 3 2 4 2 2 ...
## $ psppipla: int 4 3 4 2 4 2 2 4 2 3 ...
## $ cptppola: int 5 2 3 3 3 3 2 5 2 3 ...
## $ trstprl : int 6 6 7 5 6 3 6 9 6 8 ...
## $ trstlgl : int 9 6 5 6 8 5 5 9 7 8 ...
## $ trstplc : int 10 4 8 9 8 7 8 9 8 10 ...
## $ trstplt : int 5 1 4 3 5 5 4 7 3 8 ...
## $ trstprt : int 5 0 4 3 5 5 5 6 2 8 ...
## $ trstep : int 5 5 7 4 6 4 4 7 5 4 ...
## $ trstun : int 5 5 5 4 8 6 6 7 6 8 ...
## $ vote : int 1 1 1 2 1 1 1 1 1 1 ...
## $ contplt : int 2 2 1 2 2 2 2 1 2 2 ...
## $ donprty : int 2 2 1 2 2 2 2 2 2 2 ...
## $ badge : int 2 1 2 2 2 2 2 2 2 2 ...
## $ sgnptit : int 2 1 1 2 1 2 2 1 2 2 ...
## $ pbldmna : int 2 1 1 2 2 2 2 1 2 2 ...
## $ bctprd : int 2 1 1 2 2 1 2 1 2 2 ...
## $ pstplonl: int 2 2 1 2 2 2 2 1 2 2 ...
## $ volunfp : int 2 1 1 2 2 2 2 1 2 2 ...
## $ clsprty : int 1 1 1 2 1 2 1 1 2 2 ...
## $ prtdgcl : int 2 2 2 6 2 6 2 2 6 6 ...
## $ lrscale : int 5 0 3 5 2 4 4 3 5 5 ...
## $ stflife : int 8 9 10 7 9 8 8 8 8 8 ...
## $ stfeco : int 6 2 6 4 6 4 6 6 6 7 ...
## $ stfgov : int 4 5 5 4 7 2 3 6 5 8 ...
## $ stfdem : int 6 7 6 6 8 3 6 8 8 7 ...
## $ stfedu : int 8 10 5 5 9 3 88 6 9 8 ...
## $ stfhlth : int 8 10 8 2 9 7 7 7 9 9 ...
## $ gincdif : int 2 1 1 1 2 2 2 2 1 2 ...
## $ freehms : int 2 1 1 2 2 2 2 1 2 2 ...
## $ hmsfmlsh: int 4 5 5 4 4 4 4 5 5 3 ...
## $ hmsacld : int 3 1 1 3 2 2 4 2 3 3 ...
## $ euftf : int 6 9 7 5 10 3 3 5 1 10 ...
## $ lrnobed : int 4 2 5 2 1 2 2 3 2 2 ...
## $ loylead : int 4 5 3 9 2 2 2 3 3 4 ...
## $ imsmetn : int 2 2 1 2 1 2 1 2 2 1 ...
## $ imdfetn : int 2 2 1 2 1 3 3 2 3 2 ...
## $ impcntr : int 3 2 1 2 2 3 3 3 3 3 ...
## $ imbgeco : int 7 6 9 6 10 5 88 6 7 5 ...
## $ imueclt : int 3 5 9 6 10 6 3 8 5 0 ...
## $ imwbcnt : int 5 9 8 5 10 6 2 7 5 0 ...
## $ happy : int 8 9 9 7 9 8 7 8 8 7 ...
## $ sclmeet : int 4 7 4 6 5 6 4 4 4 3 ...
## $ inprdsc : int 1 4 4 3 4 4 2 2 4 1 ...
## $ sclact : int 3 4 3 3 3 2 3 3 3 1 ...
## $ crmvct : int 2 1 2 2 2 2 2 2 2 2 ...
## $ aesfdrk : int 2 3 3 3 1 2 3 2 2 2 ...
## $ health : int 3 2 1 3 2 1 2 2 2 2 ...
## $ hlthhmp : int 3 2 3 3 3 3 3 2 3 2 ...
## $ atchctr : int 10 8 9 10 10 8 9 10 8 10 ...
## $ atcherp : int 5 8 7 8 10 6 6 9 6 7 ...
## $ rlgblg : int 1 2 2 1 1 1 1 1 1 1 ...
## $ rlgdnm : int 1 66 66 3 1 1 1 1 1 1 ...
## $ rlgblge : int 6 2 1 6 6 6 6 6 6 6 ...
## $ rlgdnme : int 66 66 1 66 66 66 66 66 66 66 ...
## $ rlgdgr : int 5 0 8 6 1 3 6 6 5 10 ...
## $ rlgatnd : int 6 7 5 6 7 5 5 5 5 3 ...
## $ pray : int 5 6 3 3 7 1 2 4 1 1 ...
## $ dscrgrp : int 2 2 1 2 2 2 2 2 2 2 ...
## $ dscrrce : int 0 0 0 0 0 0 0 0 0 0 ...
## $ dscrntn : int 0 0 0 0 0 0 0 0 0 0 ...
## $ dscrrlg : int 0 0 0 0 0 0 0 0 0 0 ...
## $ dscrlng : int 0 0 0 0 0 0 0 0 0 0 ...
## $ dscretn : int 0 0 0 0 0 0 0 0 0 0 ...
## $ dscrage : int 0 0 0 0 0 0 0 0 0 0 ...
## $ dscrgnd : int 0 0 1 0 0 0 0 0 0 0 ...
## $ dscrsex : int 0 0 0 0 0 0 0 0 0 0 ...
## $ dscrdsb : int 0 0 0 0 0 0 0 0 0 0 ...
## $ dscroth : int 0 0 0 0 0 0 0 0 0 0 ...
## $ dscrdk : int 0 0 0 0 0 0 0 0 0 0 ...
## $ dscrref : int 0 0 0 0 0 0 0 0 0 0 ...
## $ dscrnap : int 1 1 0 1 1 1 1 1 1 1 ...
## $ dscrna : int 0 0 0 0 0 0 0 0 0 0 ...
## $ ctzcntr : int 1 1 1 2 1 1 1 1 1 1 ...
## $ brncntr : int 1 1 1 2 1 2 1 1 1 1 ...
## $ cntbrthd: chr "6666" "6666" "6666" "RO" ...
## $ livecnta: int 6666 6666 6666 1989 6666 1965 6666 6666 6666 6666 ...
## $ lnghom1 : chr "GER" "GER" "GER" "GER" ...
## $ lnghom2 : chr "000" "ENG" "ENG" "RUM" ...
## $ feethngr: int 1 8 1 2 1 1 1 1 1 1 ...
## $ facntr : int 1 1 1 2 1 2 1 1 1 1 ...
## [list output truncated]
n_NAs3 <- apply(data, 2, function(x){sum(is.na(x))})
n_NAs3
## name essround edition proddate idno cntry dweight pspwght
## 0 0 0 0 0 0 0 0
## pweight anweight nwspol netusoft netustm ppltrst pplfair pplhlp
## 0 0 0 0 0 0 0 0
## polintr psppsgva actrolga psppipla cptppola trstprl trstlgl trstplc
## 0 0 0 0 0 0 0 0
## trstplt trstprt trstep trstun vote contplt donprty badge
## 0 0 0 0 0 0 0 0
## sgnptit pbldmna bctprd pstplonl volunfp clsprty prtdgcl lrscale
## 0 0 0 0 0 0 0 0
## stflife stfeco stfgov stfdem stfedu stfhlth gincdif freehms
## 0 0 0 0 0 0 0 0
## hmsfmlsh hmsacld euftf lrnobed loylead imsmetn imdfetn impcntr
## 0 0 0 0 0 0 0 0
## imbgeco imueclt imwbcnt happy sclmeet inprdsc sclact crmvct
## 0 0 0 0 0 0 0 0
## aesfdrk health hlthhmp atchctr atcherp rlgblg rlgdnm rlgblge
## 0 0 0 0 0 0 0 0
## rlgdnme rlgdgr rlgatnd pray dscrgrp dscrrce dscrntn dscrrlg
## 0 0 0 0 0 0 0 0
## dscrlng dscretn dscrage dscrgnd dscrsex dscrdsb dscroth dscrdk
## 0 0 0 0 0 0 0 0
## dscrref dscrnap dscrna ctzcntr brncntr cntbrthd livecnta lnghom1
## 0 0 0 0 0 0 0 0
## lnghom2 feethngr facntr fbrncntc mocntr mbrncntc ccnthum ccrdprs
## 0 0 0 0 0 0 0 0
## wrclmch admrclc testjc34 testjc35 testjc36 testjc37 testjc38 testjc39
## 0 0 0 0 0 0 0 0
## testjc40 testjc41 testjc42 vteurmmb ctrlife etfruit eatveg dosprt
## 0 0 0 0 0 0 0 0
## cgtsmok alcfreq alcwkdy alcwknd icgndra alcbnge height weighta
## 0 0 0 0 0 0 0 0
## dshltgp dshltms dshltnt dshltref dshltdk dshltna medtrun medtrnp
## 0 0 0 0 0 0 0 0
## medtrnt medtroc medtrnl medtrwl medtrnaa medtroth medtrnap medtrref
## 0 0 0 0 0 0 0 0
## medtrdk medtrna medtrnu hlpfmly hlpfmhr trhltacu trhltacp trhltcm
## 0 0 0 0 0 0 0 0
## trhltch trhltos trhltho trhltht trhlthy trhltmt trhltpt trhltre
## 0 0 0 0 0 0 0 0
## trhltsh trhltnt trhltref trhltdk trhltna fltdpr flteeff slprl
## 0 0 0 0 0 0 0 0
## wrhpp fltlnl enjlf fltsd cldgng hltprhc hltprhb hltprbp
## 0 0 0 0 0 0 0 0
## hltpral hltprbn hltprpa hltprpf hltprsd hltprsc hltprsh hltprdi
## 0 0 0 0 0 0 0 0
## hltprnt hltprref hltprdk hltprna hltphhc hltphhb hltphbp hltphal
## 0 0 0 0 0 0 0 0
## hltphbn hltphpa hltphpf hltphsd hltphsc hltphsh hltphdi hltphnt
## 0 0 0 0 0 0 0 0
## hltphnap hltphref hltphdk hltphna hltprca cancfre cnfpplh fnsdfml
## 0 0 0 0 0 0 0 0
## jbexpvi jbexpti jbexpml jbexpmc jbexpnt jbexpnap jbexpref jbexpdk
## 0 0 0 0 0 0 0 0
## jbexpna jbexevl jbexevh jbexevc jbexera jbexecp jbexebs jbexent
## 0 0 0 0 0 0 0 0
## jbexenap jbexeref jbexedk jbexena nobingnd likrisk liklead sothnds
## 0 0 0 0 0 0 0 0
## actcomp mascfel femifel impbemw trmedmw trwrkmw trplcmw trmdcnt
## 0 0 0 0 0 0 0 0
## trwkcnt trplcnt eqwrkbg eqpolbg eqmgmbg eqpaybg eqparep eqparlv
## 0 0 0 0 0 0 0 0
## freinsw fineqpy wsekpwr weasoff wlespdm wexashr wprtbym wbrgwrm
## 0 0 0 0 0 0 0 0
## hhmmb gndr gndr2 gndr3 gndr4 gndr5 gndr6 gndr7
## 0 0 0 0 0 0 0 0
## gndr8 gndr9 gndr10 yrbrn agea yrbrn2 yrbrn3 yrbrn4
## 0 0 0 0 0 0 0 0
## yrbrn5 yrbrn6 yrbrn7 yrbrn8 yrbrn9 yrbrn10 rshipa2 rshipa3
## 0 0 0 0 0 0 0 0
## rshipa4 rshipa5 rshipa6 rshipa7 rshipa8 rshipa9 rshipa10 rshpsts
## 0 0 0 0 0 0 0 0
## rshpsgb lvgptnea dvrcdeva marsts maritalb chldhhe domicil paccmoro
## 0 0 0 0 0 0 0 0
## paccdwlr pacclift paccnbsh paccocrw paccxhoc paccnois paccinro paccnt
## 0 0 0 0 0 0 0 0
## paccref paccdk paccna edulvlb eisced eduyrs pdwrk edctn
## 0 0 0 0 0 0 0 0
## uempla uempli dsbld rtrd cmsrv hswrk dngoth dngref
## 0 0 0 0 0 0 0 0
## dngdk dngna mainact mnactic crpdwk pdjobev pdjobyr emplrel
## 0 0 0 0 0 0 0 0
## emplno wrkctra estsz jbspv njbspv wkdcorga iorgact wkhct
## 0 0 0 0 0 0 0 0
## wkhtot nacer2 tporgwk isco08 wrkac6m uemp3m uemp12m uemp5yr
## 0 0 0 0 0 0 0 0
## mbtru hincsrca hinctnta hincfel edulvlpb eiscedp pdwrkp edctnp
## 0 0 0 0 0 0 0 0
## uemplap uemplip dsbldp rtrdp cmsrvp hswrkp dngothp dngdkp
## 0 0 0 0 0 0 0 0
## dngnapp dngrefp dngnap mnactp crpdwkp isco08p emprelp wkhtotp
## 0 0 0 0 0 0 0 0
## edulvlfb eiscedf emprf14 occf14b edulvlmb eiscedm emprm14 occm14b
## 0 0 0 0 0 0 0 0
## atncrse anctrya1 anctrya2 regunit region ipcrtiva impricha ipeqopta
## 0 0 0 0 0 0 0 0
## ipshabta impsafea impdiffa ipfrulea ipudrsta ipmodsta ipgdtima impfreea
## 0 0 0 0 0 0 0 0
## iphlppla ipsucesa ipstrgva ipadvnta ipbhprpa iprspota iplylfra impenva
## 0 0 0 0 0 0 0 0
## imptrada impfuna testji1 testji2 testji3 testji4 testji5 testji6
## 0 0 0 0 0 0 0 0
## testji7 testji8 testji9 respc19a symtc19 symtnc19 vacc19 recon
## 0 0 0 0 0 0 0 0
## inwds ainws ainwe binwe cinwe dinwe einwe finwe
## 0 0 0 0 0 0 0 0
## hinwe iinwe kinwe rinwe inwde jinws jinwe inwtm
## 0 0 0 0 0 0 0 0
## mode domain prob stratum psu
## 0 0 0 0 0
There are no missing values.
Filter dataset to include only the
variables listed above.
data2 <- data %>%
select(gndr,cntry,hincsrca, ipeqopta, tporgwk, hincfel)
summary(data2)
## gndr cntry hincsrca ipeqopta
## Min. :1.000 Length:40156 Min. : 1.000 Min. : 1.000
## 1st Qu.:1.000 Class :character 1st Qu.: 1.000 1st Qu.: 1.000
## Median :2.000 Mode :character Median : 1.000 Median : 2.000
## Mean :1.533 Mean : 3.373 Mean : 3.356
## 3rd Qu.:2.000 3rd Qu.: 4.000 3rd Qu.: 2.000
## Max. :2.000 Max. :99.000 Max. :99.000
## tporgwk hincfel
## Min. : 1.000 Min. :1.000
## 1st Qu.: 3.000 1st Qu.:1.000
## Median : 4.000 Median :2.000
## Mean : 9.897 Mean :1.921
## 3rd Qu.: 4.000 3rd Qu.:2.000
## Max. :99.000 Max. :9.000
names(data2)
## [1] "gndr" "cntry" "hincsrca" "ipeqopta" "tporgwk" "hincfel"
Recoding the selected columns ans save new set of transactions.
# gndr - Gender
data2$gender <- ifelse(data2[,1]==1, "male", ifelse(data2[,1]==2, "female",NA))
# hincsrca - Main source of household income
data2$source.household.imcome <-
ifelse(data2[,3]==1, "Wages or salaries",
ifelse(data2[,3]==2, "Income from self-employment",
ifelse(data2[,3]==3, "Income from farming",
ifelse(data2[,3]==4, "Pensions",
ifelse(data2[,3]==5, "Unemployment/redundancy benefit",
ifelse(data2[,3]==6, "Any other social benefits or grants",
ifelse(data2[,3]==7, "Income from investments, savings etc.",
ifelse(data2[,3]==8, "Income from other sources",
ifelse(data2[,3]>8, "No answer", NA)))))))))
# ipeqopta - Important that people are treated equally and have equal opportunities
data2$treated.equally.equal.opportunities <-
ifelse(data2[,4]==1, "Very much like me",
ifelse(data2[,4]==2, "Like me",
ifelse(data2[,4]==3, "Somewhat like me",
ifelse(data2[,4]==4, "A little like me",
ifelse(data2[,4]==5, "Not like me",
ifelse(data2[,4]==6, "Not like me at all",
ifelse(data2[,4]>6, "No answer", NA)))))))
# tporgwk - What type of organisation work/worked for
data2$organization.type <-
ifelse(data2[,5]==1, "Central or local government",
ifelse(data2[,5]==2, "Other public sector (such as education and health)",
ifelse(data2[,5]==3, "A state owned enterprise",
ifelse(data2[,5]==4, "A private firm",
ifelse(data2[,5]==5, "Self employed",
ifelse(data2[,5]==6, "Other",
ifelse(data2[,5]>6, "No answer", NA)))))))
# hincfel - Feeling about household's income nowadays
data2$feeling.household.income <-
ifelse(data2[,6]==1, "Living comfortably on present income",
ifelse(data2[,6]==2, "Coping on present income",
ifelse(data2[,6]==3, "Difficult on present income",
ifelse(data2[,6]==4, "Very difficult on present income",
ifelse(data2[,6]>4, "No answer", NA)))))
names(data2)
## [1] "gndr" "cntry"
## [3] "hincsrca" "ipeqopta"
## [5] "tporgwk" "hincfel"
## [7] "gender" "source.household.imcome"
## [9] "treated.equally.equal.opportunities" "organization.type"
## [11] "feeling.household.income"
data.trans <- data2[,c(2,7:11)]
Return to cvs and read the transactions.
write.csv(data.trans, file = "ESS11-1.csv", row.names = F)
trans1 <- read.transactions("ESS11-1.csv", format = "basket", sep = ",", skip=1)
## Warning in asMethod(object): removing duplicated items in transactions
During this homework we will search for association rules between
various demographic and socio-economic attributes and their impact on
the perception of household financial well-being.
Association rule
mining is a method for identifying frequent patterns, correlations,
associations, or causal structures in datasets. Given a set of
transactions, the goal of association rule mining is to find the rules
that allow us to predict the occurrence of a specific item based on the
occurrences of the other items in the transaction. An association rule
consists of two parts: an antecedent (if) and a consequent (then). In
this case, the ‘Feeling about household’s income nowadays’ variable
serves as the consequent, while factors such as ‘Gender’, ‘Main source
of household income’, ‘Country’, ‘Importance of equality’, and ‘Type of
organization worked for’ act as antecedents. Association rules in
socio-economic analysis can provide insights into how different factors
influence financial perceptions. Relational association rule mining
allows us to determine the likelihood of various income-related outcomes
based on these influencing factors. This process uses three main
measures: support, confidence, and lift, to evaluate the strength and
relevance of the rules.
During the research on rule outcomes, we adjust support and
confidence levels to maintain them as high as possible while still
generating meaningful rules. Consequently, different categories of the
‘Feeling about household’s income nowadays’ variable may have varying
support and confidence thresholds. We try to capture common patterns
across countries.
rules_living.comfortably <-apriori(data=trans1, parameter=list(supp=0.01,conf = 0.4),
appearance=list(default="lhs", rhs="Living comfortably on present income"), control=list(verbose=F))
rules_living.comfortably.byconf<-sort(rules_living.comfortably, by="confidence", decreasing=TRUE)
inspect(rules_living.comfortably.byconf)
## lhs rhs support confidence coverage lift count
## [1] {SE,
## Wages or salaries} => {Living comfortably on present income} 0.01339775 0.7060367 0.01897599 1.981383 538
## [2] {male,
## NL} => {Living comfortably on present income} 0.01471760 0.7010676 0.02099313 1.967438 591
## [3] {male,
## SE} => {Living comfortably on present income} 0.01095727 0.6853583 0.01598765 1.923352 440
## [4] {SE} => {Living comfortably on present income} 0.02079390 0.6788618 0.03063054 1.905121 835
## [5] {NL,
## Wages or salaries} => {Living comfortably on present income} 0.01690905 0.6729435 0.02512700 1.888512 679
## [6] {Like me,
## NL} => {Living comfortably on present income} 0.01411993 0.6562500 0.02151609 1.841664 567
## [7] {SI,
## Wages or salaries} => {Living comfortably on present income} 0.01267557 0.6542416 0.01937444 1.836028 509
## [8] {NL} => {Living comfortably on present income} 0.02749278 0.6513274 0.04221038 1.827850 1104
## [9] {A private firm,
## NL} => {Living comfortably on present income} 0.01282498 0.6334563 0.02024604 1.777697 515
## [10] {IS} => {Living comfortably on present income} 0.01319853 0.6294537 0.02096822 1.766465 530
## [11] {female,
## NL} => {Living comfortably on present income} 0.01277518 0.6021127 0.02121725 1.689736 513
## [12] {CH,
## male} => {Living comfortably on present income} 0.01018528 0.5868006 0.01735731 1.646765 409
## [13] {SI} => {Living comfortably on present income} 0.01812930 0.5833333 0.03107879 1.637035 728
## [14] {CH,
## Wages or salaries} => {Living comfortably on present income} 0.01322343 0.5759219 0.02296045 1.616236 531
## [15] {NO,
## Wages or salaries} => {Living comfortably on present income} 0.01302421 0.5715847 0.02278613 1.604064 523
## [16] {NO} => {Living comfortably on present income} 0.01890128 0.5676889 0.03329515 1.593131 759
## [17] {DE,
## male,
## Wages or salaries} => {Living comfortably on present income} 0.01016037 0.5483871 0.01852774 1.538964 408
## [18] {CH} => {Living comfortably on present income} 0.01870206 0.5426301 0.03446558 1.522808 751
## [19] {A private firm,
## CH} => {Living comfortably on present income} 0.01063353 0.5310945 0.02002191 1.490435 427
## [20] {BE,
## Wages or salaries} => {Living comfortably on present income} 0.01155494 0.5254813 0.02198924 1.474682 464
## [21] {male,
## Other public sector (such as education and health)} => {Living comfortably on present income} 0.01770595 0.5231788 0.03384301 1.468221 711
## [22] {DE,
## Wages or salaries} => {Living comfortably on present income} 0.01927483 0.5187668 0.03715510 1.455839 774
## [23] {male,
## Other public sector (such as education and health),
## Wages or salaries} => {Living comfortably on present income} 0.01128100 0.5183066 0.02176512 1.454548 453
## [24] {DE,
## male} => {Living comfortably on present income} 0.01561410 0.5164745 0.03023209 1.449406 627
## [25] {DE,
## Very much like me} => {Living comfortably on present income} 0.01068333 0.5058962 0.02111764 1.419720 429
## [26] {DE,
## Like me} => {Living comfortably on present income} 0.01329814 0.4958217 0.02682040 1.391447 534
## [27] {DE} => {Living comfortably on present income} 0.02978384 0.4942149 0.06026497 1.386938 1196
## [28] {A private firm,
## DE,
## Wages or salaries} => {Living comfortably on present income} 0.01185377 0.4892086 0.02423050 1.372889 476
## [29] {Other public sector (such as education and health),
## Very much like me} => {Living comfortably on present income} 0.02428031 0.4865269 0.04990537 1.365363 975
## [30] {Other public sector (such as education and health),
## Very much like me,
## Wages or salaries} => {Living comfortably on present income} 0.01588804 0.4833333 0.03287180 1.356400 638
## [31] {Other public sector (such as education and health),
## Pensions} => {Living comfortably on present income} 0.01743202 0.4784689 0.03643291 1.342749 700
## [32] {A private firm,
## DE} => {Living comfortably on present income} 0.01725769 0.4749829 0.03633330 1.332966 693
## [33] {Central or local government,
## male} => {Living comfortably on present income} 0.01633629 0.4722822 0.03459010 1.325387 656
## [34] {DE,
## female} => {Living comfortably on present income} 0.01416974 0.4718076 0.03003287 1.324055 569
## [35] {Central or local government,
## Wages or salaries} => {Living comfortably on present income} 0.02288575 0.4707992 0.04861042 1.321225 919
## [36] {Other public sector (such as education and health),
## Wages or salaries} => {Living comfortably on present income} 0.03459010 0.4668908 0.07408606 1.310257 1389
## [37] {Central or local government,
## Very much like me} => {Living comfortably on present income} 0.01466780 0.4667195 0.03142743 1.309776 589
## [38] {Income from self-employment,
## male} => {Living comfortably on present income} 0.01504134 0.4646154 0.03237374 1.303871 604
## [39] {Other public sector (such as education and health)} => {Living comfortably on present income} 0.05426337 0.4640119 0.11694392 1.302178 2179
## [40] {Income from self-employment,
## Very much like me} => {Living comfortably on present income} 0.01030979 0.4625698 0.02228808 1.298131 414
## [41] {female,
## Other public sector (such as education and health),
## Very much like me} => {Living comfortably on present income} 0.01653551 0.4604716 0.03590995 1.292242 664
## [42] {female,
## Other public sector (such as education and health),
## Very much like me,
## Wages or salaries} => {Living comfortably on present income} 0.01078295 0.4601488 0.02343361 1.291337 433
## [43] {BE} => {Living comfortably on present income} 0.01815420 0.4573400 0.03969519 1.283454 729
## [44] {Central or local government,
## female,
## Wages or salaries} => {Living comfortably on present income} 0.01299930 0.4566929 0.02846399 1.281638 522
## [45] {Like me,
## Other public sector (such as education and health)} => {Living comfortably on present income} 0.02086861 0.4556824 0.04579639 1.278802 838
## [46] {Like me,
## Other public sector (such as education and health),
## Wages or salaries} => {Living comfortably on present income} 0.01275027 0.4543035 0.02806554 1.274933 512
## [47] {Income from self-employment} => {Living comfortably on present income} 0.02517681 0.4509367 0.05583225 1.265484 1011
## [48] {male,
## Very much like me,
## Wages or salaries} => {Living comfortably on present income} 0.04084072 0.4500549 0.09074609 1.263010 1640
## [49] {female,
## Other public sector (such as education and health),
## Wages or salaries} => {Living comfortably on present income} 0.02330909 0.4455021 0.05232095 1.250233 936
## [50] {Central or local government} => {Living comfortably on present income} 0.03556131 0.4430655 0.08026198 1.243395 1428
## [51] {female,
## Other public sector (such as education and health),
## Pensions} => {Living comfortably on present income} 0.01150513 0.4416826 0.02604841 1.239514 462
## [52] {IE,
## Wages or salaries} => {Living comfortably on present income} 0.01297440 0.4400338 0.02948501 1.234887 521
## [53] {female,
## Other public sector (such as education and health)} => {Living comfortably on present income} 0.03655743 0.4399161 0.08310091 1.234557 1468
## [54] {Central or local government,
## Like me} => {Living comfortably on present income} 0.01392071 0.4391202 0.03170136 1.232323 559
## [55] {female,
## Like me,
## Other public sector (such as education and health)} => {Living comfortably on present income} 0.01416974 0.4340198 0.03264767 1.218010 569
## [56] {FR,
## Wages or salaries} => {Living comfortably on present income} 0.01128100 0.4330784 0.02604841 1.215368 453
## [57] {Like me,
## male,
## Wages or salaries} => {Living comfortably on present income} 0.04851081 0.4325044 0.11216257 1.213757 1948
## [58] {female,
## Income from self-employment} => {Living comfortably on present income} 0.01013547 0.4320594 0.02345851 1.212508 407
## [59] {A private firm,
## male,
## Very much like me,
## Wages or salaries} => {Living comfortably on present income} 0.02450443 0.4243208 0.05774978 1.190791 984
## [60] {Income from self-employment,
## Self employed} => {Living comfortably on present income} 0.01215260 0.4236111 0.02868812 1.188799 488
## [61] {male,
## Very much like me} => {Living comfortably on present income} 0.06596773 0.4225554 0.15611615 1.185837 2649
## [62] {Central or local government,
## female} => {Living comfortably on present income} 0.01922502 0.4209378 0.04567188 1.181297 772
## [63] {male,
## Wages or salaries} => {Living comfortably on present income} 0.11368164 0.4187689 0.27146628 1.175210 4565
## [64] {Very much like me,
## Wages or salaries} => {Living comfortably on present income} 0.09007371 0.4179087 0.21553442 1.172796 3617
## [65] {Central or local government,
## Pensions} => {Living comfortably on present income} 0.01160474 0.4175627 0.02779161 1.171825 466
## [66] {ES} => {Living comfortably on present income} 0.01915031 0.4170282 0.04592091 1.170325 769
## [67] {GB} => {Living comfortably on present income} 0.01748182 0.4168646 0.04193645 1.169866 702
## [68] {FR} => {Living comfortably on present income} 0.01837832 0.4167137 0.04410300 1.169443 738
## [69] {A private firm,
## Like me,
## male,
## Wages or salaries} => {Living comfortably on present income} 0.03165156 0.4149527 0.07627752 1.164501 1271
## [70] {ES,
## Wages or salaries} => {Living comfortably on present income} 0.01080785 0.4086629 0.02644686 1.146849 434
## [71] {A private firm,
## FR} => {Living comfortably on present income} 0.01043431 0.4075875 0.02560016 1.143832 419
## [72] {female,
## IE} => {Living comfortably on present income} 0.01113159 0.4023402 0.02766710 1.129106 447
## [73] {IE} => {Living comfortably on present income} 0.02009662 0.4000992 0.05022911 1.122817 807
With the selected support level of 1% and confidence level of 40%, 73
rules were identified. Notably, only a few countries appear in these
rules: Sweden (SE), Netherlands (NL), Switzerland (CH), Slovenia (SI),
Norway (NO), Germany (DE), Belgium (BE), France (FR), Spain (ES),
Ireland (IE), Iceland (IS), and United Kingdom (GB).
We can notice when people in Sweden have wages or
salaries as their main source of income, have a confidence about 70.6%
(0.7060367) for reporting about feeling comfortable on their present
income. A lift of 1.981 means that Swedes with wages/salaries are almost
2 times more likely to be comfortable with their income compared to the
general survey population. Overall, another two rules show that people
in Sweden (especially males) are nearly 2 times (lift values 1.92 and
1.91) more likely to feel comfortable with their income compared to the
average respondent. The confidence for males in Sweden 68.5% (0.6853583)
is only slightly higher than the confidence for the general population
in Sweden 67.9% (0.6788618). This could indicate minimal gender
differences in this subgroups. 2.07% of respondents (support 0.0275) of
all survey respondents are from Sweden and feel comfortable with their
income.
Considering Netherlands, we can observe
more curious patterns. With the confidence 70.1 % (0.7010676) Dutch
males and confidence 60.2% (0.6021127) Dutch females feel comfortable
with their income. With the confidence of 67.3% (0.6729435), Dutch who
have wages and salaries as their main source of income reporting about
feeling comfortable on their present income. Another observation, that
working for a private firm correlates with a 63.3% chance of feeling
comfortable, which is slightly lower than the general confidence for all
Dutch respondents. Additionally, people in the Netherlands who
prioritize equality (“Like me”, importance of being treated equally and
have equal opportunities) have a confidence level of 65.6% (0.6562500),
slightly above the general population in the Netherlands (65.1%,
0.6513274). All rules show a lift above 1.7, indicating that people in
Netherlands are significantly more likely that average to feel
comfortable with their current income. 2.75% of respondents (support
0.0275) of all survey respondents are from Netherlands and feel
comfortable with their income.
Regarding
Switzerland, males and people who earn wage/salaries,
have the highest confidence levels for financial comfort around 57% -
59% (confidence 0.5868006 and 0.5759219 respectively). Working for a
private firm slightly reduces confidence to 53.1% (0.5310945), though
it’s still around the global average. The general Swiss population
reports a confidence of 54.3% (0.5426301), indicating overall favorable
economic conditions. Lift values between 1.49 and 1.65 suggest that
financial comfort is significantly higher in Switzerland than for the
average respondent.
Turning to Germany, we can
observe, that there are more rules and patterns for Germany, than for
other countries from this category. Males report a slightly higher
confidence (51.6%, 0.5164745) in financial comfort compared to females
(47.2%, 0.4718076). Respondents who work in private firms have a
confidence of 47.5% (0.4749829), and those who both employed in private
firm and receive wages/salaries report 48.9% (0.4892086) comfort. We can
notice the difference in the confidence levels comparing with the rule
just for wages/salaries, where confidence is 51.9% (0.5187668). This
could suggest that employment type may impact financial comfort. Another
curious thing that in Germany people pay significant attention toward
the social values influence. Respondents valuing equality and fairness
at 50.6% (0.5058962, “Very much like me”) and 49.6% (0.4958217, “Like
me”) confidence levels. The overall confidence for German respondents is
49.4% (0.4942149), indicating that financial comfort in Germany is above
average globally, lift = 1.39. 2.97% of respondents (support 0.02978384)
of all survey respondents are from Germany and feel comfortable with
their income.
For the countries Slovenia,
Norway, Belgium and
Spain we can notice the same pattern that people who
earn wages/salaries report feeling comfortable with their income.
Slovenian respondents with wages/salaries have a 65.4% (0.6542416)
chance of feeling comfortable. Norwegian respondents show 57.2%
(0.5715847) confidence that they feel comfortable on their income with
wages/salaries. Belgian respondents have a 52.5% (0.5254813) chance of
feeling comfortable on wages/salaries. The overall comfort level in
Belgium is relatively lower than in Slovenia or Norway. Spanish
respondents show the lowest confidence in this comparison. Only 40.9%
(0.4086629) feel comfortable with wages/salaries. All of the mentioned
countries in this abstract have lift values higher than 1, supporting
strong evidence about economic comfort for those earning wages/salaries.
Around 4.81% of respondents (support levels for each country between
0.0115 to 0.0184) of all survey respondents from Slovenia, Norway,
Belgium and Spain.
Lastly, turning now to Iceland,
Ireland, France and United
Kingdom. Icelandic respondents have a 62.9% (0.6294537)
likelihood of feeling comfortable on their current income, which is 1.77
times higher than the global average. 1.3% of respondents across survey
are Icelandic. Regarding the Ireland, 40.0% (0.4000992) of Irish
respondents feel comfortable with their income, and those earning
wages/salaries have a slightly higher confidence of 44.0% (0.4400338).
Worth noting, that for the Ireland there is a formed rule only for
females, since for other countries we observed males confidence mostly.
Females in Ireland report a confidence 40.2% (0.4023402).The lift values
are relatively low (1.12 to 1.23), suggesting that financial comfort in
Ireland is only slightly above average. In France, respondents have a
41.7% (0.04410300) confidence and feel comfortable on their income, with
wage/salary earners reporting 43.3% (0.4330784) comfort. We can observe
a strong association with employees in private firms, that have a
confidence of 40.8% (0.4075875). Similar to France, 41.7% of respondents
in the United Kingdom feel comfortable on their current income. 1.7% of
respondents across survey are British. The lift value 1.17 indicates
only a modest increase in financial comfort relative to the global
average.
Summarizing the observed countries, we can identify strong
patterns indicating that individuals, particularly males, who have
salaries/wages as their main source of income, and often work in private
firms, tend to feel more comfortable with their present income. However,
this level of comfort varies significantly across countries, influenced
by both economic conditions and social values. Countries like Sweden,
Netherlands, and Iceland show the highest comfort levels, with
confidence above 60% and lift values exceeding 1.7, indicating
well-above-average financial well-being. In Switzerland, Norway, and
Slovenia, comfort remains above average, with confidence around 55-65%
and lift values between 1.5 and 1.7. In Germany and Belgium, moderate
comfort is observed (confidence around 50%, lift around 1.3), influenced
by employment type and social values. Countries such as France, Ireland,
and Spain report lower confidence (around 40%), with near-average lift
values (1.1-1.2), highlighting more challenging economic conditions for
wage earners.
rules_coping <-apriori(data=trans1, parameter=list(supp=0.01,conf = 0.45),
appearance=list(default="lhs", rhs="Coping on present income"), control=list(verbose=F))
rules_coping.byconf<-sort(rules_coping, by="confidence", decreasing=TRUE)
inspect(rules_coping.byconf)
## lhs rhs support confidence coverage lift count
## [1] {PL,
## Wages or salaries} => {Coping on present income} 0.01491682 0.7269417 0.02051997 1.612054 599
## [2] {A private firm,
## PL} => {Coping on present income} 0.01202809 0.7263158 0.01656041 1.610666 483
## [3] {Like me,
## PL} => {Coping on present income} 0.01299930 0.7229917 0.01797988 1.603294 522
## [4] {male,
## PL} => {Coping on present income} 0.01182887 0.7037037 0.01680944 1.560522 475
## [5] {PL} => {Coping on present income} 0.02520171 0.7018031 0.03590995 1.556307 1012
## [6] {female,
## PL} => {Coping on present income} 0.01337285 0.7001304 0.01910051 1.552597 537
## [7] {HU,
## Like me,
## Wages or salaries} => {Coping on present income} 0.01038450 0.6915423 0.01501644 1.533553 417
## [8] {HU,
## Like me} => {Coping on present income} 0.01471760 0.6588629 0.02233788 1.461083 591
## [9] {A private firm,
## HU,
## Wages or salaries} => {Coping on present income} 0.01414484 0.6566474 0.02154099 1.456170 568
## [10] {female,
## HU,
## Wages or salaries} => {Coping on present income} 0.01309891 0.6344994 0.02064449 1.407055 526
## [11] {HU,
## Wages or salaries} => {Coping on present income} 0.02228808 0.6298381 0.03538699 1.396719 895
## [12] {A private firm,
## HU} => {Coping on present income} 0.01795498 0.6157131 0.02916127 1.365395 721
## [13] {female,
## HU} => {Coping on present income} 0.01949895 0.6102884 0.03195039 1.353365 783
## [14] {HU} => {Coping on present income} 0.03185078 0.6038716 0.05274430 1.339136 1279
## [15] {RS,
## Wages or salaries} => {Coping on present income} 0.01270047 0.5978898 0.02124216 1.325870 510
## [16] {HU,
## male} => {Coping on present income} 0.01235183 0.5940120 0.02079390 1.317271 496
## [17] {LT,
## Wages or salaries} => {Coping on present income} 0.01160474 0.5891277 0.01969818 1.306440 466
## [18] {female,
## LT} => {Coping on present income} 0.01222731 0.5852205 0.02089352 1.297775 491
## [19] {A private firm,
## AT,
## Wages or salaries} => {Coping on present income} 0.01105688 0.5819135 0.01900090 1.290442 444
## [20] {FI,
## male} => {Coping on present income} 0.01115649 0.5818182 0.01917522 1.290230 448
## [21] {A private firm,
## LT} => {Coping on present income} 0.01063353 0.5746972 0.01850284 1.274439 427
## [22] {SK,
## Wages or salaries} => {Coping on present income} 0.01148023 0.5705446 0.02012153 1.265230 461
## [23] {LT} => {Coping on present income} 0.01934954 0.5692308 0.03399243 1.262317 777
## [24] {A private firm,
## FI} => {Coping on present income} 0.01008567 0.5672269 0.01778066 1.257873 405
## [25] {FI} => {Coping on present income} 0.02166550 0.5566219 0.03892320 1.234355 870
## [26] {A private firm,
## AT} => {Coping on present income} 0.02009662 0.5531186 0.03633330 1.226587 807
## [27] {female,
## RS} => {Coping on present income} 0.01138062 0.5492788 0.02071920 1.218072 457
## [28] {A private firm,
## AT,
## female} => {Coping on present income} 0.01105688 0.5488257 0.02014643 1.217067 444
## [29] {AT,
## Wages or salaries} => {Coping on present income} 0.01596275 0.5488014 0.02908656 1.217013 641
## [30] {AT,
## Very much like me} => {Coping on present income} 0.01359697 0.5470942 0.02485307 1.213227 546
## [31] {RS} => {Coping on present income} 0.02121725 0.5451056 0.03892320 1.208817 852
## [32] {FI,
## Wages or salaries} => {Coping on present income} 0.01110668 0.5354142 0.02074410 1.187326 446
## [33] {female,
## FI} => {Coping on present income} 0.01050901 0.5321564 0.01974798 1.180101 422
## [34] {IT,
## Pensions} => {Coping on present income} 0.01160474 0.5319635 0.02181492 1.179673 466
## [35] {AT,
## female} => {Coping on present income} 0.01802968 0.5319618 0.03389282 1.179670 724
## [36] {A state owned enterprise,
## female,
## Wages or salaries} => {Coping on present income} 0.01030979 0.5307692 0.01942425 1.177025 414
## [37] {AT} => {Coping on present income} 0.03105389 0.5297366 0.05862138 1.174735 1247
## [38] {AT,
## Pensions} => {Coping on present income} 0.01292459 0.5295918 0.02440482 1.174414 519
## [39] {A private firm,
## female,
## Somewhat like me,
## Wages or salaries} => {Coping on present income} 0.01182887 0.5277778 0.02241259 1.170391 475
## [40] {AT,
## male} => {Coping on present income} 0.01302421 0.5266868 0.02472856 1.167972 523
## [41] {A private firm,
## Somewhat like me,
## Wages or salaries} => {Coping on present income} 0.02811535 0.5263403 0.05341667 1.167204 1129
## [42] {A private firm,
## male,
## Somewhat like me,
## Wages or salaries} => {Coping on present income} 0.01628648 0.5253012 0.03100408 1.164899 654
## [43] {A private firm,
## IT,
## Wages or salaries} => {Coping on present income} 0.01105688 0.5248227 0.02106784 1.163838 444
## [44] {A private firm,
## PT} => {Coping on present income} 0.01103198 0.5224057 0.02111764 1.158478 443
## [45] {female,
## HR} => {Coping on present income} 0.01103198 0.5199531 0.02121725 1.153039 443
## [46] {A state owned enterprise,
## female} => {Coping on present income} 0.02059468 0.5188206 0.03969519 1.150528 827
## [47] {A private firm,
## IT} => {Coping on present income} 0.01812930 0.5181495 0.03498854 1.149040 728
## [48] {AT,
## Like me} => {Coping on present income} 0.01157984 0.5178174 0.02236279 1.148303 465
## [49] {PT,
## Wages or salaries} => {Coping on present income} 0.01060863 0.5126354 0.02069429 1.136812 426
## [50] {A private firm,
## Like me,
## male,
## Pensions} => {Coping on present income} 0.01324833 0.5105566 0.02594880 1.132202 532
## [51] {A private firm,
## male,
## Somewhat like me} => {Coping on present income} 0.02360793 0.5105008 0.04624465 1.132078 948
## [52] {A private firm,
## Like me,
## Pensions} => {Coping on present income} 0.02597370 0.5100244 0.05092639 1.131022 1043
## [53] {A private firm,
## female,
## Like me,
## Pensions} => {Coping on present income} 0.01272537 0.5094716 0.02497759 1.129796 511
## [54] {A state owned enterprise,
## Like me} => {Coping on present income} 0.01573862 0.5092667 0.03090447 1.129341 632
## [55] {HR,
## Wages or salaries} => {Coping on present income} 0.01148023 0.5082690 0.02258691 1.127129 461
## [56] {HR} => {Coping on present income} 0.01977289 0.5079974 0.03892320 1.126527 794
## [57] {SK} => {Coping on present income} 0.01815420 0.5055479 0.03590995 1.121095 729
## [58] {A private firm,
## Somewhat like me} => {Coping on present income} 0.04128897 0.5047184 0.08180596 1.119255 1658
## [59] {GR,
## Like me} => {Coping on present income} 0.01344755 0.5018587 0.02679550 1.112914 540
## [60] {A state owned enterprise,
## Pensions} => {Coping on present income} 0.01705847 0.5007310 0.03406714 1.110413 685
## [61] {male,
## Somewhat like me,
## Wages or salaries} => {Coping on present income} 0.02258691 0.4994493 0.04522363 1.107571 907
## [62] {IT,
## Like me} => {Coping on present income} 0.01110668 0.4994401 0.02223827 1.107550 446
## [63] {A state owned enterprise,
## Wages or salaries} => {Coping on present income} 0.01725769 0.4989201 0.03459010 1.106397 693
## [64] {Somewhat like me,
## Wages or salaries} => {Coping on present income} 0.04303217 0.4984136 0.08633828 1.105274 1728
## [65] {A state owned enterprise} => {Coping on present income} 0.03600956 0.4975912 0.07236777 1.103450 1446
## [66] {female,
## Somewhat like me,
## Wages or salaries} => {Coping on present income} 0.02044526 0.4972744 0.04111465 1.102747 821
## [67] {A private firm,
## female,
## Somewhat like me} => {Coping on present income} 0.01768104 0.4971989 0.03556131 1.102580 710
## [68] {A private firm,
## Pensions,
## Somewhat like me} => {Coping on present income} 0.01023508 0.4969770 0.02059468 1.102088 411
## [69] {GR,
## Wages or salaries} => {Coping on present income} 0.01718299 0.4956897 0.03466481 1.099233 690
## [70] {IT,
## Wages or salaries} => {Coping on present income} 0.01760634 0.4954450 0.03553641 1.098691 707
## [71] {female,
## IT} => {Coping on present income} 0.01875187 0.4934469 0.03800179 1.094260 753
## [72] {PT} => {Coping on present income} 0.01678454 0.4908958 0.03419165 1.088602 674
## [73] {male,
## Pensions,
## Somewhat like me} => {Coping on present income} 0.01001096 0.4908425 0.02039546 1.088484 402
## [74] {A private firm,
## GR,
## Wages or salaries} => {Coping on present income} 0.01113159 0.4895947 0.02273633 1.085717 447
## [75] {GR,
## male} => {Coping on present income} 0.01509114 0.4891041 0.03085467 1.084629 606
## [76] {A private firm,
## female,
## Like me,
## Wages or salaries} => {Coping on present income} 0.03145234 0.4880216 0.06444865 1.082229 1263
## [77] {A private firm,
## female,
## Pensions} => {Coping on present income} 0.03100408 0.4878527 0.06355215 1.081854 1245
## [78] {Like me,
## male,
## Pensions} => {Coping on present income} 0.02490288 0.4863813 0.05120032 1.078591 1000
## [79] {A private firm,
## Pensions} => {Coping on present income} 0.06245642 0.4859523 0.12852376 1.077640 2508
## [80] {A private firm,
## male,
## Pensions} => {Coping on present income} 0.03145234 0.4840935 0.06497161 1.073518 1263
## [81] {A private firm,
## female,
## Wages or salaries} => {Coping on present income} 0.07749776 0.4835301 0.16027493 1.072268 3112
## [82] {A private firm,
## female,
## Like me} => {Coping on present income} 0.04743998 0.4832572 0.09816715 1.071663 1905
## [83] {male,
## Somewhat like me} => {Coping on present income} 0.03713019 0.4819005 0.07704951 1.068654 1491
## [84] {Pensions,
## Somewhat like me} => {Coping on present income} 0.02169041 0.4814815 0.04504931 1.067725 871
## [85] {IT,
## Very much like me} => {Coping on present income} 0.01245144 0.4812320 0.02587409 1.067172 500
## [86] {Like me,
## Pensions} => {Coping on present income} 0.05520968 0.4792477 0.11520072 1.062772 2217
## [87] {female,
## Like me,
## Wages or salaries} => {Coping on present income} 0.05690308 0.4791361 0.11876183 1.062524 2285
## [88] {Somewhat like me} => {Coping on present income} 0.07291563 0.4789792 0.15223130 1.062176 2928
## [89] {A private firm,
## female,
## Pensions,
## Very much like me} => {Coping on present income} 0.01118139 0.4786780 0.02335890 1.061508 449
## [90] {A private firm,
## Like me,
## Wages or salaries} => {Coping on present income} 0.06731248 0.4783224 0.14072617 1.060720 2703
## [91] {Like me,
## Self employed} => {Coping on present income} 0.01514095 0.4764890 0.03177607 1.056654 608
## [92] {A private firm,
## Wages or salaries} => {Coping on present income} 0.16271541 0.4764474 0.34151808 1.056562 6534
## [93] {female,
## Somewhat like me} => {Coping on present income} 0.03578544 0.4759854 0.07518179 1.055537 1437
## [94] {A private firm,
## Like me} => {Coping on present income} 0.10033370 0.4755666 0.21097719 1.054609 4029
## [95] {IT} => {Coping on present income} 0.03389282 0.4750436 0.07134675 1.053449 1361
## [96] {Self employed,
## Wages or salaries} => {Coping on present income} 0.01078295 0.4747807 0.02271143 1.052866 433
## [97] {female,
## Pensions,
## Somewhat like me} => {Coping on present income} 0.01167945 0.4737374 0.02465385 1.050552 469
## [98] {female,
## Like me,
## Pensions} => {Coping on present income} 0.03030680 0.4735409 0.06400040 1.050116 1217
## [99] {A little like me,
## Wages or salaries} => {Coping on present income} 0.01192848 0.4728529 0.02522662 1.048591 479
## [100] {A private firm,
## female} => {Coping on present income} 0.11791513 0.4725077 0.24955175 1.047825 4735
## [101] {A state owned enterprise,
## male} => {Coping on present income} 0.01541488 0.4717988 0.03267258 1.046253 619
## [102] {A private firm,
## male,
## Wages or salaries} => {Coping on present income} 0.08521765 0.4701841 0.18124315 1.042672 3422
## [103] {A private firm,
## Like me,
## male,
## Wages or salaries} => {Coping on present income} 0.03586015 0.4701273 0.07627752 1.042547 1440
## [104] {female,
## Like me} => {Coping on present income} 0.09632434 0.4698737 0.20500050 1.041984 3868
## [105] {A private firm,
## Like me,
## male} => {Coping on present income} 0.05289371 0.4688742 0.11281004 1.039768 2124
## [106] {A private firm,
## GR} => {Coping on present income} 0.01571372 0.4687964 0.03351927 1.039595 631
## [107] {Like me,
## Wages or salaries} => {Coping on present income} 0.10822791 0.4686725 0.23092439 1.039320 4346
## [108] {female,
## Self employed} => {Coping on present income} 0.01568881 0.4677060 0.03354418 1.037177 630
## [109] {female,
## Wages or salaries} => {Coping on present income} 0.14209583 0.4673219 0.30406415 1.036325 5706
## [110] {A private firm} => {Coping on present income} 0.24469569 0.4670818 0.52388186 1.035793 9826
## [111] {A state owned enterprise,
## Very much like me} => {Coping on present income} 0.01118139 0.4662513 0.02398147 1.033951 449
## [112] {A private firm,
## Pensions,
## Very much like me} => {Coping on present income} 0.02099313 0.4657459 0.04507421 1.032830 843
## [113] {Like me} => {Coping on present income} 0.18296145 0.4647059 0.39371451 1.030524 7347
## [114] {Pensions,
## Self employed} => {Coping on present income} 0.01108178 0.4635417 0.02390676 1.027942 445
## [115] {male,
## Pensions} => {Coping on present income} 0.05799880 0.4626540 0.12536109 1.025974 2329
## [116] {A little like me,
## A private firm} => {Coping on present income} 0.01190358 0.4622824 0.02574958 1.025150 478
## [117] {A private firm,
## male} => {Coping on present income} 0.12678056 0.4621460 0.27433011 1.024847 5091
## [118] {Pensions} => {Coping on present income} 0.13290666 0.4612792 0.28812631 1.022925 5337
## [119] {Wages or salaries} => {Coping on present income} 0.26489192 0.4602570 0.57553043 1.020658 10637
## [120] {female,
## Pensions} => {Coping on present income} 0.07490786 0.4602203 0.16276522 1.020577 3008
## [121] {Like me,
## male} => {Coping on present income} 0.08663712 0.4590921 0.18871402 1.018075 3479
## [122] {Self employed} => {Coping on present income} 0.03962048 0.4579735 0.08651260 1.015594 1591
## [123] {Like me,
## Other public sector (such as education and health),
## Wages or salaries} => {Coping on present income} 0.01284989 0.4578527 0.02806554 1.015327 516
## [124] {Like me,
## male,
## Wages or salaries} => {Coping on present income} 0.05132483 0.4575933 0.11216257 1.014751 2061
## [125] {female} => {Coping on present income} 0.24315171 0.4563470 0.53282199 1.011987 9764
## [126] {A private firm,
## female,
## Very much like me,
## Wages or salaries} => {Coping on present income} 0.02851380 0.4558121 0.06255603 1.010801 1145
## [127] {IT,
## male} => {Coping on present income} 0.01514095 0.4540702 0.03334495 1.006939 608
## [128] {female,
## Like me,
## Other public sector (such as education and health)} => {Coping on present income} 0.01481721 0.4538520 0.03264767 1.006455 595
## [129] {male,
## Wages or salaries} => {Coping on present income} 0.12279610 0.4523438 0.27146628 1.003110 4931
## [130] {male,
## Self employed} => {Coping on present income} 0.02393167 0.4518101 0.05296842 1.001926 961
## [131] {GR} => {Coping on present income} 0.03097918 0.4512151 0.06865724 1.000607 1244
## [132] {A private firm,
## female,
## Very much like me} => {Coping on present income} 0.04372946 0.4510660 0.09694691 1.000277 1756
## [133] {} => {Coping on present income} 0.45094133 0.4509413 1.00000000 1.000000 18108
## [134] {A little like me,
## female} => {Coping on present income} 0.01001096 0.4501680 0.02223827 0.998285 402
## Warning: Too many rules supplied. Only plotting the best 100 using 'lift'
## (change control parameter max if needed).
With the selected support level of 1% and confidence level of 45%,
125 rules were identified. We can notice the following countries that
were included in these rules: Poland (PL), Hungary (HU), Serbia (RS),
Lithuania (LT), Austria (AT), Finland (FI), Slovakia (SK), Italy (IT),
Portugal (PT), Greece (GR), Croatia (HR).
Let’s start with Poland, since its rules have the
highest confidence across the observed. Across all groups, confidence
levels are consistently around 70-73%, suggesting that a significant
proportion of Polish struggles to move beyond simply coping on present
income. 2.52% of respondents (support 0.02520171) of all survey
respondents are from Poland and struggle with their current income.
Males have a 70.3% (0.7037037) confidence, while females are at 70.0%
(0.7001304), showing only minor gender differences in financial comfort.
Employees earning wages/salaries and those working in private firms
report nearly identical confidence levels 72.6-72.7% (0.7269417 and
0.7263158 respectively), indicating no major financial advantage for
private firm employees. Additionally, we can notice that people who
treated other people equally and opportunities equally also experience
similar financial challenges, with 72.3% (0.7229917) reporting coping.
Lift values around 1.55 to 1.61 suggest that Polish respondents are
substantially more likely than the global average to report coping
financially.
Now turning to Hungary. We can observe
that people who earn wages/salaries and socially conscious individuals
(regarding equality) have the highest likelihood of coping financially,
with confidence values around 69% (0.6915423). Employees working in
private firms report coping at 61.6% (0.6157131), and those earning
wages/salaries in private firms have 65.7% (0.6566474) confidence.
Females in Hungary (61.0%, 0.6102884 confidence) are slightly more
likely to be coping than males (59.4%, 0.5940120 confidence), though the
difference is minimal. Across Hungary, 60.4% (0.6038716) of respondents
are coping financially, with a lift of 1.34, suggesting that coping is
significantly more common than average. 3.18% of respondents (support
0.03185078) of all survey respondents are from Hungary and struggle with
their current income. Hungary’s situation isn’t as severe as Poland,
where over 70% report coping on income.
Regarding
Greece, that shares the same patterns, wage/salary
earners and private firm employees have coping rates around 46-49%,
suggesting that jobs don’t provide significant financial security in
Greece, comparing with Hungary, for instance. The difference between
private firm employees (46.9%, 0.4687964 confidence) and wage earners
overall (49.6%, 0.4956897 confidence) suggests that private sector
employment might be slightly less favorable in terms of financial
security. Greek males report coping at a 48.9% (0.4891041) rate, similar
to the general wage-earning population, suggesting no significant gender
differences in financial conditions. Respondents identifying with “Like
me” social values have the highest coping rate (50.2%, 0.5018587
confidence), which could indicate awareness of financial equality
challenges. About 50% of the subgroups in Greece report coping on their
income, meaning half of the population struggles to maintain financial
stability. Lift values between 1.04 and 1.11 suggest that financial
strain in Greece is only slightly above average globally. 1.34% (support
0.01344755) of all survey respondents are from Greece and struggle with
their current income.
Next, we can notice that several countries
share the same patterns across associated rules. There are
Serbia, Lithuania,
Finland, Slovakia,
Portugal, and Croatia. In all of these
countries, over 50% of respondents report coping on present income.
Serbia and Lithuania presented the highest confidence for wage/salary
earners as a main source of income (59.8%,0.5978898 and 58.9%, 0.5891277
respectively). The lowest confidence levels have Croatia 50.8%
(0.5079974) and Portugal 49.1% (0.4908958). Wage/salary earners
generally show a slightly higher likelihood of coping, with confidence
levels around 58-60% in most cases. Females in these countries show
quite varying results, e.g., 58.5% (0.5852205) in Lithuania and 51.9%
(0.5199531) in Croatia. Private firm employees also report coping at
similar levels, e.g., 57.5% (0.5746972)in Lithuania and 56.7%
(0.5672269)in Finland. While Finland follows the same pattern, its
confidence values for coping are lower (53-58%), with lift values
ranging from 1.18 to 1.29, could suggest slightly better financial
comfort than in Serbia and Lithuania. Portugal and Croatia lag behind
other countries. Confidence for coping is closer to 50-52%, with lower
lift values (around 1.09 to 1.15), suggesting a closer-to-average
financial experience.
Now turning to Austria and
Italy. These countries are separated from other since
we can observe a new pattern here - Pensions. Pension recipients in both
countries have quite similar rates of reporting that they are coping
with their income: 52.9% (0.5295918) in Austria and 53.2% (0.5319635) in
Italy - which indicates that a majority of this group isn’t facing
severe financial difficulty but isn’t necessarily living comfortably
either. In both Austria and Italy, over 50% of respondents report coping
on their income. Employees who earn wages in private firms have
confidence values of 58.2% (0.5819135) in Austria and 52.5% (0.5248227)
in Italy, showing a difference in 6% and suggesting dissimilar working
conditions in private companies. Females in Austria and Italy report
similar coping rates (53.1%, 0.5319618 and 49.3%, 0.4934469,
respectively). Respondents supporting social equality also report
coping, with slightly higher rates in Austria (54.7%, 0.5470942) than in
Italy (48.1%, 0.4812320). Austria’s general population shows a 52.9%
(0.5297366) coping rate, compared to 47.5% (0.4750436) in Italy,
indicating slightly better financial conditions in Austria. 3.10% of
respondents (support 0.03105389) of all survey respondents are from
Austria and 3.38% of respondents (support 0.03389282) are from Italy
struggle with their current income. Lift values are around 1.05 to 1.29,
suggesting only slightly above-average financial stress.
The overall
pattern observed across the countries shows that both males and females
with wages or salaries as their main source of income, often employed in
private firms, tend to report coping with their present income rather
than living comfortably. Additionally, pension recipients in countries
like Austria and Italy display similar coping rates, indicating
financial stability without severe difficulties. Social values, such as
the importance of equality and equal opportunities, also correlate with
coping, as seen in countries like Greece, Austria, and Germany. While
some countries, such as Poland and Lithuania, have higher coping
confidence levels (above 60-70%), others like Portugal, Croatia, and
Greece report confidence closer to 50%, suggesting lower financial
security. Countries with quite average lift values (1.1 to 1.6) reflect
conditions that are slightly more financially stressful than the global
average, with minor gender differences in financial comfort.
rules_difficulties <-apriori(data=trans1, parameter=list(supp=0.01,conf = 0.01),
appearance=list(default="lhs", rhs="Difficult on present income"), control=list(verbose=F))
rules_difficulties.byconf<-sort(rules_difficulties, by="confidence", decreasing=TRUE)
inspect(rules_difficulties.byconf)
## lhs rhs support confidence coverage lift count
## [1] {female,
## GR} => {Difficult on present income} 0.01534017 0.40579710 0.03780257 2.7798001 616
## [2] {A private firm,
## GR} => {Difficult on present income} 0.01270047 0.37890045 0.03351927 2.5955521 510
## [3] {GR} => {Difficult on present income} 0.02522662 0.36742836 0.06865724 2.5169658 1013
## [4] {GR,
## Wages or salaries} => {Difficult on present income} 0.01242654 0.35847701 0.03466481 2.4556470 499
## [5] {No answer,
## Pensions} => {Difficult on present income} 0.01125610 0.29815303 0.03775276 2.0424144 452
## [6] {HU} => {Difficult on present income} 0.01227712 0.23276676 0.05274430 1.5945039 493
## [7] {female,
## No answer} => {Difficult on present income} 0.01885148 0.22925500 0.08222931 1.5704476 757
## [8] {female,
## Pensions} => {Difficult on present income} 0.03292161 0.20226438 0.16276522 1.3855559 1322
## [9] {No answer} => {Difficult on present income} 0.02495268 0.19845514 0.12573463 1.3594617 1002
## [10] {A private firm,
## female,
## Pensions} => {Difficult on present income} 0.01250125 0.19670846 0.06355215 1.3474966 502
## [11] {female,
## Like me,
## Pensions} => {Difficult on present income} 0.01247634 0.19494163 0.06400040 1.3353934 501
## [12] {female,
## Somewhat like me} => {Difficult on present income} 0.01441877 0.19178536 0.07518179 1.3137722 579
## [13] {female,
## Pensions,
## Very much like me} => {Difficult on present income} 0.01115649 0.18768328 0.05944317 1.2856721 448
## [14] {Pensions} => {Difficult on present income} 0.05110071 0.17735523 0.28812631 1.2149227 2052
## [15] {A private firm,
## Pensions} => {Difficult on present income} 0.02258691 0.17574114 0.12852376 1.2038658 907
## [16] {A private firm,
## female,
## Very much like me} => {Difficult on present income} 0.01690905 0.17441562 0.09694691 1.1947857 679
## [17] {A private firm,
## female} => {Difficult on present income} 0.04318159 0.17303662 0.24955175 1.1853392 1734
## [18] {Somewhat like me} => {Difficult on present income} 0.02574958 0.16914772 0.15223130 1.1586994 1034
## [19] {Pensions,
## Very much like me} => {Difficult on present income} 0.01698376 0.16889549 0.10055782 1.1569716 682
## [20] {Like me,
## Pensions} => {Difficult on present income} 0.01934954 0.16796368 0.11520072 1.1505885 777
## [21] {A private firm,
## female,
## Like me} => {Difficult on present income} 0.01643590 0.16742770 0.09816715 1.1469169 660
## [22] {A private firm,
## Somewhat like me} => {Difficult on present income} 0.01352226 0.16529680 0.08180596 1.1323198 543
## [23] {female} => {Difficult on present income} 0.08708537 0.16344176 0.53282199 1.1196123 3497
## [24] {IT} => {Difficult on present income} 0.01155494 0.16195462 0.07134675 1.1094251 464
## [25] {female,
## Very much like me} => {Difficult on present income} 0.03292161 0.15641268 0.21047913 1.0714616 1322
## [26] {A private firm,
## male,
## Pensions} => {Difficult on present income} 0.01008567 0.15523189 0.06497161 1.0633729 405
## [27] {female,
## Like me} => {Difficult on present income} 0.03177607 0.15500486 0.20500050 1.0618177 1276
## [28] {A private firm,
## female,
## Wages or salaries} => {Difficult on present income} 0.02462895 0.15366687 0.16027493 1.0526522 989
## [29] {A private firm,
## Very much like me} => {Difficult on present income} 0.02848889 0.15294118 0.18627353 1.0476810 1144
## [30] {A private firm} => {Difficult on present income} 0.07926586 0.15130484 0.52388186 1.0364717 3183
## [31] {A state owned enterprise} => {Difficult on present income} 0.01080785 0.14934618 0.07236777 1.0230545 434
## [32] {male,
## Somewhat like me} => {Difficult on present income} 0.01133081 0.14705882 0.07704951 1.0073856 455
## [33] {} => {Difficult on present income} 0.14598068 0.14598068 1.00000000 1.0000000 5862
## [34] {male,
## Pensions} => {Difficult on present income} 0.01817910 0.14501391 0.12536109 0.9933774 730
## [35] {Very much like me} => {Difficult on present income} 0.05234585 0.14278921 0.36659528 0.9781378 2102
## [36] {A private firm,
## Like me} => {Difficult on present income} 0.02978384 0.14117092 0.21097719 0.9670521 1196
## [37] {Somewhat like me,
## Wages or salaries} => {Difficult on present income} 0.01202809 0.13931353 0.08633828 0.9543286 483
## [38] {A private firm,
## Very much like me,
## Wages or salaries} => {Difficult on present income} 0.01656041 0.13765266 0.12030581 0.9429512 665
## [39] {Self employed} => {Difficult on present income} 0.01180396 0.13644214 0.08651260 0.9346589 474
## [40] {Like me} => {Difficult on present income} 0.05319255 0.13510436 0.39371451 0.9254949 2136
## [41] {female,
## Wages or salaries} => {Difficult on present income} 0.04094033 0.13464373 0.30406415 0.9223394 1644
## [42] {female,
## Very much like me,
## Wages or salaries} => {Difficult on present income} 0.01668493 0.13370585 0.12478833 0.9159147 670
## [43] {A private firm,
## Wages or salaries} => {Difficult on present income} 0.04542285 0.13300277 0.34151808 0.9110985 1824
## [44] {A private firm,
## male} => {Difficult on present income} 0.03608427 0.13153595 0.27433011 0.9010504 1449
## [45] {A private firm,
## male,
## Very much like me} => {Difficult on present income} 0.01157984 0.12963479 0.08932663 0.8880271 465
## [46] {female,
## Like me,
## Wages or salaries} => {Difficult on present income} 0.01501644 0.12644160 0.11876183 0.8661530 603
## [47] {male} => {Difficult on present income} 0.05889531 0.12606610 0.46717801 0.8635807 2365
## [48] {male,
## Very much like me} => {Difficult on present income} 0.01942425 0.12442176 0.15611615 0.8523166 780
## [49] {Very much like me,
## Wages or salaries} => {Difficult on present income} 0.02657137 0.12328134 0.21553442 0.8445045 1067
## [50] {A private firm,
## Like me,
## Wages or salaries} => {Difficult on present income} 0.01723279 0.12245620 0.14072617 0.8388521 692
## [51] {Wages or salaries} => {Difficult on present income} 0.06985257 0.12137078 0.57553043 0.8314167 2805
## [52] {A private firm,
## Like me,
## male} => {Difficult on present income} 0.01334794 0.11832230 0.11281004 0.8105340 536
## [53] {A private firm,
## male,
## Wages or salaries} => {Difficult on present income} 0.02079390 0.11472932 0.18124315 0.7859213 835
## [54] {Like me,
## male} => {Difficult on present income} 0.02141648 0.11348641 0.18871402 0.7774071 860
## [55] {Like me,
## Wages or salaries} => {Difficult on present income} 0.02545074 0.11021244 0.23092439 0.7549797 1022
## [56] {male,
## Wages or salaries} => {Difficult on present income} 0.02891224 0.10650399 0.27146628 0.7295760 1161
## [57] {Other public sector (such as education and health)} => {Difficult on present income} 0.01110668 0.09497445 0.11694392 0.6505960 446
## [58] {Like me,
## male,
## Wages or salaries} => {Difficult on present income} 0.01043431 0.09302842 0.11216257 0.6372653 419
With the selected support level of 1% and confidence level of 1%, 58
rules were identified. We observe that no countries appear in both the
“Living comfortably on present income” and “Coping on present income”
categories for the selected levels of confidence and support. However,
when focusing on the “Difficult on present income” category, three
countries from the “Coping on present income” group—Greece (GR), Hungary
(HU), and Italy (IT)—are now present.
Over one-third of respondents,
particularly women and private firm employees, report difficulty on
their income. The high lift values (2.46 to 2.78) indicate that
financial difficulty is 2-3 times more likely than the global average.
The general population shows 36.7% (0.36742836) confidence, meaning more
than one-third of respondents in Greece find it
difficult to manage on their current income. Even wage/salary earners in
Greece report a 35.8% (0.35847701) chance of financial difficulty,
reflecting a challenging economic environment for salaried workers. In
Hungary, the difficulty rate has confidence 23.3%
(0.23276676), indicating financial stress.Lift value 1.59 suggest that
financial hardship is more common than average. A relatively small
portion of the survey population falls into this category(support
1.23%), which may reflect lower severity compared to Greece (2.52%). In
Italy, only 16.2% (0.16195462) report difficulty,
suggesting that economic conditions are relatively more stable, with
only minor deviations from the global average. With a lift of 1.11,
suggesting conditions in Italy are closer to the global average.
rules_very.difficult <-apriori(data=trans1, parameter=list(supp=0.005,conf = 0.01),
appearance=list(default="lhs", rhs="Very difficult on present income"), control=list(verbose=F))
rules_very.difficult.byconf<-sort(rules_very.difficult, by="confidence", decreasing=TRUE)
inspect(rules_very.difficult.byconf)
## lhs rhs support confidence coverage lift count
## [1] {Any other social benefits or grants} => {Very difficult on present income} 0.005005479 0.21566524 0.02320948 6.0731088 201
## [2] {GR} => {Very difficult on present income} 0.006001594 0.08741386 0.06865724 2.4615644 241
## [3] {female,
## No answer} => {Very difficult on present income} 0.006101205 0.07419746 0.08222931 2.0893920 245
## [4] {No answer} => {Very difficult on present income} 0.008267756 0.06575560 0.12573463 1.8516702 332
## [5] {female,
## Pensions} => {Very difficult on present income} 0.008666202 0.05324357 0.16276522 1.4993331 348
## [6] {Pensions} => {Very difficult on present income} 0.012999303 0.04511668 0.28812631 1.2704807 522
## [7] {female,
## Very much like me} => {Very difficult on present income} 0.008765813 0.04164695 0.21047913 1.1727734 352
## [8] {female} => {Very difficult on present income} 0.021242156 0.03986726 0.53282199 1.1226577 853
## [9] {A private firm,
## Very much like me} => {Very difficult on present income} 0.007296543 0.03917112 0.18627353 1.1030544 293
## [10] {Very much like me} => {Very difficult on present income} 0.013646778 0.03722573 0.36659528 1.0482724 548
## [11] {A private firm,
## female} => {Very difficult on present income} 0.009139357 0.03662309 0.24955175 1.0313021 367
## [12] {} => {Very difficult on present income} 0.035511505 0.03551151 1.00000000 1.0000000 1426
## [13] {Somewhat like me} => {Very difficult on present income} 0.005304313 0.03484378 0.15223130 0.9811968 213
## [14] {female,
## Like me} => {Very difficult on present income} 0.006848292 0.03340622 0.20500050 0.9407154 275
## [15] {A private firm} => {Very difficult on present income} 0.017058472 0.03256168 0.52388186 0.9169332 685
## [16] {male} => {Very difficult on present income} 0.014269350 0.03054371 0.46717801 0.8601074 573
## [17] {Like me} => {Very difficult on present income} 0.011430421 0.02903226 0.39371451 0.8175451 459
## [18] {A private firm,
## male} => {Very difficult on present income} 0.007919115 0.02886710 0.27433011 0.8128944 318
## [19] {A private firm,
## Like me} => {Very difficult on present income} 0.005478633 0.02596789 0.21097719 0.7312530 220
## [20] {female,
## Wages or salaries} => {Very difficult on present income} 0.006126108 0.02014742 0.30406415 0.5673491 246
## [21] {A private firm,
## Wages or salaries} => {Very difficult on present income} 0.006474748 0.01895873 0.34151808 0.5338757 260
## [22] {Wages or salaries} => {Very difficult on present income} 0.010434306 0.01812989 0.57553043 0.5105358 419
With the selected support level of 0.5% and confidence level of 1%,
22 rules were identified. From these rules we can observe only one
country - Greece (GR). There is an 8.7% confidence that respondents from
Greece report “very difficult on present income.” The
support value of 0.6% indicates that “very difficult on present income”
is a rare event globally. However, the lift value shows that this
condition is more than twice as likely to occur in Greece.
By lowering the support and confidence thresholds, we could observe a broader picture of income perceptions across countries. However, since we aimed to maintain high support and confidence values, the generated rules provide a focused “slice” of data, highlighting clear differences between countries. This research allowed us to identify which countries tend to feel financially comfortable or insecure and the social and economic patterns influencing these perceptions. For a more comprehensive analysis, incorporating other economic indicators would be necessary to turn assumptions into actual findings.