library(dplyr)
library(arules)
library(arulesViz)

#load the dataset
data<-read.csv("ESS11.csv")

#examine dataset
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]

Inspection of hincfel variable

#inspect hincfel variable
str(data$hincfel)
##  int [1:40156] 1 2 1 2 2 1 2 1 2 2 ...
summary(data$hincfel)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   1.000   1.000   2.000   1.921   2.000   9.000
table(data$hincfel)
## 
##     1     2     3     4     7     8     9 
## 14309 18108  5862  1426   299   133    19
association_variables <- c("hincfel", "gndr","cntry", "freehms",  "stfeco", "stfedu", "prtdgcl","pbldmna","donprty","trstprt")
reduced_data<- data[association_variables]

#conversion of variables into factor type
reduced_data <- reduced_data %>% mutate_if(is.numeric, as.factor)
str(reduced_data)
## 'data.frame':    40156 obs. of  10 variables:
##  $ hincfel: Factor w/ 7 levels "1","2","3","4",..: 1 2 1 2 2 1 2 1 2 2 ...
##  $ gndr   : Factor w/ 2 levels "1","2": 1 2 2 2 1 2 2 2 2 2 ...
##  $ cntry  : chr  "AT" "AT" "AT" "AT" ...
##  $ freehms: Factor w/ 8 levels "1","2","3","4",..: 2 1 1 2 2 2 2 1 2 2 ...
##  $ stfeco : Factor w/ 14 levels "0","1","2","3",..: 7 3 7 5 7 5 7 7 7 8 ...
##  $ stfedu : Factor w/ 14 levels "0","1","2","3",..: 9 11 6 6 10 4 13 7 10 9 ...
##  $ prtdgcl: Factor w/ 8 levels "1","2","3","4",..: 2 2 2 5 2 5 2 2 5 5 ...
##  $ pbldmna: Factor w/ 5 levels "1","2","7","8",..: 2 1 1 2 2 2 2 1 2 2 ...
##  $ donprty: Factor w/ 5 levels "1","2","7","8",..: 2 2 1 2 2 2 2 2 2 2 ...
##  $ trstprt: Factor w/ 14 levels "0","1","2","3",..: 6 1 5 4 6 6 6 7 3 9 ...
summary(reduced_data)
##  hincfel   gndr         cntry              freehms          stfeco    
##  1:14309   1:18760   Length:40156       1      :16407   5      :6477  
##  2:18108   2:21396   Class :character   2      :13826   6      :5449  
##  3: 5862             Mode  :character   3      : 4768   3      :5167  
##  4: 1426                                4      : 2489   4      :5108  
##  7:  299                                5      : 1905   7      :4899  
##  8:  133                                8      :  506   2      :3683  
##  9:   19                                (Other):  255   (Other):9373  
##      stfedu        prtdgcl      pbldmna   donprty      trstprt    
##  7      :6211   6      :22766   1: 3296   1: 2448   5      :6710  
##  5      :5892   2      : 9984   2:36722   2:37546   0      :5689  
##  6      :5272   3      : 3067   7:   63   7:   75   3      :5151  
##  8      :4908   1      : 2278   8:   69   8:   80   2      :4642  
##  4      :4165   4      :  313   9:    6   9:    7   4      :4555  
##  3      :4062   (Other):  154                       6      :4245  
##  (Other):9646   NA's   : 1594                       (Other):9164
reduced_data <- reduced_data %>% mutate_if(is.numeric, as.factor)

#conversion of reduced data into transactions
transactions <- as(reduced_data, "transactions")

