The Groceries Dataset is a real-world dataset containing 9835 transactions from a retail store. Each transaction contains a list of items purchased by a customer. The goal of this analysis is to find frequent itemsets and association rules from the dataset using the Apriori algorithm. The dataset was taken from Kaggle which can be accessed through: https://www.kaggle.com/heeraldedhia/groceries-dataset
library(readxl)
library(readr)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(arules)
## Loading required package: Matrix
##
## Attaching package: 'arules'
## The following object is masked from 'package:dplyr':
##
## recode
## The following objects are masked from 'package:base':
##
## abbreviate, write
library(naniar)
library(arulesViz)
library(arulesCBA)
library(tidyr)
##
## Attaching package: 'tidyr'
## The following objects are masked from 'package:Matrix':
##
## expand, pack, unpack
library(dplyr)
library(plyr)
## ------------------------------------------------------------------------------
## You have loaded plyr after dplyr - this is likely to cause problems.
## If you need functions from both plyr and dplyr, please load plyr first, then dplyr:
## library(plyr); library(dplyr)
## ------------------------------------------------------------------------------
##
## Attaching package: 'plyr'
## The following objects are masked from 'package:dplyr':
##
## arrange, count, desc, failwith, id, mutate, rename, summarise,
## summarize
library(plotly)
## Loading required package: ggplot2
##
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following objects are masked from 'package:plyr':
##
## arrange, mutate, rename, summarise
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
groceries <- read_csv("groceries.csv")
## Rows: 38765 Columns: 3
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (2): Date, itemDescription
## dbl (1): Member_number
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
head(groceries)
## # A tibble: 6 × 3
## Member_number Date itemDescription
## <dbl> <chr> <chr>
## 1 1808 21-07-2015 tropical fruit
## 2 2552 05-01-2015 whole milk
## 3 2300 19-09-2015 pip fruit
## 4 1187 12-12-2015 other vegetables
## 5 3037 01-02-2015 whole milk
## 6 4941 14-02-2015 rolls/buns
dim(groceries)
## [1] 38765 3
The output of the summary shows that there are 9835 transactions and 169 unique items in the dataset.
The dataset is not a transaction data, therefore, we should transform it to transaction data so we can perform Association Rules Analysis afterward.
groceries$Date <- as.Date(groceries$Date, "%d-%m-%Y")
groceries$Member_number <- as.numeric(groceries$Member_number)
groceries$itemDescription <- as.factor(groceries$itemDescription)
class(groceries$Date)
## [1] "Date"
str(groceries)
## spc_tbl_ [38,765 × 3] (S3: spec_tbl_df/tbl_df/tbl/data.frame)
## $ Member_number : num [1:38765] 1808 2552 2300 1187 3037 ...
## $ Date : Date[1:38765], format: "2015-07-21" "2015-01-05" ...
## $ itemDescription: Factor w/ 167 levels "abrasive cleaner",..: 156 165 109 102 165 122 102 112 165 156 ...
## - attr(*, "spec")=
## .. cols(
## .. Member_number = col_double(),
## .. Date = col_character(),
## .. itemDescription = col_character()
## .. )
## - attr(*, "problems")=<externalptr>
transactionData <- ddply(groceries,c("Member_number","Date"),
function(df1)paste(df1$itemDescription,
collapse = ","))
head(transactionData,15)
## Member_number Date V1
## 1 1000 2014-06-24 whole milk,pastry,salty snack
## 2 1000 2015-03-15 sausage,whole milk,semi-finished bread,yogurt
## 3 1000 2015-05-27 soda,pickled vegetables
## 4 1000 2015-07-24 canned beer,misc. beverages
## 5 1000 2015-11-25 sausage,hygiene articles
## 6 1001 2014-02-07 sausage,whole milk,rolls/buns
## 7 1001 2014-12-12 whole milk,soda
## 8 1001 2015-01-20 frankfurter,soda,whipped/sour cream
## 9 1001 2015-04-14 beef,white bread
## 10 1001 2015-05-02 frankfurter,curd
## 11 1002 2014-02-09 frozen vegetables,other vegetables
## 12 1002 2014-04-26 butter,whole milk
## 13 1002 2015-04-26 tropical fruit,sugar
## 14 1002 2015-08-30 butter milk,specialty chocolate
## 15 1003 2014-01-19 frozen meals,dental care
#set column InvoiceNo of dataframe transactionData
transactionData$Member_number <- NULL
#set column Date of dataframe transactionData
transactionData$Date <- NULL
#Rename column to items
colnames(transactionData) <- c("items")
#Show Dataframe transactionData
summary(transactionData)
## items
## Length:14963
## Class :character
## Mode :character
write.csv(transactionData,"market_basket_transactions.csv", quote = FALSE, row.names = FALSE)
#transactionData: Data to be written
#"D:/Documents/market_basket.csv": location of file with file name to be written to
#quote: If TRUE it will surround character or factor column with double quotes. If FALSE nothing will be quoted
#row.names: either a logical value indicating whether the row names of x are to be written along with x, or a character vector of row names to be written.
trans <- read.transactions('market_basket_transactions.csv', rm.duplicates= TRUE, format = 'basket', sep=',')
## distribution of transactions with duplicates:
## items
## 1 2 3 4
## 662 39 5 1
trans
## transactions in sparse format with
## 14964 transactions (rows) and
## 168 items (columns)
summary(trans)
## transactions as itemMatrix in sparse format with
## 14964 rows (elements/itemsets/transactions) and
## 168 columns (items) and a density of 0.01511843
##
## most frequent items:
## whole milk other vegetables rolls/buns soda
## 2363 1827 1646 1453
## yogurt (Other)
## 1285 29433
##
## element (itemset/transaction) length distribution:
## sizes
## 1 2 3 4 5 6 7 8 9 10
## 206 10012 2727 1273 338 179 113 96 19 1
##
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 1.00 2.00 2.00 2.54 3.00 10.00
##
## includes extended item information - examples:
## labels
## 1 abrasive cleaner
## 2 artif. sweetener
## 3 baby cosmetics
trans@itemInfo$labels <- gsub("\"","",trans@itemInfo$labels)
# Create an item frequency plot for the top 20 items
if (!require("RColorBrewer")) {
# install color package of R
install.packages("RColorBrewer")
#include library RColorBrewer
library(RColorBrewer)
}
## Loading required package: RColorBrewer
itemFrequencyPlot(trans,topN=25,type="absolute",col=brewer.pal(8,'Pastel2'), main="Absolute Item Frequency Plot")
itemFrequencyPlot(trans,topN=25,type="relative",col=brewer.pal(8,'Pastel2'),main="Relative Item Frequency Plot")
From the item frequency plot, we can see that the top 10 most frequently
purchased items are: whole milk, rolls/buns, soda, yogurt, bottled
water, root vegetables, tropical fruit, shopping bags, sausage and
citrus fruit. We don’t count other vegetables here because it consists
of many kind of vegetables.
Next step is to mine the rules using the APRIORI algorithm. The function apriori() is from package arules.
rules <- apriori(trans, parameter = list(minlen=2, sup = 0.001, conf = 0.05, target="rules"))
## Apriori
##
## Parameter specification:
## confidence minval smax arem aval originalSupport maxtime support minlen
## 0.05 0.1 1 none FALSE TRUE 5 0.001 2
## maxlen target ext
## 10 rules TRUE
##
## Algorithmic control:
## filter tree heap memopt load sort verbose
## 0.1 TRUE TRUE FALSE TRUE 2 TRUE
##
## Absolute minimum support count: 14
##
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[168 item(s), 14964 transaction(s)] done [0.01s].
## sorting and recoding items ... [149 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 3 4 done [0.00s].
## writing ... [450 rule(s)] done [0.00s].
## creating S4 object ... done [0.00s].
We have set the support threshold to 0.001 and confidence threshold to 0.05. This means that we are only interested in itemsets that appear in at least 0.1% of all transactions and rules that have a confidence of at least 5%.
inspect(rules[1:20])
## lhs rhs support confidence
## [1] {frozen fish} => {whole milk} 0.001069233 0.1568627
## [2] {seasonal products} => {rolls/buns} 0.001002406 0.1415094
## [3] {pot plants} => {other vegetables} 0.001002406 0.1282051
## [4] {pot plants} => {whole milk} 0.001002406 0.1282051
## [5] {pasta} => {whole milk} 0.001069233 0.1322314
## [6] {pickled vegetables} => {whole milk} 0.001002406 0.1119403
## [7] {packaged fruit/vegetables} => {rolls/buns} 0.001202887 0.1417323
## [8] {detergent} => {yogurt} 0.001069233 0.1240310
## [9] {detergent} => {rolls/buns} 0.001002406 0.1162791
## [10] {detergent} => {whole milk} 0.001403368 0.1627907
## [11] {semi-finished bread} => {other vegetables} 0.001002406 0.1056338
## [12] {semi-finished bread} => {whole milk} 0.001670676 0.1760563
## [13] {red/blush wine} => {rolls/buns} 0.001336541 0.1273885
## [14] {red/blush wine} => {other vegetables} 0.001136060 0.1082803
## [15] {flour} => {tropical fruit} 0.001069233 0.1095890
## [16] {flour} => {whole milk} 0.001336541 0.1369863
## [17] {herbs} => {yogurt} 0.001136060 0.1075949
## [18] {herbs} => {whole milk} 0.001136060 0.1075949
## [19] {processed cheese} => {root vegetables} 0.001069233 0.1052632
## [20] {processed cheese} => {rolls/buns} 0.001470195 0.1447368
## coverage lift count
## [1] 0.006816359 0.9933534 16
## [2] 0.007083667 1.2864807 15
## [3] 0.007818765 1.0500611 15
## [4] 0.007818765 0.8118754 15
## [5] 0.008086073 0.8373723 16
## [6] 0.008954825 0.7088763 15
## [7] 0.008487036 1.2885066 18
## [8] 0.008620690 1.4443580 16
## [9] 0.008620690 1.0571081 15
## [10] 0.008620690 1.0308929 21
## [11] 0.009489441 0.8651911 15
## [12] 0.009489441 1.1148993 25
## [13] 0.010491847 1.1581057 20
## [14] 0.010491847 0.8868668 17
## [15] 0.009756750 1.6172489 16
## [16] 0.009756750 0.8674833 20
## [17] 0.010558674 1.2529577 17
## [18] 0.010558674 0.6813587 17
## [19] 0.010157712 1.5131200 16
## [20] 0.010157712 1.3158214 22
# Find association rules
associationRules <- as.data.frame(inspect(sort(rules, by = "lift")))
## lhs rhs support
## [1] {whole milk, yogurt} => {sausage} 0.001470195
## [2] {sausage, whole milk} => {yogurt} 0.001470195
## [3] {specialty chocolate} => {citrus fruit} 0.001403368
## [4] {sausage, yogurt} => {whole milk} 0.001470195
## [5] {flour} => {tropical fruit} 0.001069233
## [6] {beverages} => {sausage} 0.001537022
## [7] {soda, whole milk} => {sausage} 0.001069233
## [8] {napkins} => {pastry} 0.001737503
## [9] {processed cheese} => {root vegetables} 0.001069233
## [10] {hard cheese} => {pip fruit} 0.001069233
## [11] {soft cheese} => {yogurt} 0.001269714
## [12] {curd} => {sausage} 0.002940390
## [13] {detergent} => {yogurt} 0.001069233
## [14] {sugar} => {bottled water} 0.001470195
## [15] {white bread} => {canned beer} 0.001537022
## [16] {brown bread} => {canned beer} 0.002405774
## [17] {canned beer} => {brown bread} 0.002405774
## [18] {chewing gum} => {yogurt} 0.001403368
## [19] {rolls/buns, whole milk} => {sausage} 0.001136060
## [20] {rolls/buns, sausage} => {whole milk} 0.001136060
## [21] {sliced cheese} => {sausage} 0.001136060
## [22] {processed cheese} => {rolls/buns} 0.001470195
## [23] {candy} => {citrus fruit} 0.001002406
## [24] {packaged fruit/vegetables} => {rolls/buns} 0.001202887
## [25] {seasonal products} => {rolls/buns} 0.001002406
## [26] {frozen meals} => {sausage} 0.001269714
## [27] {herbs} => {yogurt} 0.001136060
## [28] {cat food} => {tropical fruit} 0.001002406
## [29] {oil} => {soda} 0.001804330
## [30] {specialty chocolate} => {tropical fruit} 0.001336541
## [31] {sliced cheese} => {root vegetables} 0.001202887
## [32] {sausage, whole milk} => {soda} 0.001069233
## [33] {grapes} => {sausage} 0.001069233
## [34] {frozen vegetables} => {sausage} 0.002071639
## [35] {sausage} => {bottled beer} 0.003341353
## [36] {bottled beer} => {sausage} 0.003341353
## [37] {onions} => {whipped/sour cream} 0.001069233
## [38] {butter milk} => {shopping bags} 0.001002406
## [39] {napkins} => {citrus fruit} 0.001403368
## [40] {beverages} => {soda} 0.001871157
## [41] {red/blush wine} => {rolls/buns} 0.001336541
## [42] {chocolate} => {pip fruit} 0.001336541
## [43] {sausage, whole milk} => {rolls/buns} 0.001136060
## [44] {rolls/buns, soda} => {other vegetables} 0.001136060
## [45] {meat} => {root vegetables} 0.001336541
## [46] {sausage, soda} => {whole milk} 0.001069233
## [47] {salty snack} => {canned beer} 0.001002406
## [48] {misc. beverages} => {sausage} 0.001069233
## [49] {frankfurter} => {other vegetables} 0.005145683
## [50] {semi-finished bread} => {whole milk} 0.001670676
## [51] {rolls/buns, whole milk} => {yogurt} 0.001336541
## [52] {sausage} => {yogurt} 0.005747126
## [53] {yogurt} => {sausage} 0.005747126
## [54] {other vegetables, rolls/buns} => {soda} 0.001136060
## [55] {frozen vegetables} => {bottled beer} 0.001403368
## [56] {frozen vegetables} => {root vegetables} 0.002138466
## [57] {whole milk, yogurt} => {rolls/buns} 0.001336541
## [58] {rolls/buns, yogurt} => {whole milk} 0.001336541
## [59] {chocolate} => {rolls/buns} 0.002806736
## [60] {frozen vegetables} => {citrus fruit} 0.001603849
## [61] {dessert} => {shopping bags} 0.001202887
## [62] {cream cheese} => {shopping bags} 0.001202887
## [63] {other vegetables, soda} => {rolls/buns} 0.001136060
## [64] {grapes} => {root vegetables} 0.001069233
## [65] {beverages} => {bottled water} 0.001069233
## [66] {berries} => {pip fruit} 0.001136060
## [67] {UHT-milk} => {tropical fruit} 0.001537022
## [68] {detergent} => {rolls/buns} 0.001002406
## [69] {hygiene articles} => {root vegetables} 0.001002406
## [70] {pot plants} => {other vegetables} 0.001002406
## [71] {frozen meals} => {other vegetables} 0.002138466
## [72] {ice cream} => {rolls/buns} 0.001737503
## [73] {meat} => {other vegetables} 0.002138466
## [74] {waffles} => {root vegetables} 0.001336541
## [75] {butter} => {citrus fruit} 0.001937984
## [76] {hard cheese} => {rolls/buns} 0.001670676
## [77] {dessert} => {sausage} 0.001470195
## [78] {detergent} => {whole milk} 0.001403368
## [79] {brown bread} => {pastry} 0.002004812
## [80] {pastry} => {sausage} 0.003207698
## [81] {sausage} => {pastry} 0.003207698
## [82] {soda} => {sausage} 0.005947608
## [83] {sausage} => {soda} 0.005947608
## [84] {ham} => {whole milk} 0.002739909
## [85] {citrus fruit} => {yogurt} 0.004611067
## [86] {yogurt} => {citrus fruit} 0.004611067
## [87] {shopping bags} => {root vegetables} 0.003341353
## [88] {hard cheese} => {yogurt} 0.001269714
## [89] {berries} => {other vegetables} 0.002673082
## [90] {specialty bar} => {yogurt} 0.001202887
## [91] {salty snack} => {sausage} 0.001136060
## [92] {grapes} => {soda} 0.001403368
## [93] {beef} => {citrus fruit} 0.001804330
## [94] {fruit/vegetable juice} => {rolls/buns} 0.003742315
## [95] {bottled beer} => {whole milk} 0.007150495
## [96] {newspapers} => {pastry} 0.002004812
## [97] {frozen fish} => {whole milk} 0.001069233
## [98] {oil} => {other vegetables} 0.001804330
## [99] {long life bakery product} => {sausage} 0.001069233
## [100] {chocolate} => {sausage} 0.001403368
## [101] {soft cheese} => {other vegetables} 0.001202887
## [102] {chocolate} => {bottled water} 0.001403368
## [103] {hard cheese} => {root vegetables} 0.001002406
## [104] {ham} => {tropical fruit} 0.001136060
## [105] {specialty bar} => {other vegetables} 0.001670676
## [106] {candy} => {yogurt} 0.001202887
## [107] {cream cheese} => {root vegetables} 0.001603849
## [108] {white bread} => {sausage} 0.001403368
## [109] {pork} => {yogurt} 0.003074044
## [110] {margarine} => {sausage} 0.001871157
## [111] {frankfurter} => {bottled water} 0.002205293
## [112] {canned beer} => {yogurt} 0.003875969
## [113] {salty snack} => {other vegetables} 0.002205293
## [114] {shopping bags} => {soda} 0.004410585
## [115] {salty snack} => {yogurt} 0.001537022
## [116] {domestic eggs} => {bottled water} 0.002138466
## [117] {onions} => {root vegetables} 0.001336541
## [118] {curd} => {bottled water} 0.001937984
## [119] {frozen meals} => {soda} 0.001537022
## [120] {candy} => {whole milk} 0.002138466
## [121] {sausage} => {whole milk} 0.008954825
## [122] {whole milk} => {sausage} 0.008954825
## [123] {newspapers} => {root vegetables} 0.002539428
## [124] {salty snack} => {rolls/buns} 0.001937984
## [125] {misc. beverages} => {yogurt} 0.001269714
## [126] {chicken} => {rolls/buns} 0.002873563
## [127] {specialty bar} => {soda} 0.001269714
## [128] {hard cheese} => {other vegetables} 0.001670676
## [129] {candy} => {rolls/buns} 0.001470195
## [130] {frozen meals} => {yogurt} 0.001336541
## [131] {fruit/vegetable juice} => {tropical fruit} 0.002138466
## [132] {bottled beer} => {bottled water} 0.002539428
## [133] {onions} => {whole milk} 0.002940390
## [134] {frozen vegetables} => {other vegetables} 0.003140871
## [135] {butter} => {soda} 0.003140871
## [136] {processed cheese} => {whole milk} 0.001470195
## [137] {pip fruit} => {rolls/buns} 0.004945202
## [138] {pastry} => {bottled water} 0.002873563
## [139] {napkins} => {yogurt} 0.001737503
## [140] {newspapers} => {whole milk} 0.005613472
## [141] {misc. beverages} => {root vegetables} 0.001002406
## [142] {butter} => {sausage} 0.001937984
## [143] {coffee} => {root vegetables} 0.002004812
## [144] {candy} => {soda} 0.001269714
## [145] {grapes} => {other vegetables} 0.001603849
## [146] {soft cheese} => {rolls/buns} 0.001002406
## [147] {shopping bags} => {rolls/buns} 0.004744721
## [148] {waffles} => {tropical fruit} 0.001136060
## [149] {specialty chocolate} => {soda} 0.001403368
## [150] {hamburger meat} => {tropical fruit} 0.001336541
## [151] {domestic eggs} => {whole milk} 0.005279337
## [152] {tropical fruit} => {yogurt} 0.005212510
## [153] {yogurt} => {tropical fruit} 0.005212510
## [154] {cat food} => {whole milk} 0.001670676
## [155] {other vegetables, whole milk} => {yogurt} 0.001136060
## [156] {waffles} => {whole milk} 0.002606255
## [157] {hamburger meat} => {whole milk} 0.003074044
## [158] {hamburger meat} => {yogurt} 0.001670676
## [159] {white bread} => {other vegetables} 0.002606255
## [160] {other vegetables, yogurt} => {whole milk} 0.001136060
## [161] {frozen vegetables} => {rolls/buns} 0.002739909
## [162] {hygiene articles} => {rolls/buns} 0.001336541
## [163] {red/blush wine} => {other vegetables} 0.001136060
## [164] {frankfurter} => {whole milk} 0.005279337
## [165] {frankfurter} => {rolls/buns} 0.003675488
## [166] {sugar} => {whole milk} 0.002472601
## [167] {long life bakery product} => {tropical fruit} 0.001069233
## [168] {UHT-milk} => {sausage} 0.001136060
## [169] {chewing gum} => {whole milk} 0.001670676
## [170] {fruit/vegetable juice} => {sausage} 0.001804330
## [171] {chocolate} => {tropical fruit} 0.001403368
## [172] {onions} => {tropical fruit} 0.001202887
## [173] {bottled beer} => {yogurt} 0.003408180
## [174] {cream cheese} => {tropical fruit} 0.001403368
## [175] {canned beer} => {sausage} 0.002472601
## [176] {beef} => {whole milk} 0.004677894
## [177] {white bread} => {bottled water} 0.001269714
## [178] {pork} => {other vegetables} 0.003942796
## [179] {flour} => {whole milk} 0.001336541
## [180] {shopping bags} => {yogurt} 0.003541834
## [181] {semi-finished bread} => {other vegetables} 0.001002406
## [182] {margarine} => {root vegetables} 0.001937984
## [183] {ham} => {yogurt} 0.001269714
## [184] {frozen vegetables} => {yogurt} 0.002071639
## [185] {frozen vegetables} => {whole milk} 0.003809142
## [186] {bottled water} => {tropical fruit} 0.003541834
## [187] {tropical fruit} => {bottled water} 0.003541834
## [188] {curd} => {other vegetables} 0.003541834
## [189] {newspapers} => {yogurt} 0.002873563
## [190] {berries} => {tropical fruit} 0.001269714
## [191] {beverages} => {other vegetables} 0.001737503
## [192] {chewing gum} => {soda} 0.001002406
## [193] {curd} => {soda} 0.002806736
## [194] {sausage} => {bottled water} 0.003140871
## [195] {bottled water} => {sausage} 0.003140871
## [196] {specialty chocolate} => {other vegetables} 0.001670676
## [197] {pip fruit} => {yogurt} 0.003608661
## [198] {pork} => {whole milk} 0.005012029
## [199] {pip fruit} => {whole milk} 0.006615878
## [200] {citrus fruit} => {whole milk} 0.007150495
## [201] {shopping bags} => {other vegetables} 0.004945202
## [202] {domestic eggs} => {tropical fruit} 0.002138466
## [203] {long life bakery product} => {whole milk} 0.002405774
## [204] {grapes} => {whole milk} 0.001937984
## [205] {shopping bags} => {tropical fruit} 0.002739909
## [206] {margarine} => {rolls/buns} 0.003007217
## [207] {long life bakery product} => {rolls/buns} 0.001670676
## [208] {napkins} => {tropical fruit} 0.001269714
## [209] {bottled beer} => {other vegetables} 0.004677894
## [210] {shopping bags} => {whole milk} 0.006348570
## [211] {butter} => {bottled water} 0.001804330
## [212] {cream cheese} => {sausage} 0.001202887
## [213] {butter milk} => {tropical fruit} 0.001002406
## [214] {butter milk} => {yogurt} 0.001269714
## [215] {butter} => {whole milk} 0.004677894
## [216] {frankfurter} => {root vegetables} 0.002205293
## [217] {hygiene articles} => {other vegetables} 0.001403368
## [218] {frankfurter} => {soda} 0.003074044
## [219] {pasta} => {whole milk} 0.001069233
## [220] {oil} => {yogurt} 0.001069233
## [221] {pork} => {rolls/buns} 0.003408180
## [222] {domestic eggs} => {rolls/buns} 0.003408180
## [223] {sugar} => {tropical fruit} 0.001002406
## [224] {hamburger meat} => {root vegetables} 0.001269714
## [225] {pork} => {soda} 0.003007217
## [226] {whipped/sour cream} => {tropical fruit} 0.002472601
## [227] {whole milk, yogurt} => {other vegetables} 0.001136060
## [228] {sliced cheese} => {soda} 0.001136060
## [229] {margarine} => {soda} 0.002606255
## [230] {meat} => {whole milk} 0.002205293
## [231] {white bread} => {whole milk} 0.003140871
## [232] {pip fruit} => {soda} 0.003942796
## [233] {yogurt} => {rolls/buns} 0.007818765
## [234] {rolls/buns} => {yogurt} 0.007818765
## [235] {bottled beer} => {tropical fruit} 0.002539428
## [236] {hamburger meat} => {other vegetables} 0.002205293
## [237] {pip fruit} => {other vegetables} 0.004945202
## [238] {UHT-milk} => {bottled water} 0.001069233
## [239] {oil} => {whole milk} 0.001937984
## [240] {bottled water} => {root vegetables} 0.003475007
## [241] {yogurt} => {whole milk} 0.011160118
## [242] {whole milk} => {yogurt} 0.011160118
## [243] {tropical fruit} => {soda} 0.005412991
## [244] {soda} => {tropical fruit} 0.005412991
## [245] {butter milk} => {soda} 0.001403368
## [246] {cat food} => {rolls/buns} 0.001069233
## [247] {fruit/vegetable juice} => {whole milk} 0.004410585
## [248] {curd} => {tropical fruit} 0.001871157
## [249] {butter milk} => {root vegetables} 0.001002406
## [250] {sliced cheese} => {other vegetables} 0.001403368
## [251] {UHT-milk} => {other vegetables} 0.002138466
## [252] {salty snack} => {root vegetables} 0.001069233
## [253] {butter} => {root vegetables} 0.002004812
## [254] {soda} => {other vegetables} 0.009689922
## [255] {other vegetables} => {soda} 0.009689922
## [256] {ice cream} => {soda} 0.001202887
## [257] {bottled water} => {soda} 0.004811548
## [258] {sausage} => {other vegetables} 0.006014435
## [259] {canned beer} => {rolls/buns} 0.004210104
## [260] {tropical fruit} => {rolls/buns} 0.006081262
## [261] {rolls/buns} => {tropical fruit} 0.006081262
## [262] {margarine} => {other vegetables} 0.003207698
## [263] {oil} => {rolls/buns} 0.001336541
## [264] {whipped/sour cream} => {root vegetables} 0.002472601
## [265] {pastry} => {yogurt} 0.003608661
## [266] {pot plants} => {whole milk} 0.001002406
## [267] {canned beer} => {whole milk} 0.006014435
## [268] {pastry} => {soda} 0.004076450
## [269] {white bread} => {rolls/buns} 0.002138466
## [270] {ice cream} => {whole milk} 0.001937984
## [271] {brown bread} => {rolls/buns} 0.003341353
## [272] {hamburger meat} => {rolls/buns} 0.001937984
## [273] {hard cheese} => {whole milk} 0.001871157
## [274] {coffee} => {soda} 0.002472601
## [275] {sausage} => {rolls/buns} 0.005346164
## [276] {bottled beer} => {rolls/buns} 0.004009623
## [277] {rolls/buns} => {whole milk} 0.013966854
## [278] {whole milk} => {rolls/buns} 0.013966854
## [279] {hygiene articles} => {soda} 0.001069233
## [280] {hygiene articles} => {whole milk} 0.001737503
## [281] {whipped/sour cream} => {soda} 0.003408180
## [282] {margarine} => {whole milk} 0.004076450
## [283] {pastry} => {tropical fruit} 0.002806736
## [284] {citrus fruit} => {rolls/buns} 0.004677894
## [285] {soda, whole milk} => {other vegetables} 0.001136060
## [286] {canned beer} => {tropical fruit} 0.002539428
## [287] {pastry} => {root vegetables} 0.002873563
## [288] {citrus fruit} => {tropical fruit} 0.002873563
## [289] {frozen meals} => {rolls/buns} 0.001470195
## [290] {sausage} => {root vegetables} 0.003341353
## [291] {pastry} => {whole milk} 0.006482224
## [292] {napkins} => {other vegetables} 0.002138466
## [293] {chocolate} => {yogurt} 0.001603849
## [294] {chicken} => {soda} 0.002138466
## [295] {cream cheese} => {yogurt} 0.001603849
## [296] {chocolate} => {whole milk} 0.002940390
## [297] {other vegetables, whole milk} => {soda} 0.001136060
## [298] {salty snack} => {tropical fruit} 0.001002406
## [299] {waffles} => {rolls/buns} 0.001603849
## [300] {hamburger meat} => {soda} 0.001670676
## [301] {brown bread} => {soda} 0.002873563
## [302] {rolls/buns} => {other vegetables} 0.010558674
## [303] {other vegetables} => {rolls/buns} 0.010558674
## [304] {curd} => {yogurt} 0.002272120
## [305] {rolls/buns, soda} => {whole milk} 0.001002406
## [306] {bottled beer} => {root vegetables} 0.002472601
## [307] {soda, whole milk} => {rolls/buns} 0.001002406
## [308] {whipped/sour cream} => {yogurt} 0.002940390
## [309] {pip fruit} => {root vegetables} 0.002673082
## [310] {frankfurter} => {yogurt} 0.002539428
## [311] {specialty bar} => {rolls/buns} 0.001202887
## [312] {domestic eggs} => {other vegetables} 0.003541834
## [313] {long life bakery product} => {yogurt} 0.001202887
## [314] {root vegetables} => {soda} 0.005279337
## [315] {soda} => {root vegetables} 0.005279337
## [316] {onions} => {rolls/buns} 0.001737503
## [317] {root vegetables} => {tropical fruit} 0.003675488
## [318] {tropical fruit} => {root vegetables} 0.003675488
## [319] {curd} => {whole milk} 0.004143277
## [320] {domestic eggs} => {root vegetables} 0.002004812
## [321] {whipped/sour cream} => {other vegetables} 0.004143277
## [322] {chicken} => {whole milk} 0.003408180
## [323] {newspapers} => {other vegetables} 0.003675488
## [324] {margarine} => {yogurt} 0.002138466
## [325] {dessert} => {rolls/buns} 0.002004812
## [326] {yogurt} => {other vegetables} 0.008086073
## [327] {other vegetables} => {yogurt} 0.008086073
## [328] {misc. beverages} => {rolls/buns} 0.001336541
## [329] {salty snack} => {soda} 0.001403368
## [330] {other vegetables} => {whole milk} 0.014835605
## [331] {whole milk} => {other vegetables} 0.014835605
## [332] {cream cheese} => {whole milk} 0.002873563
## [333] {waffles} => {other vegetables} 0.001737503
## [334] {long life bakery product} => {soda} 0.001336541
## [335] {whole milk} => {tropical fruit} 0.008219727
## [336] {tropical fruit} => {whole milk} 0.008219727
## [337] {ham} => {other vegetables} 0.001603849
## [338] {UHT-milk} => {rolls/buns} 0.001804330
## [339] {coffee} => {yogurt} 0.002071639
## [340] {coffee} => {whole milk} 0.003809142
## [341] {fruit/vegetable juice} => {root vegetables} 0.001804330
## [342] {white bread} => {root vegetables} 0.001269714
## [343] {soft cheese} => {whole milk} 0.001202887
## [344] {tropical fruit} => {other vegetables} 0.006281743
## [345] {other vegetables} => {tropical fruit} 0.006281743
## [346] {soda} => {whole milk} 0.011627907
## [347] {whole milk} => {soda} 0.011627907
## [348] {grapes} => {rolls/buns} 0.001202887
## [349] {specialty bar} => {whole milk} 0.001670676
## [350] {soda} => {rolls/buns} 0.008086073
## [351] {rolls/buns} => {soda} 0.008086073
## [352] {beef} => {yogurt} 0.002205293
## [353] {fruit/vegetable juice} => {yogurt} 0.002205293
## [354] {chicken} => {yogurt} 0.001804330
## [355] {brown bread} => {whole milk} 0.004477412
## [356] {UHT-milk} => {whole milk} 0.002539428
## [357] {sausage} => {tropical fruit} 0.003074044
## [358] {rolls/buns} => {root vegetables} 0.005747126
## [359] {root vegetables} => {rolls/buns} 0.005747126
## [360] {berries} => {yogurt} 0.001403368
## [361] {onions} => {soda} 0.001470195
## [362] {bottled water} => {whole milk} 0.007150495
## [363] {chicken} => {tropical fruit} 0.001403368
## [364] {other vegetables, soda} => {whole milk} 0.001136060
## [365] {butter} => {rolls/buns} 0.002873563
## [366] {citrus fruit} => {other vegetables} 0.004811548
## [367] {beverages} => {whole milk} 0.001937984
## [368] {cream cheese} => {other vegetables} 0.002138466
## [369] {bottled water} => {other vegetables} 0.005479818
## [370] {curd} => {rolls/buns} 0.002739909
## [371] {rolls/buns, whole milk} => {soda} 0.001002406
## [372] {frozen vegetables} => {soda} 0.002004812
## [373] {other vegetables, whole milk} => {rolls/buns} 0.001202887
## [374] {chocolate} => {root vegetables} 0.001202887
## [375] {frozen meals} => {whole milk} 0.001937984
## [376] {bottled water} => {yogurt} 0.003809142
## [377] {onions} => {yogurt} 0.001269714
## [378] {chocolate} => {soda} 0.001670676
## [379] {butter} => {yogurt} 0.002205293
## [380] {chewing gum} => {other vegetables} 0.001069233
## [381] {citrus fruit} => {soda} 0.003742315
## [382] {ham} => {soda} 0.001202887
## [383] {brown bread} => {yogurt} 0.002338947
## [384] {specialty chocolate} => {rolls/buns} 0.001269714
## [385] {meat} => {rolls/buns} 0.001336541
## [386] {other vegetables, rolls/buns} => {whole milk} 0.001202887
## [387] {dessert} => {other vegetables} 0.002071639
## [388] {cream cheese} => {rolls/buns} 0.001871157
## [389] {root vegetables} => {yogurt} 0.004276931
## [390] {napkins} => {soda} 0.001537022
## [391] {waffles} => {yogurt} 0.001136060
## [392] {napkins} => {rolls/buns} 0.001737503
## [393] {pickled vegetables} => {whole milk} 0.001002406
## [394] {fruit/vegetable juice} => {other vegetables} 0.002940390
## [395] {rolls/buns, whole milk} => {other vegetables} 0.001202887
## [396] {domestic eggs} => {soda} 0.002539428
## [397] {newspapers} => {rolls/buns} 0.003007217
## [398] {bottled water} => {rolls/buns} 0.004677894
## [399] {canned beer} => {other vegetables} 0.004009623
## [400] {sugar} => {soda} 0.001202887
## [401] {yogurt} => {soda} 0.005813953
## [402] {soda} => {yogurt} 0.005813953
## [403] {berries} => {rolls/buns} 0.001670676
## [404] {berries} => {soda} 0.001470195
## [405] {pastry} => {rolls/buns} 0.003942796
## [406] {coffee} => {rolls/buns} 0.002405774
## [407] {canned beer} => {soda} 0.003140871
## [408] {napkins} => {whole milk} 0.002405774
## [409] {white wine} => {whole milk} 0.001269714
## [410] {root vegetables} => {whole milk} 0.007551457
## [411] {ice cream} => {other vegetables} 0.001269714
## [412] {herbs} => {whole milk} 0.001136060
## [413] {beef} => {other vegetables} 0.002806736
## [414] {coffee} => {other vegetables} 0.002606255
## [415] {ham} => {rolls/buns} 0.001269714
## [416] {brown bread} => {other vegetables} 0.003074044
## [417] {bottled beer} => {soda} 0.002940390
## [418] {butter} => {other vegetables} 0.002873563
## [419] {whipped/sour cream} => {whole milk} 0.004611067
## [420] {sliced cheese} => {whole milk} 0.001470195
## [421] {berries} => {whole milk} 0.002272120
## [422] {beverages} => {rolls/buns} 0.001202887
## [423] {white bread} => {soda} 0.001537022
## [424] {butter milk} => {rolls/buns} 0.001269714
## [425] {salty snack} => {whole milk} 0.001937984
## [426] {domestic eggs} => {yogurt} 0.002071639
## [427] {chocolate} => {other vegetables} 0.001871157
## [428] {chicken} => {other vegetables} 0.002205293
## [429] {candy} => {other vegetables} 0.001136060
## [430] {fruit/vegetable juice} => {soda} 0.002138466
## [431] {dessert} => {whole milk} 0.002405774
## [432] {dessert} => {soda} 0.001470195
## [433] {cream cheese} => {soda} 0.001470195
## [434] {misc. beverages} => {other vegetables} 0.001202887
## [435] {onions} => {other vegetables} 0.001537022
## [436] {root vegetables} => {other vegetables} 0.005279337
## [437] {newspapers} => {soda} 0.002338947
## [438] {UHT-milk} => {yogurt} 0.001136060
## [439] {meat} => {soda} 0.001002406
## [440] {whipped/sour cream} => {rolls/buns} 0.002940390
## [441] {UHT-milk} => {soda} 0.001269714
## [442] {butter milk} => {whole milk} 0.001670676
## [443] {dessert} => {yogurt} 0.001202887
## [444] {butter milk} => {other vegetables} 0.001269714
## [445] {sugar} => {other vegetables} 0.001269714
## [446] {pastry} => {other vegetables} 0.003675488
## [447] {misc. beverages} => {whole milk} 0.001403368
## [448] {beef} => {soda} 0.001804330
## [449] {specialty chocolate} => {whole milk} 0.001336541
## [450] {long life bakery product} => {other vegetables} 0.001136060
## confidence coverage lift count
## [1] 0.13173653 0.011160118 2.1830624 22
## [2] 0.16417910 0.008954825 1.9118880 22
## [3] 0.08786611 0.015971665 1.6538723 21
## [4] 0.25581395 0.005747126 1.6199746 22
## [5] 0.10958904 0.009756750 1.6172489 16
## [6] 0.09274194 0.016573109 1.5368664 23
## [7] 0.09195402 0.011627907 1.5238095 16
## [8] 0.07854985 0.022119754 1.5186304 26
## [9] 0.10526316 0.010157712 1.5131200 16
## [10] 0.07272727 0.014701951 1.4826852 16
## [11] 0.12666667 0.010024058 1.4750506 19
## [12] 0.08730159 0.033680834 1.4467120 44
## [13] 0.12403101 0.008620690 1.4443580 16
## [14] 0.08301887 0.017709169 1.3681656 22
## [15] 0.06406685 0.023990912 1.3656644 23
## [16] 0.06394316 0.037623630 1.3630277 36
## [17] 0.05128205 0.046912590 1.3630277 36
## [18] 0.11666667 0.012028869 1.3585992 21
## [19] 0.08133971 0.013966854 1.3479152 17
## [20] 0.21250000 0.005346164 1.3456835 17
## [21] 0.08095238 0.014033681 1.3414966 17
## [22] 0.14473684 0.010157712 1.3158214 22
## [23] 0.06976744 0.014367816 1.3132075 15
## [24] 0.14173228 0.008487036 1.2885066 18
## [25] 0.14150943 0.007083667 1.2864807 15
## [26] 0.07569721 0.016773590 1.2544109 19
## [27] 0.10759494 0.010558674 1.2529577 17
## [28] 0.08474576 0.011828388 1.2506268 15
## [29] 0.12107623 0.014902433 1.2469269 27
## [30] 0.08368201 0.015971665 1.2349286 20
## [31] 0.08571429 0.014033681 1.2321120 18
## [32] 0.11940299 0.008954825 1.2296946 16
## [33] 0.07407407 0.014434643 1.2275132 16
## [34] 0.07398568 0.028000535 1.2260484 31
## [35] 0.05537099 0.060344828 1.2220818 50
## [36] 0.07374631 0.045308741 1.2220818 50
## [37] 0.05280528 0.020248597 1.2082236 16
## [38] 0.05703422 0.017575515 1.1986799 15
## [39] 0.06344411 0.022119754 1.1941857 21
## [40] 0.11290323 0.016573109 1.1627556 28
## [41] 0.12738854 0.010491847 1.1581057 20
## [42] 0.05665722 0.023589949 1.1550663 20
## [43] 0.12686567 0.008954825 1.1533523 17
## [44] 0.14049587 0.008086073 1.1507281 17
## [45] 0.07936508 0.016840417 1.1408444 20
## [46] 0.17977528 0.005947608 1.1384500 16
## [47] 0.05338078 0.018778401 1.1378775 15
## [48] 0.06779661 0.015771184 1.1234867 16
## [49] 0.13628319 0.037757284 1.1162242 77
## [50] 0.17605634 0.009489441 1.1148993 25
## [51] 0.09569378 0.013966854 1.1143671 20
## [52] 0.09523810 0.060344828 1.1090606 86
## [53] 0.06692607 0.085872761 1.1090606 86
## [54] 0.10759494 0.010558674 1.1080872 17
## [55] 0.05011933 0.028000535 1.1061736 21
## [56] 0.07637232 0.028000535 1.0978245 32
## [57] 0.11976048 0.011160118 1.0887581 20
## [58] 0.17094017 0.007818765 1.0825005 20
## [59] 0.11898017 0.023589949 1.0816642 42
## [60] 0.05727924 0.028000535 1.0781465 24
## [61] 0.05099150 0.023589949 1.0716809 18
## [62] 0.05084746 0.023656776 1.0686536 18
## [63] 0.11724138 0.009689922 1.0658566 17
## [64] 0.07407407 0.014434643 1.0647881 16
## [65] 0.06451613 0.016573109 1.0632372 16
## [66] 0.05214724 0.021785619 1.0631216 17
## [67] 0.07187500 0.021384657 1.0606879 23
## [68] 0.11627907 0.008620690 1.0571081 15
## [69] 0.07317073 0.013699546 1.0518029 15
## [70] 0.12820513 0.007818765 1.0500611 15
## [71] 0.12749004 0.016773590 1.0442041 32
## [72] 0.11453744 0.015169741 1.0412748 26
## [73] 0.12698413 0.016840417 1.0400605 32
## [74] 0.07220217 0.018511093 1.0378801 20
## [75] 0.05502846 0.035217856 1.0357810 29
## [76] 0.11363636 0.014701951 1.0330830 25
## [77] 0.06232295 0.023589949 1.0327803 22
## [78] 0.16279070 0.008620690 1.0308929 21
## [79] 0.05328597 0.037623630 1.0301954 30
## [80] 0.06201550 0.051724138 1.0276855 48
## [81] 0.05315615 0.060344828 1.0276855 48
## [82] 0.06125258 0.097099706 1.0150428 89
## [83] 0.09856035 0.060344828 1.0150428 89
## [84] 0.16015625 0.017107725 1.0142100 41
## [85] 0.08679245 0.053127506 1.0107099 69
## [86] 0.05369650 0.085872761 1.0107099 69
## [87] 0.07022472 0.047580861 1.0094550 50
## [88] 0.08636364 0.014701951 1.0057163 19
## [89] 0.12269939 0.021785619 1.0049664 40
## [90] 0.08612440 0.013966854 1.0029304 18
## [91] 0.06049822 0.018778401 1.0025419 17
## [92] 0.09722222 0.014434643 1.0012618 21
## [93] 0.05314961 0.033948142 1.0004160 27
## [94] 0.11001965 0.034014969 1.0002029 56
## [95] 0.15781711 0.045308741 0.9993970 107
## [96] 0.05154639 0.038893344 0.9965636 30
## [97] 0.15686275 0.006816359 0.9933534 16
## [98] 0.12107623 0.014902433 0.9916720 27
## [99] 0.05970149 0.017909650 0.9893390 16
## [100] 0.05949008 0.023589949 0.9858357 21
## [101] 0.12000000 0.010024058 0.9828571 18
## [102] 0.05949008 0.023589949 0.9804071 21
## [103] 0.06818182 0.014701951 0.9800891 15
## [104] 0.06640625 0.017107725 0.9799834 17
## [105] 0.11961722 0.013966854 0.9797220 25
## [106] 0.08372093 0.014367816 0.9749416 18
## [107] 0.06779661 0.023656776 0.9745518 24
## [108] 0.05849582 0.023990912 0.9693593 21
## [109] 0.08288288 0.037089014 0.9651825 46
## [110] 0.05809129 0.032210639 0.9626556 28
## [111] 0.05840708 0.037757284 0.9625590 33
## [112] 0.08262108 0.046912590 0.9621338 58
## [113] 0.11743772 0.018778401 0.9618709 33
## [114] 0.09269663 0.047580861 0.9546541 66
## [115] 0.08185053 0.018778401 0.9531606 23
## [116] 0.05765766 0.037089014 0.9502084 32
## [117] 0.06600660 0.020248597 0.9488211 20
## [118] 0.05753968 0.033680834 0.9482641 29
## [119] 0.09163347 0.016773590 0.9437049 23
## [120] 0.14883721 0.014367816 0.9425307 32
## [121] 0.14839424 0.060344828 0.9397255 134
## [122] 0.05670758 0.157912323 0.9397255 134
## [123] 0.06529210 0.038893344 0.9385504 38
## [124] 0.10320285 0.018778401 0.9382305 29
## [125] 0.08050847 0.015771184 0.9375322 19
## [126] 0.10311751 0.027866881 0.9374547 43
## [127] 0.09090909 0.013966854 0.9362448 19
## [128] 0.11363636 0.014701951 0.9307359 25
## [129] 0.10232558 0.014367816 0.9302552 22
## [130] 0.07968127 0.016773590 0.9278993 20
## [131] 0.06286837 0.034014969 0.9277735 32
## [132] 0.05604720 0.045308741 0.9236677 38
## [133] 0.14521452 0.020248597 0.9195895 44
## [134] 0.11217184 0.028000535 0.9187408 47
## [135] 0.08918406 0.035217856 0.9184792 47
## [136] 0.14473684 0.010157712 0.9165646 22
## [137] 0.10081744 0.049051056 0.9165444 74
## [138] 0.05555556 0.051724138 0.9155653 43
## [139] 0.07854985 0.022119754 0.9147237 26
## [140] 0.14432990 0.038893344 0.9139875 84
## [141] 0.06355932 0.015771184 0.9136424 15
## [142] 0.05502846 0.035217856 0.9119002 29
## [143] 0.06342495 0.031609195 0.9117108 30
## [144] 0.08837209 0.014367816 0.9101170 19
## [145] 0.11111111 0.014434643 0.9100529 24
## [146] 0.10000000 0.010024058 0.9091130 15
## [147] 0.09971910 0.047580861 0.9065593 71
## [148] 0.06137184 0.018511093 0.9056886 17
## [149] 0.08786611 0.015971665 0.9049060 21
## [150] 0.06116208 0.021852446 0.9025931 20
## [151] 0.14234234 0.037089014 0.9014011 79
## [152] 0.07692308 0.067762630 0.8957797 78
## [153] 0.06070039 0.085872761 0.8957797 78
## [154] 0.14124294 0.011828388 0.8944390 25
## [155] 0.07657658 0.014835605 0.8917447 17
## [156] 0.14079422 0.018511093 0.8915974 39
## [157] 0.14067278 0.021852446 0.8908284 46
## [158] 0.07645260 0.021852446 0.8903009 25
## [159] 0.10863510 0.023990912 0.8897732 39
## [160] 0.14049587 0.008086073 0.8897081 17
## [161] 0.09785203 0.028000535 0.8895855 41
## [162] 0.09756098 0.013699546 0.8869395 20
## [163] 0.10828025 0.010491847 0.8868668 17
## [164] 0.13982301 0.037757284 0.8854471 79
## [165] 0.09734513 0.037757284 0.8849773 55
## [166] 0.13962264 0.017709169 0.8841783 37
## [167] 0.05970149 0.017909650 0.8810386 16
## [168] 0.05312500 0.021384657 0.8803571 17
## [169] 0.13888889 0.012028869 0.8795317 25
## [170] 0.05304519 0.034014969 0.8790345 27
## [171] 0.05949008 0.023589949 0.8779188 21
## [172] 0.05940594 0.020248597 0.8766770 18
## [173] 0.07522124 0.045308741 0.8759616 51
## [174] 0.05932203 0.023656776 0.8754388 21
## [175] 0.05270655 0.046912590 0.8734229 37
## [176] 0.13779528 0.033948142 0.8726062 70
## [177] 0.05292479 0.023990912 0.8722099 19
## [178] 0.10630631 0.037089014 0.8706993 59
## [179] 0.13698630 0.009756750 0.8674833 20
## [180] 0.07443820 0.047580861 0.8668430 53
## [181] 0.10563380 0.009489441 0.8651911 15
## [182] 0.06016598 0.032210639 0.8648642 29
## [183] 0.07421875 0.017107725 0.8642875 19
## [184] 0.07398568 0.028000535 0.8615733 31
## [185] 0.13603819 0.028000535 0.8614792 57
## [186] 0.05837004 0.060678963 0.8613899 53
## [187] 0.05226824 0.067762630 0.8613899 53
## [188] 0.10515873 0.033680834 0.8613001 53
## [189] 0.07388316 0.038893344 0.8603795 43
## [190] 0.05828221 0.021785619 0.8600937 19
## [191] 0.10483871 0.016573109 0.8586790 26
## [192] 0.08333333 0.012028869 0.8582244 15
## [193] 0.08333333 0.033680834 0.8582244 42
## [194] 0.05204873 0.060344828 0.8577722 47
## [195] 0.05176211 0.060678963 0.8577722 47
## [196] 0.10460251 0.015971665 0.8567444 25
## [197] 0.07356948 0.049051056 0.8567266 54
## [198] 0.13513514 0.037089014 0.8557605 75
## [199] 0.13487738 0.049051056 0.8541283 99
## [200] 0.13459119 0.053127506 0.8523160 107
## [201] 0.10393258 0.047580861 0.8512574 74
## [202] 0.05765766 0.037089014 0.8508769 32
## [203] 0.13432836 0.017909650 0.8506515 36
## [204] 0.13425926 0.014434643 0.8502139 29
## [205] 0.05758427 0.047580861 0.8497939 41
## [206] 0.09336100 0.032210639 0.8487570 45
## [207] 0.09328358 0.017909650 0.8480532 25
## [208] 0.05740181 0.022119754 0.8471013 19
## [209] 0.10324484 0.045308741 0.8456244 70
## [210] 0.13342697 0.047580861 0.8449433 95
## [211] 0.05123340 0.035217856 0.8443354 27
## [212] 0.05084746 0.023656776 0.8426150 18
## [213] 0.05703422 0.017575515 0.8416766 15
## [214] 0.07224335 0.017575515 0.8412836 19
## [215] 0.13282732 0.035217856 0.8411460 70
## [216] 0.05840708 0.037757284 0.8395807 33
## [217] 0.10243902 0.013699546 0.8390244 21
## [218] 0.08141593 0.037757284 0.8384776 46
## [219] 0.13223140 0.008086073 0.8373723 16
## [220] 0.07174888 0.014902433 0.8355255 16
## [221] 0.09189189 0.037089014 0.8354011 51
## [222] 0.09189189 0.037089014 0.8354011 51
## [223] 0.05660377 0.017709169 0.8353243 15
## [224] 0.05810398 0.021852446 0.8352237 19
## [225] 0.08108108 0.037089014 0.8350291 45
## [226] 0.05657492 0.043704892 0.8348986 37
## [227] 0.10179641 0.011160118 0.8337610 17
## [228] 0.08095238 0.014033681 0.8337037 17
## [229] 0.08091286 0.032210639 0.8332967 39
## [230] 0.13095238 0.016840417 0.8292727 33
## [231] 0.13091922 0.023990912 0.8290627 47
## [232] 0.08038147 0.049051056 0.8278240 59
## [233] 0.09105058 0.085872761 0.8277527 117
## [234] 0.07108141 0.109997327 0.8277527 117
## [235] 0.05604720 0.045308741 0.8271107 38
## [236] 0.10091743 0.021852446 0.8265618 33
## [237] 0.10081744 0.049051056 0.8257428 74
## [238] 0.05000000 0.021384657 0.8240088 16
## [239] 0.13004484 0.014902433 0.8235256 29
## [240] 0.05726872 0.060678963 0.8232173 52
## [241] 0.12996109 0.085872761 0.8229952 167
## [242] 0.07067287 0.157912323 0.8229952 167
## [243] 0.07988166 0.067762630 0.8226766 81
## [244] 0.05574673 0.097099706 0.8226766 81
## [245] 0.07984791 0.017575515 0.8223290 21
## [246] 0.09039548 0.011828388 0.8217971 16
## [247] 0.12966601 0.034014969 0.8211266 66
## [248] 0.05555556 0.033680834 0.8198554 28
## [249] 0.05703422 0.017575515 0.8198464 15
## [250] 0.10000000 0.014033681 0.8190476 21
## [251] 0.10000000 0.021384657 0.8190476 32
## [252] 0.05693950 0.018778401 0.8184848 16
## [253] 0.05692600 0.035217856 0.8182907 30
## [254] 0.09979353 0.097099706 0.8173565 145
## [255] 0.07936508 0.122093023 0.8173565 145
## [256] 0.07929515 0.015169741 0.8166364 18
## [257] 0.07929515 0.060678963 0.8166364 72
## [258] 0.09966777 0.060344828 0.8163265 90
## [259] 0.08974359 0.046912590 0.8158706 63
## [260] 0.08974359 0.067762630 0.8158706 91
## [261] 0.05528554 0.109997327 0.8158706 91
## [262] 0.09958506 0.032210639 0.8156491 48
## [263] 0.08968610 0.014902433 0.8153480 20
## [264] 0.05657492 0.043704892 0.8132441 37
## [265] 0.06976744 0.051724138 0.8124514 54
## [266] 0.12820513 0.007818765 0.8118754 15
## [267] 0.12820513 0.046912590 0.8118754 90
## [268] 0.07881137 0.051724138 0.8116540 61
## [269] 0.08913649 0.023990912 0.8103514 32
## [270] 0.12775330 0.015169741 0.8090142 29
## [271] 0.08880995 0.037623630 0.8073828 50
## [272] 0.08868502 0.021852446 0.8062470 29
## [273] 0.12727273 0.014701951 0.8059708 28
## [274] 0.07822410 0.031609195 0.8056060 37
## [275] 0.08859358 0.060344828 0.8054157 80
## [276] 0.08849558 0.045308741 0.8045248 60
## [277] 0.12697448 0.109997327 0.8040822 209
## [278] 0.08844689 0.157912323 0.8040822 209
## [279] 0.07804878 0.013699546 0.8038004 16
## [280] 0.12682927 0.013699546 0.8031626 26
## [281] 0.07798165 0.043704892 0.8031090 51
## [282] 0.12655602 0.032210639 0.8014322 61
## [283] 0.05426357 0.051724138 0.8007890 42
## [284] 0.08805031 0.053127506 0.8004769 70
## [285] 0.09770115 0.011627907 0.8002189 17
## [286] 0.05413105 0.046912590 0.7988334 38
## [287] 0.05555556 0.051724138 0.7985911 43
## [288] 0.05408805 0.053127506 0.7981988 43
## [289] 0.08764940 0.016773590 0.7968321 22
## [290] 0.05537099 0.060344828 0.7959380 50
## [291] 0.12532300 0.051724138 0.7936239 97
## [292] 0.09667674 0.022119754 0.7918285 32
## [293] 0.06798867 0.023589949 0.7917373 24
## [294] 0.07673861 0.027866881 0.7903073 32
## [295] 0.06779661 0.023656776 0.7895008 24
## [296] 0.12464589 0.023589949 0.7893361 44
## [297] 0.07657658 0.014835605 0.7886386 17
## [298] 0.05338078 0.018778401 0.7877614 15
## [299] 0.08664260 0.018511093 0.7876791 24
## [300] 0.07645260 0.021852446 0.7873618 25
## [301] 0.07637655 0.037623630 0.7865786 43
## [302] 0.09599028 0.109997327 0.7862061 158
## [303] 0.08648057 0.122093023 0.7862061 158
## [304] 0.06746032 0.033680834 0.7855846 34
## [305] 0.12396694 0.008086073 0.7850365 15
## [306] 0.05457227 0.045308741 0.7844567 37
## [307] 0.08620690 0.011627907 0.7837181 15
## [308] 0.06727829 0.043704892 0.7834648 44
## [309] 0.05449591 0.049051056 0.7833591 40
## [310] 0.06725664 0.037757284 0.7832127 38
## [311] 0.08612440 0.013966854 0.7829681 18
## [312] 0.09549550 0.037089014 0.7821536 53
## [313] 0.06716418 0.017909650 0.7821360 18
## [314] 0.07588857 0.069566961 0.7815530 79
## [315] 0.05437027 0.097099706 0.7815530 79
## [316] 0.08580858 0.020248597 0.7800970 26
## [317] 0.05283381 0.069566961 0.7796895 55
## [318] 0.05424063 0.067762630 0.7796895 55
## [319] 0.12301587 0.033680834 0.7790138 62
## [320] 0.05405405 0.037089014 0.7770076 30
## [321] 0.09480122 0.043704892 0.7764672 62
## [322] 0.12230216 0.027866881 0.7744941 51
## [323] 0.09450172 0.038893344 0.7740141 55
## [324] 0.06639004 0.032210639 0.7731211 32
## [325] 0.08498584 0.023589949 0.7726173 30
## [326] 0.09416342 0.085872761 0.7712433 121
## [327] 0.06622879 0.122093023 0.7712433 121
## [328] 0.08474576 0.015771184 0.7704347 20
## [329] 0.07473310 0.018778401 0.7696532 21
## [330] 0.12151067 0.122093023 0.7694819 222
## [331] 0.09394837 0.157912323 0.7694819 222
## [332] 0.12146893 0.023656776 0.7692175 43
## [333] 0.09386282 0.018511093 0.7687812 26
## [334] 0.07462687 0.017909650 0.7685591 20
## [335] 0.05205248 0.157912323 0.7681590 123
## [336] 0.12130178 0.067762630 0.7681590 123
## [337] 0.09375000 0.017107725 0.7678571 24
## [338] 0.08437500 0.021384657 0.7670641 27
## [339] 0.06553911 0.031609195 0.7632119 31
## [340] 0.12050740 0.031609195 0.7631285 57
## [341] 0.05304519 0.034014969 0.7625054 27
## [342] 0.05292479 0.023990912 0.7607748 19
## [343] 0.12000000 0.010024058 0.7599154 18
## [344] 0.09270217 0.067762630 0.7592749 94
## [345] 0.05145047 0.122093023 0.7592749 94
## [346] 0.11975224 0.097099706 0.7583464 174
## [347] 0.07363521 0.157912323 0.7583464 174
## [348] 0.08333333 0.014434643 0.7575942 18
## [349] 0.11961722 0.013966854 0.7574914 25
## [350] 0.08327598 0.097099706 0.7570728 121
## [351] 0.07351154 0.109997327 0.7570728 121
## [352] 0.06496063 0.033948142 0.7564754 33
## [353] 0.06483301 0.034014969 0.7549892 33
## [354] 0.06474820 0.027866881 0.7540016 27
## [355] 0.11900533 0.037623630 0.7536165 67
## [356] 0.11875000 0.021384657 0.7519996 38
## [357] 0.05094131 0.060344828 0.7517611 46
## [358] 0.05224787 0.109997327 0.7510444 86
## [359] 0.08261287 0.069566961 0.7510444 86
## [360] 0.06441718 0.021785619 0.7501468 21
## [361] 0.07260726 0.020248597 0.7477598 22
## [362] 0.11784141 0.060678963 0.7462458 107
## [363] 0.05035971 0.027866881 0.7431782 21
## [364] 0.11724138 0.009689922 0.7424460 17
## [365] 0.08159393 0.035217856 0.7417810 43
## [366] 0.09056604 0.053127506 0.7417790 72
## [367] 0.11693548 0.016573109 0.7405089 29
## [368] 0.09039548 0.023656776 0.7403820 32
## [369] 0.09030837 0.060678963 0.7396686 82
## [370] 0.08134921 0.033680834 0.7395562 41
## [371] 0.07177033 0.013966854 0.7391406 15
## [372] 0.07159905 0.028000535 0.7373765 30
## [373] 0.08108108 0.014835605 0.7371186 18
## [374] 0.05099150 0.023589949 0.7329845 18
## [375] 0.11553785 0.016773590 0.7316582 29
## [376] 0.06277533 0.060678963 0.7310273 57
## [377] 0.06270627 0.020248597 0.7302231 19
## [378] 0.07082153 0.023589949 0.7293691 25
## [379] 0.06261860 0.035217856 0.7292021 33
## [380] 0.08888889 0.012028869 0.7280423 16
## [381] 0.07044025 0.053127506 0.7254425 56
## [382] 0.07031250 0.017107725 0.7241268 18
## [383] 0.06216696 0.037623630 0.7239427 35
## [384] 0.07949791 0.015971665 0.7227258 19
## [385] 0.07936508 0.016840417 0.7215183 20
## [386] 0.11392405 0.010558674 0.7214386 18
## [387] 0.08781870 0.023589949 0.7192769 31
## [388] 0.07909605 0.023656776 0.7190724 28
## [389] 0.06147935 0.069566961 0.7159354 64
## [390] 0.06948640 0.022119754 0.7156191 23
## [391] 0.06137184 0.018511093 0.7146834 17
## [392] 0.07854985 0.022119754 0.7141069 26
## [393] 0.11194030 0.008954825 0.7088763 15
## [394] 0.08644401 0.034014969 0.7080176 44
## [395] 0.08612440 0.013966854 0.7053999 18
## [396] 0.06846847 0.037089014 0.7051357 38
## [397] 0.07731959 0.038893344 0.7029224 45
## [398] 0.07709251 0.060678963 0.7008580 70
## [399] 0.08547009 0.046912590 0.7000407 60
## [400] 0.06792453 0.017709169 0.6995338 18
## [401] 0.06770428 0.085872761 0.6972656 87
## [402] 0.05987612 0.097099706 0.6972656 87
## [403] 0.07668712 0.021785619 0.6971725 25
## [404] 0.06748466 0.021785619 0.6950038 22
## [405] 0.07622739 0.051724138 0.6929931 59
## [406] 0.07610994 0.031609195 0.6919253 36
## [407] 0.06695157 0.046912590 0.6895136 47
## [408] 0.10876133 0.022119754 0.6887450 36
## [409] 0.10857143 0.011694734 0.6875425 19
## [410] 0.10854947 0.069566961 0.6874034 113
## [411] 0.08370044 0.015169741 0.6855465 19
## [412] 0.10759494 0.010558674 0.6813587 17
## [413] 0.08267717 0.033948142 0.6771654 42
## [414] 0.08245243 0.031609195 0.6753247 39
## [415] 0.07421875 0.017107725 0.6747323 19
## [416] 0.08170515 0.037623630 0.6692041 46
## [417] 0.06489676 0.045308741 0.6683517 44
## [418] 0.08159393 0.035217856 0.6682931 43
## [419] 0.10550459 0.043704892 0.6681213 69
## [420] 0.10476190 0.014033681 0.6634182 22
## [421] 0.10429448 0.021785619 0.6604581 34
## [422] 0.07258065 0.016573109 0.6598401 18
## [423] 0.06406685 0.023990912 0.6598048 23
## [424] 0.07224335 0.017575515 0.6567737 19
## [425] 0.10320285 0.018778401 0.6535452 29
## [426] 0.05585586 0.037089014 0.6504490 31
## [427] 0.07932011 0.023589949 0.6496695 28
## [428] 0.07913669 0.027866881 0.6481672 33
## [429] 0.07906977 0.014367816 0.6476190 17
## [430] 0.06286837 0.034014969 0.6474620 32
## [431] 0.10198300 0.023589949 0.6458204 36
## [432] 0.06232295 0.023589949 0.6418448 22
## [433] 0.06214689 0.023656776 0.6400317 22
## [434] 0.07627119 0.015771184 0.6246973 18
## [435] 0.07590759 0.020248597 0.6217193 23
## [436] 0.07588857 0.069566961 0.6215635 79
## [437] 0.06013746 0.038893344 0.6193372 35
## [438] 0.05312500 0.021384657 0.6186479 17
## [439] 0.05952381 0.016840417 0.6130174 15
## [440] 0.06727829 0.043704892 0.6116357 44
## [441] 0.05937500 0.021384657 0.6114849 19
## [442] 0.09505703 0.017575515 0.6019608 25
## [443] 0.05099150 0.023589949 0.5938030 18
## [444] 0.07224335 0.017575515 0.5917074 19
## [445] 0.07169811 0.017709169 0.5872417 19
## [446] 0.07105943 0.051724138 0.5820106 55
## [447] 0.08898305 0.015771184 0.5634966 21
## [448] 0.05314961 0.033948142 0.5473714 27
## [449] 0.08368201 0.015971665 0.5299270 20
## [450] 0.06343284 0.017909650 0.5195451 17
head(associationRules, n = 10)
## lhs rhs support confidence
## [1] {whole milk, yogurt} => {sausage} 0.001470195 0.13173653
## [2] {sausage, whole milk} => {yogurt} 0.001470195 0.16417910
## [3] {specialty chocolate} => {citrus fruit} 0.001403368 0.08786611
## [4] {sausage, yogurt} => {whole milk} 0.001470195 0.25581395
## [5] {flour} => {tropical fruit} 0.001069233 0.10958904
## [6] {beverages} => {sausage} 0.001537022 0.09274194
## [7] {soda, whole milk} => {sausage} 0.001069233 0.09195402
## [8] {napkins} => {pastry} 0.001737503 0.07854985
## [9] {processed cheese} => {root vegetables} 0.001069233 0.10526316
## [10] {hard cheese} => {pip fruit} 0.001069233 0.07272727
## coverage lift count
## [1] 0.011160118 2.183062 22
## [2] 0.008954825 1.911888 22
## [3] 0.015971665 1.653872 21
## [4] 0.005747126 1.619975 22
## [5] 0.009756750 1.617249 16
## [6] 0.016573109 1.536866 23
## [7] 0.011627907 1.523810 16
## [8] 0.022119754 1.518630 26
## [9] 0.010157712 1.513120 16
## [10] 0.014701951 1.482685 16
As there can be a large number of rules generated based on the dataset, it is crucial to have effective ways of presenting the findings. While the ItemFrequencyPlot that we discussed earlier is an excellent method for obtaining information on the top-selling items, there are other ways to visualize the results as well.
In this report, we will be discussing two types of visualizations:
Scatter-Plot: This visualization provides a graphical representation of the rules generated by the Apriori algorithm. It plots the support and confidence values of each rule, allowing for easy identification of the most significant associations.
Graph-based visualization: This visualization uses the arulesViz package to represent the rules as a graph. Each item in the rule is represented as a node and the relationships between items are displayed as edges.
Individual Rule Representation: This visualization method involves the representation of each rule individually, providing detailed information on the rule’s antecedent and consequent items, support, and confidence values. This approach is particularly useful when analyzing specific rules of interest.
One way to visualize association rules is through a scatter plot using the plot() function from the arulesViz package. This plot displays Support and Confidence on the x and y axes respectively, and uses Lift as a color scale for the points. The higher the lift value, the darker the point will appear on the plot.
# Filter rules with confidence greater than 0.1 or 10%
subRules<-rules[quality(rules)$confidence>0.1]
#Plot SubRules
plot(subRules)
## To reduce overplotting, jitter is added! Use jitter = 0 to prevent jitter.
plot(subRules,method="two-key plot")
## To reduce overplotting, jitter is added! Use jitter = 0 to prevent jitter.
The two-key plot is a commonly used visualization tool for association rules analysis. It employs support and confidence as the two axes, with support on the x-axis and confidence on the y-axis. The order of the rule, or the number of items in the rule, is used to determine the color of the points on the plot. This visualization is useful for identifying interesting rules based on their support and confidence levels, as well as the complexity of the rule based on the number of items involved.
top10subRules <- head(subRules, n = 10, by = "confidence")
plot(top10subRules, method = "graph", engine = "htmlwidget")
The Parallel Coordinates Plot is another name for this representation. It is a helpful way to display which products, along with which items, lead to what types of sales.
# Filter top 20 rules with highest lift
subRules2 <- head(subRules, n=20, by="lift")
plot(subRules2, method="paracoord")
From the graph above, it can be seen that if I have yogurt and whole
milk in my shopping cart, it is likely for me to buy sausage.
From the analysis, we can see that there are certain items that are commonly purchased together by customers at the grocery store. These insights can be useful for the grocery store to optimize their product placements or promotions to increase sales.
Jabeen, Hafsa (2018, August). Market Basket Analysis using R. Datacamp. https://www.datacamp.com/tutorial/market-basket-analysis-r