# Inspect transactions
summary(transactions)
## transactions as itemMatrix in sparse format with
##  40156 rows (elements/itemsets/transactions) and
##  101 columns (items) and a density of 0.09861688 
## 
## most frequent items:
## donprty=2 pbldmna=2 prtdgcl=6    gndr=2    gndr=1   (Other) 
##     37546     36722     22766     21396     18760    262776 
## 
## element (itemset/transaction) length distribution:
## sizes
##     9    10 
##  1594 38562 
## 
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    9.00   10.00   10.00    9.96   10.00   10.00 
## 
## includes extended item information - examples:
##      labels variables levels
## 1 hincfel=1   hincfel      1
## 2 hincfel=2   hincfel      2
## 3 hincfel=3   hincfel      3
## 
## includes extended transaction information - examples:
##   transactionID
## 1             1
## 2             2
## 3             3
inspect(head(transactions, 5))
##     items        transactionID
## [1] {hincfel=1,               
##      gndr=1,                  
##      cntry=AT,                
##      freehms=2,               
##      stfeco=6,                
##      stfedu=8,                
##      prtdgcl=2,               
##      pbldmna=2,               
##      donprty=2,               
##      trstprt=5}              1
## [2] {hincfel=2,               
##      gndr=2,                  
##      cntry=AT,                
##      freehms=1,               
##      stfeco=2,                
##      stfedu=10,               
##      prtdgcl=2,               
##      pbldmna=1,               
##      donprty=2,               
##      trstprt=0}              2
## [3] {hincfel=1,               
##      gndr=2,                  
##      cntry=AT,                
##      freehms=1,               
##      stfeco=6,                
##      stfedu=5,                
##      prtdgcl=2,               
##      pbldmna=1,               
##      donprty=1,               
##      trstprt=4}              3
## [4] {hincfel=2,               
##      gndr=2,                  
##      cntry=AT,                
##      freehms=2,               
##      stfeco=4,                
##      stfedu=5,                
##      prtdgcl=6,               
##      pbldmna=2,               
##      donprty=2,               
##      trstprt=3}              4
## [5] {hincfel=2,               
##      gndr=1,                  
##      cntry=AT,                
##      freehms=2,               
##      stfeco=6,                
##      stfedu=9,                
##      prtdgcl=2,               
##      pbldmna=2,               
##      donprty=2,               
##      trstprt=5}              5

Sample Image

Image represents a visualization of sampled transactions from the reduced dataset. Rows correspond to observations while columns represent to the factors in the dataset such as hincfel, gndr, cntry.Items with continuous vertical patterns are highly frequent across many transactions. For example, hincfel categories 1 and 2 might dominate the transactions since they are more frequent than others.

image(sample(transactions, 50))

Apriori Algorithm

supp = 0.01: Only rules supported by at least 1% of the transactions are considered. It is used to ensure that rare patterns are excluded from the results.

conf = 0.6: Rules must be correct at least 60% of the time to be included. 0.6 could be considered as a high confidence level which ensures strong associations.

minlen = 2: Each rule must include at least two items.

appearance Argument: Specifies that the rules must include one of the hincfel categories 1, 2, 3, 4, 7, 8, 9 as these are the options for hincfel variable.

Focuses the analysis on how these categories are influenced by other variables.

control = list(verbose = FALSE): Suppresses detailed output during processing.

#Apriori algorithm is applied to find association with hincfel variable with selected columns
rules <- apriori(transactions, 
                 parameter = list(supp = 0.01, conf = 0.6, minlen = 2),
                 appearance = list(rhs = c("hincfel=1", "hincfel=2", "hincfel=3", "hincfel=4", "hincfel=7", "hincfel=8", "hincfel=9")),
                 control = list(verbose = FALSE))

rules_sorted <- sort(rules, by = "confidence", decreasing = TRUE)
inspect(head(rules_sorted, 10))
##      lhs             rhs            support confidence   coverage     lift count
## [1]  {gndr=1,                                                                   
##       cntry=NL,                                                                 
##       freehms=1,                                                                
##       pbldmna=2}  => {hincfel=1} 0.01003586  0.7647059 0.01312382 2.146029   403
## [2]  {gndr=1,                                                                   
##       cntry=NL,                                                                 
##       freehms=1}  => {hincfel=1} 0.01038450  0.7623400 0.01362187 2.139390   417
## [3]  {cntry=PL,                                                                 
##       prtdgcl=6,                                                                
##       pbldmna=2,                                                                
##       donprty=2}  => {hincfel=2} 0.01534017  0.7255595 0.02114254 1.608989   616
## [4]  {cntry=PL,                                                                 
##       prtdgcl=6,                                                                
##       pbldmna=2}  => {hincfel=2} 0.01576352  0.7250859 0.02174021 1.607938   633
## [5]  {cntry=PL,                                                                 
##       freehms=2,                                                                
##       pbldmna=2,                                                                
##       donprty=2}  => {hincfel=2} 0.01003586  0.7235189 0.01387090 1.604463   403
## [6]  {cntry=PL,                                                                 
##       freehms=2,                                                                
##       pbldmna=2}  => {hincfel=2} 0.01038450  0.7227036 0.01436896 1.602656   417
## [7]  {cntry=PL,                                                                 
##       prtdgcl=6,                                                                
##       donprty=2}  => {hincfel=2} 0.01556430  0.7175660 0.02169041 1.591262   625
## [8]  {cntry=PL,                                                                 
##       prtdgcl=6}  => {hincfel=2} 0.01611216  0.7165006 0.02248730 1.588900   647
## [9]  {gndr=1,                                                                   
##       cntry=PL,                                                                 
##       pbldmna=2,                                                                
##       donprty=2}  => {hincfel=2} 0.01075804  0.7164179 0.01501644 1.588716   432
## [10] {gndr=1,                                                                   
##       cntry=PL,                                                                 
##       pbldmna=2}  => {hincfel=2} 0.01120630  0.7142857 0.01568881 1.583988   450
rules_sorted_lift <- sort(rules, by = "lift", decreasing = TRUE)
inspect(head(rules_sorted_lift, 10))
##      lhs                                         rhs         support   
## [1]  {gndr=1, cntry=NL, freehms=1, pbldmna=2} => {hincfel=1} 0.01003586
## [2]  {gndr=1, cntry=NL, freehms=1}            => {hincfel=1} 0.01038450
## [3]  {gndr=1, cntry=NL, pbldmna=2}            => {hincfel=1} 0.01426935
## [4]  {cntry=SE, freehms=1, pbldmna=2}         => {hincfel=1} 0.01374639
## [5]  {gndr=1, cntry=NL}                       => {hincfel=1} 0.01471760
## [6]  {cntry=NL, freehms=1, pbldmna=2}         => {hincfel=1} 0.01949895
## [7]  {cntry=SE, freehms=1}                    => {hincfel=1} 0.01484212
## [8]  {gndr=1, cntry=NL, pbldmna=2, donprty=2} => {hincfel=1} 0.01277518
## [9]  {cntry=NL, freehms=1}                    => {hincfel=1} 0.02007172
## [10] {gndr=1, cntry=NL, donprty=2}            => {hincfel=1} 0.01304911
##      confidence coverage   lift     count
## [1]  0.7647059  0.01312382 2.146029 403  
## [2]  0.7623400  0.01362187 2.139390 417  
## [3]  0.7047970  0.02024604 1.977904 573  
## [4]  0.7031847  0.01954876 1.973379 552  
## [5]  0.7010676  0.02099313 1.967438 591  
## [6]  0.7003578  0.02784142 1.965446 783  
## [7]  0.7003525  0.02119235 1.965431 596  
## [8]  0.6970109  0.01832852 1.956053 513  
## [9]  0.6966292  0.02881263 1.954982 806  
## [10] 0.6949602  0.01877677 1.950299 524
rules_sorted_support <- sort(rules, by = "support", decreasing = TRUE)
inspect(head(rules_sorted_support, 10))
##      lhs             rhs            support confidence   coverage     lift count
## [1]  {freehms=1,                                                                
##       stfeco=7}   => {hincfel=1} 0.03309593  0.6051913 0.05468672 1.698376  1329
## [2]  {cntry=HU}   => {hincfel=2} 0.03185078  0.6038716 0.05274430 1.339136  1279
## [3]  {cntry=HU,                                                                 
##       donprty=2}  => {hincfel=2} 0.03068035  0.6036257 0.05082678 1.338590  1232
## [4]  {cntry=HU,                                                                 
##       pbldmna=2}  => {hincfel=2} 0.03058074  0.6031434 0.05070226 1.337521  1228
## [5]  {freehms=1,                                                                
##       stfeco=7,                                                                 
##       pbldmna=2}  => {hincfel=1} 0.02993326  0.6092245 0.04913338 1.709695  1202
## [6]  {cntry=HU,                                                                 
##       pbldmna=2,                                                                
##       donprty=2}  => {hincfel=2} 0.02963443  0.6028369 0.04915828 1.336841  1190
## [7]  {cntry=NL}   => {hincfel=1} 0.02749278  0.6513274 0.04221038 1.827850  1104
## [8]  {freehms=1,                                                                
##       stfeco=7,                                                                 
##       pbldmna=2,                                                                
##       donprty=2}  => {hincfel=1} 0.02724375  0.6040861 0.04509911 1.695275  1094
## [9]  {cntry=NL,                                                                 
##       pbldmna=2}  => {hincfel=1} 0.02674569  0.6548780 0.04084072 1.837814  1074
## [10] {cntry=PL}   => {hincfel=2} 0.02520171  0.7018031 0.03590995 1.556307  1012

Visualizations

This graph represents the relationships between items (variables and categories) in the association rules generated by the Apriori algorithm.

Nodes: Represent items such as hincfel, gndr. Larger nodes indicate items with higher support which means they are more frequent in the dataset.

Edges: Represent the associations or rules between items. Thicker or darker edges imply stronger relationships which means higher confidence or lift.

Clusters: Nodes are grouped into clusters based on their relationships. These clusters represent groups of items that frequently occurs together.

Color Intensity: The color of the nodes indicates the strength of the association. Darker color implies stronger association

plot(rules_sorted, method = "graph", engine = "htmlwidget")

Scatter Plot

This plot illustrates the rules in terms of their support (x-axis), confidence (y-axis), and lift (color intensity).

Most rules have support in the range of 0.01–0.03 and confidence between 0.6–0.76. Rules with higher lift are shaded darker, indicating stronger associations. Few rules stand out with very high confidence (~0.76) but lower support, suggesting these rules are reliable but not common.

plot(rules_sorted, measure = c("support", "confidence"), shading = "lift", engine = "plotly")

Parallel Coordinates Plot

This plot shows how the LHS and RHS are connected across multiple rules.

The overlapping red lines indicate common patterns where antecedents contribute to multiple hincfel outcomes.

The far-right axis (rhs) represents the target variable hincfel.Each line represents a rule.The path shows how items on the left axes connect to a specific hincfel category on the rhs.Darker red lines indicate stronger rules like higher confidence or lift. Lighter colored lines represent weaker rules. Thicker lines suggest rules with higher support.

Most of the strong rules (dark red lines) end at hincfel=1 or hincfel=2. Moreover, variables like stfeco=7, stfedu=7, cntry=NL, and freehms=2 frequently appear, which means they are strongly associated with specific hincfel categories. On the other hand, certain antecedents are commonly grouped together to predict specific outcomes. For example, combinations of stfeco=7, prtdgcl=2, and donprty=1 frequently lead to hincfel=1.

plot(rules_sorted, method = "paracoord", control = list(reorder = TRUE))

Grouped Matrix Plot

This plot groups rules based on their antecedents and shows their relationships to consequents.

The size of the circles represents support, while the color represents lift. Strong rules with high lift and support are observed for hincfel=1 and hincfel=2.

Most rules are associated with hincfel=1, as indicated by the more frequent and larger circles in the first row. This aligns with hincfel=1 being one of the most frequent categories in the dataset. Fewer and smaller circles are observed for hincfel=2, reflecting lower support for rules leading to this category.

Variables like satisfaction with the economy (stfeco=7) and satisfaction with education (stfedu=7) are key factors driving positive perceptions of household income (hincfel=1). Furthermore, groups like {stfeco=7, stfedu=7} frequently influence hincfel=1.

plot(rules_sorted, method = "grouped", control = list(k = 15))

Matrix Plot

plot(rules_sorted, method = "matrix", control = list(reorder = "none"))
## Itemsets in Antecedent (LHS)
##   [1] "{gndr=1,cntry=NL,freehms=1,pbldmna=2}"             
##   [2] "{gndr=1,cntry=NL,freehms=1}"                       
##   [3] "{cntry=PL,prtdgcl=6,pbldmna=2,donprty=2}"          
##   [4] "{cntry=PL,prtdgcl=6,pbldmna=2}"                    
##   [5] "{cntry=PL,freehms=2,pbldmna=2,donprty=2}"          
##   [6] "{cntry=PL,freehms=2,pbldmna=2}"                    
##   [7] "{cntry=PL,prtdgcl=6,donprty=2}"                    
##   [8] "{cntry=PL,prtdgcl=6}"                              
##   [9] "{gndr=1,cntry=PL,pbldmna=2,donprty=2}"             
##  [10] "{gndr=1,cntry=PL,pbldmna=2}"                       
##  [11] "{cntry=PL,freehms=2}"                              
##  [12] "{cntry=PL,freehms=2,donprty=2}"                    
##  [13] "{cntry=PL,pbldmna=2,donprty=2}"                    
##  [14] "{cntry=PL,pbldmna=2}"                              
##  [15] "{gndr=2,cntry=PL,pbldmna=2}"                       
##  [16] "{gndr=2,cntry=PL,pbldmna=2,donprty=2}"             
##  [17] "{gndr=1,cntry=PL,donprty=2}"                       
##  [18] "{gndr=1,cntry=NL,pbldmna=2}"                       
##  [19] "{gndr=1,cntry=PL}"                                 
##  [20] "{cntry=PL,donprty=2}"                              
##  [21] "{cntry=SE,freehms=1,pbldmna=2}"                    
##  [22] "{cntry=PL}"                                        
##  [23] "{gndr=1,cntry=NL}"                                 
##  [24] "{cntry=NL,freehms=1,pbldmna=2}"                    
##  [25] "{cntry=SE,freehms=1}"                              
##  [26] "{gndr=2,cntry=PL}"                                 
##  [27] "{gndr=2,cntry=PL,donprty=2}"                       
##  [28] "{gndr=1,cntry=NL,pbldmna=2,donprty=2}"             
##  [29] "{cntry=NL,freehms=1}"                              
##  [30] "{gndr=1,cntry=NL,donprty=2}"                       
##  [31] "{cntry=NL,freehms=1,pbldmna=2,donprty=2}"          
##  [32] "{cntry=SE,freehms=1,donprty=2}"                    
##  [33] "{cntry=SE,freehms=1,pbldmna=2,donprty=2}"          
##  [34] "{cntry=NL,freehms=1,donprty=2}"                    
##  [35] "{gndr=1,cntry=SE}"                                 
##  [36] "{cntry=NL,prtdgcl=2,pbldmna=2}"                    
##  [37] "{cntry=NL,prtdgcl=2}"                              
##  [38] "{gndr=1,cntry=SE,pbldmna=2}"                       
##  [39] "{gndr=1,freehms=1,pbldmna=2,trstprt=7}"            
##  [40] "{cntry=SE,pbldmna=2}"                              
##  [41] "{cntry=SE}"                                        
##  [42] "{gndr=1,freehms=1,stfeco=8,pbldmna=2}"             
##  [43] "{gndr=1,freehms=1,trstprt=7}"                      
##  [44] "{cntry=SE,donprty=2}"                              
##  [45] "{cntry=SE,pbldmna=2,donprty=2}"                    
##  [46] "{gndr=1,freehms=1,stfeco=8}"                       
##  [47] "{cntry=NL,pbldmna=2}"                              
##  [48] "{gndr=1,freehms=1,stfeco=7,pbldmna=2}"             
##  [49] "{cntry=IS,pbldmna=2}"                              
##  [50] "{cntry=NL}"                                        
##  [51] "{gndr=1,freehms=1,stfeco=7,pbldmna=2,donprty=2}"   
##  [52] "{freehms=1,prtdgcl=2,trstprt=7}"                   
##  [53] "{gndr=1,freehms=1,stfeco=7}"                       
##  [54] "{cntry=NL,pbldmna=2,donprty=2}"                    
##  [55] "{cntry=NL,donprty=2}"                              
##  [56] "{gndr=1,freehms=1,pbldmna=2,trstprt=6}"            
##  [57] "{gndr=1,freehms=1,stfeco=7,donprty=2}"             
##  [58] "{cntry=AT,freehms=2,prtdgcl=6,pbldmna=2,donprty=2}"
##  [59] "{cntry=AT,freehms=2,prtdgcl=6,donprty=2}"          
##  [60] "{freehms=1,stfeco=7,prtdgcl=2,pbldmna=2}"          
##  [61] "{freehms=1,stfeco=8,pbldmna=2}"                    
##  [62] "{cntry=AT,freehms=2,prtdgcl=6,pbldmna=2}"          
##  [63] "{cntry=AT,freehms=2,prtdgcl=6}"                    
##  [64] "{gndr=1,freehms=1,pbldmna=2,donprty=2,trstprt=6}"  
##  [65] "{freehms=1,stfeco=7,prtdgcl=2}"                    
##  [66] "{gndr=1,freehms=1,trstprt=6}"                      
##  [67] "{cntry=IS}"                                        
##  [68] "{freehms=1,pbldmna=2,donprty=1}"                   
##  [69] "{cntry=NL,prtdgcl=6,pbldmna=2,donprty=2}"          
##  [70] "{gndr=2,cntry=HU,prtdgcl=6,pbldmna=2,donprty=2}"   
##  [71] "{freehms=1,stfeco=8}"                              
##  [72] "{freehms=1,stfeco=8,pbldmna=2,donprty=2}"          
##  [73] "{cntry=NL,prtdgcl=6,pbldmna=2}"                    
##  [74] "{gndr=2,cntry=HU,prtdgcl=6,pbldmna=2}"             
##  [75] "{gndr=2,cntry=HU,prtdgcl=6,donprty=2}"             
##  [76] "{gndr=1,freehms=1,donprty=1}"                      
##  [77] "{cntry=IS,donprty=2}"                              
##  [78] "{cntry=NL,prtdgcl=6,donprty=2}"                    
##  [79] "{gndr=2,cntry=HU,prtdgcl=6}"                       
##  [80] "{gndr=1,freehms=1,donprty=2,trstprt=6}"            
##  [81] "{freehms=1,pbldmna=2,trstprt=7}"                   
##  [82] "{freehms=1,stfeco=8,donprty=2}"                    
##  [83] "{cntry=NL,prtdgcl=6}"                              
##  [84] "{freehms=1,trstprt=7}"                             
##  [85] "{cntry=HU,prtdgcl=6,pbldmna=2,donprty=2}"          
##  [86] "{freehms=1,prtdgcl=2,pbldmna=2,trstprt=6}"         
##  [87] "{cntry=HU,prtdgcl=6,pbldmna=2}"                    
##  [88] "{cntry=HU,prtdgcl=6,donprty=2}"                    
##  [89] "{gndr=2,cntry=HU,pbldmna=2,donprty=2}"             
##  [90] "{gndr=2,cntry=HU,pbldmna=2}"                       
##  [91] "{gndr=2,cntry=HU,donprty=2}"                       
##  [92] "{cntry=HU,prtdgcl=6}"                              
##  [93] "{gndr=2,cntry=HU}"                                 
##  [94] "{freehms=1,prtdgcl=2,trstprt=6}"                   
##  [95] "{freehms=1,stfeco=7,pbldmna=2}"                    
##  [96] "{freehms=1,pbldmna=2,donprty=2,trstprt=7}"         
##  [97] "{gndr=2,cntry=NL,pbldmna=2}"                       
##  [98] "{freehms=1,stfedu=7,prtdgcl=2,pbldmna=2}"          
##  [99] "{freehms=1,stfeco=7}"                              
## [100] "{gndr=1,freehms=1,stfedu=7,pbldmna=2}"             
## [101] "{freehms=1,stfeco=7,pbldmna=2,donprty=2}"          
## [102] "{cntry=HU}"                                        
## [103] "{cntry=HU,donprty=2}"                              
## [104] "{cntry=HU,pbldmna=2}"                              
## [105] "{cntry=HU,pbldmna=2,donprty=2}"                    
## [106] "{gndr=2,cntry=NL}"                                 
## [107] "{gndr=1,freehms=1,stfedu=7}"                       
## [108] "{cntry=AT,freehms=2,pbldmna=2,donprty=2}"          
## [109] "{prtdgcl=2,pbldmna=2,donprty=1}"                   
## Itemsets in Consequent (RHS)
## [1] "{hincfel=2}" "{hincfel=1}"

This matrix visualization provides a heatmap-style representation of association rules, highlighting the relationships between the left hand side and right hand side of the rules.

Rows: Each row represents a category of the target variable as hincfel=1, hincfel=2.

Columns: Each column represents a unique set of antecedents (conditions) on the LHS of the rules. Darker columns indicate strong associations with high lift.

Color Intensity: The color represents the lift of the rule, where dark red implies higher lift (stronger association) and light red means lower lift (weaker association).

The darkest red sections in the first row indicate the strongest rules for hincfel=1.Although hincfel=2 also shows strong associations, they are generally less frequent compared to hincfel=1