The aim is to apply apriori rules until we find the ‘sweet spot’ of a useful amount of support, confidence, and lifts, generally greater than 1 for stronger rules.
## Apriori #1
Rules1 <- apriori(trans, parameter = list(supp = 0.1, conf = 0.8, minlen = 3)) #Covers 10% of transactions (N=983), 80% correct
## Apriori
##
## Parameter specification:
## confidence minval smax arem aval originalSupport maxtime support minlen
## 0.8 0.1 1 none FALSE TRUE 5 0.1 3
## 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: 983
##
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[125 item(s), 9835 transaction(s)] done [0.00s].
## sorting and recoding items ... [10 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 done [0.00s].
## writing ... [0 rule(s)] done [0.00s].
## creating S4 object ... done [0.00s].
inspect(sort(Rules1, by='lift'))
Apriori 1 generated no rules
## Apriori #2
Rules2 <- apriori(trans, parameter = list(supp = 0.01, conf = 0.8, minlen = 3)) #Covers 1% of transactions (N=98), 80% correct
## Apriori
##
## Parameter specification:
## confidence minval smax arem aval originalSupport maxtime support minlen
## 0.8 0.1 1 none FALSE TRUE 5 0.01 3
## 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: 98
##
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[125 item(s), 9835 transaction(s)] done [0.00s].
## sorting and recoding items ... [82 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 3 4 done [0.00s].
## writing ... [0 rule(s)] done [0.00s].
## creating S4 object ... done [0.00s].
inspect(sort(Rules2, by='lift'))
Apriori 2 generated no rules, keep going.
## Apriori #3
Rules3 <- apriori(trans, parameter = list(supp = 0.005, conf = 0.8, minlen = 3)) #Covers .05% transactions (N=49), 80% correct
## Apriori
##
## Parameter specification:
## confidence minval smax arem aval originalSupport maxtime support minlen
## 0.8 0.1 1 none FALSE TRUE 5 0.005 3
## 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: 49
##
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[125 item(s), 9835 transaction(s)] done [0.00s].
## sorting and recoding items ... [109 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 3 4 5 done [0.00s].
## writing ... [1 rule(s)] done [0.00s].
## creating S4 object ... done [0.00s].
inspect(sort(Rules3, by='lift'))
## lhs rhs support confidence coverage lift count
## [1] {Acer Aspire,
## Dell Desktop,
## ViewSonic Monitor} => {HP Laptop} 0.005287239 0.8125 0.006507372 4.185928 52
Apriori 3 generated 1 rule with a lift = 4
## Apriori #4
Rules4 <- apriori(trans, parameter = list(supp = 0.005, conf = 0.7, minlen = 3)) #Covers .05% transactions (N=49), 70% correct
## Apriori
##
## Parameter specification:
## confidence minval smax arem aval originalSupport maxtime support minlen
## 0.7 0.1 1 none FALSE TRUE 5 0.005 3
## 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: 49
##
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[125 item(s), 9835 transaction(s)] done [0.01s].
## sorting and recoding items ... [109 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 3 4 5 done [0.00s].
## writing ... [3 rule(s)] done [0.00s].
## creating S4 object ... done [0.00s].
inspect(sort(Rules4, by='lift'))
## lhs rhs support confidence coverage lift count
## [1] {Acer Aspire,
## Dell Desktop,
## ViewSonic Monitor} => {HP Laptop} 0.005287239 0.8125000 0.006507372 4.185928 52
## [2] {ASUS 2 Monitor,
## Dell Desktop,
## Lenovo Desktop Computer} => {iMac} 0.005185562 0.7391304 0.007015760 2.885807 51
## [3] {ASUS 2 Monitor,
## ASUS Monitor} => {iMac} 0.005083884 0.7142857 0.007117438 2.788805 50
Apriori 4 generated 3 rules, lift = 2.7-4.1
## Apriori #5
Rules5 <- apriori(trans, parameter = list(supp = 0.005, conf = 0.6, minlen = 3)) #Covers .05% transactions (N=49), 60% correct
## Apriori
##
## Parameter specification:
## confidence minval smax arem aval originalSupport maxtime support minlen
## 0.6 0.1 1 none FALSE TRUE 5 0.005 3
## 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: 49
##
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[125 item(s), 9835 transaction(s)] done [0.00s].
## sorting and recoding items ... [109 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 3 4 5 done [0.00s].
## writing ... [28 rule(s)] done [0.00s].
## creating S4 object ... done [0.00s].
inspect(sort(Rules5, by='lift'))
## lhs rhs support confidence coverage lift count
## [1] {Acer Aspire,
## Dell Desktop,
## ViewSonic Monitor} => {HP Laptop} 0.005287239 0.8125000 0.006507372 4.185928 52
## [2] {Acer Aspire,
## iMac,
## ViewSonic Monitor} => {HP Laptop} 0.006202339 0.6630435 0.009354347 3.415942 61
## [3] {Acer Desktop,
## iMac,
## ViewSonic Monitor} => {HP Laptop} 0.006405694 0.6363636 0.010066090 3.278489 63
## [4] {Dell Desktop,
## Lenovo Desktop Computer,
## ViewSonic Monitor} => {HP Laptop} 0.006202339 0.6224490 0.009964413 3.206802 61
## [5] {Computer Game,
## ViewSonic Monitor} => {HP Laptop} 0.007422471 0.6186441 0.011997966 3.187200 73
## [6] {Computer Game,
## Dell Desktop} => {HP Laptop} 0.005693950 0.6086957 0.009354347 3.135946 56
## [7] {Acer Aspire,
## ViewSonic Monitor} => {HP Laptop} 0.010777834 0.6022727 0.017895272 3.102856 106
## [8] {ASUS 2 Monitor,
## Dell Desktop,
## Lenovo Desktop Computer} => {iMac} 0.005185562 0.7391304 0.007015760 2.885807 51
## [9] {ASUS 2 Monitor,
## ASUS Monitor} => {iMac} 0.005083884 0.7142857 0.007117438 2.788805 50
## [10] {ASUS 2 Monitor,
## Microsoft Office Home and Student 2016} => {iMac} 0.005185562 0.6986301 0.007422471 2.727681 51
## [11] {Dell Desktop,
## Lenovo Desktop Computer,
## ViewSonic Monitor} => {iMac} 0.006914082 0.6938776 0.009964413 2.709125 68
## [12] {Apple Magic Keyboard,
## Dell Desktop,
## Lenovo Desktop Computer} => {iMac} 0.005287239 0.6842105 0.007727504 2.671382 52
## [13] {Apple Magic Keyboard,
## ASUS Monitor} => {iMac} 0.006812405 0.6700000 0.010167768 2.615899 67
## [14] {Acer Desktop,
## HP Laptop,
## ViewSonic Monitor} => {iMac} 0.006405694 0.6562500 0.009761057 2.562215 63
## [15] {Acer Desktop,
## ASUS 2 Monitor} => {iMac} 0.006405694 0.6428571 0.009964413 2.509925 63
## [16] {ASUS Monitor,
## ViewSonic Monitor} => {iMac} 0.008235892 0.6377953 0.012913066 2.490161 81
## [17] {ASUS Monitor,
## Dell Desktop} => {iMac} 0.007930859 0.6341463 0.012506355 2.475915 78
## [18] {Acer Desktop,
## HP Laptop,
## Lenovo Desktop Computer} => {iMac} 0.006304016 0.6326531 0.009964413 2.470085 62
## [19] {ASUS Monitor,
## Lenovo Desktop Computer} => {iMac} 0.009761057 0.6315789 0.015455008 2.465891 96
## [20] {ASUS 2 Monitor,
## Dell Desktop} => {iMac} 0.009049314 0.6312057 0.014336553 2.464433 89
## [21] {Acer Desktop,
## Apple Magic Keyboard} => {iMac} 0.006710727 0.6226415 0.010777834 2.430996 66
## [22] {ASUS Monitor,
## Microsoft Office Home and Student 2016} => {iMac} 0.005998983 0.6145833 0.009761057 2.399534 59
## [23] {Belkin Mouse Pad,
## Microsoft Office Home and Student 2016} => {iMac} 0.005490595 0.6136364 0.008947636 2.395837 54
## [24] {Apple MacBook Pro,
## ASUS Monitor} => {iMac} 0.005388917 0.6022727 0.008947636 2.351470 53
## [25] {HP Laptop,
## HP Monitor,
## Lenovo Desktop Computer} => {iMac} 0.005388917 0.6022727 0.008947636 2.351470 53
## [26] {HP Laptop,
## Lenovo Desktop Computer,
## ViewSonic Monitor} => {iMac} 0.008439248 0.6014493 0.014031520 2.348255 83
## [27] {Acer Desktop,
## ASUS Monitor} => {iMac} 0.005795628 0.6000000 0.009659380 2.342596 57
## [28] {Dell Desktop,
## Microsoft Office Home and Student 2016} => {iMac} 0.009456024 0.6000000 0.015760041 2.342596 93
Apriori 5 generated 28 rules, lift = 2.3-4.8
## Apriori #6
Rules6 <- apriori(trans, parameter = list(supp = 0.006, conf = 0.6, minlen = 3)) #Covers .06% transactions (N=59), 60% correct
## Apriori
##
## Parameter specification:
## confidence minval smax arem aval originalSupport maxtime support minlen
## 0.6 0.1 1 none FALSE TRUE 5 0.006 3
## 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: 59
##
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[125 item(s), 9835 transaction(s)] done [0.00s].
## sorting and recoding items ... [102 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 3 4 5 done [0.00s].
## writing ... [17 rule(s)] done [0.00s].
## creating S4 object ... done [0.00s].
inspect(sort(Rules6, by='lift'))
## lhs rhs support confidence coverage lift count
## [1] {Acer Aspire,
## iMac,
## ViewSonic Monitor} => {HP Laptop} 0.006202339 0.6630435 0.009354347 3.415942 61
## [2] {Acer Desktop,
## iMac,
## ViewSonic Monitor} => {HP Laptop} 0.006405694 0.6363636 0.010066090 3.278489 63
## [3] {Dell Desktop,
## Lenovo Desktop Computer,
## ViewSonic Monitor} => {HP Laptop} 0.006202339 0.6224490 0.009964413 3.206802 61
## [4] {Computer Game,
## ViewSonic Monitor} => {HP Laptop} 0.007422471 0.6186441 0.011997966 3.187200 73
## [5] {Acer Aspire,
## ViewSonic Monitor} => {HP Laptop} 0.010777834 0.6022727 0.017895272 3.102856 106
## [6] {Dell Desktop,
## Lenovo Desktop Computer,
## ViewSonic Monitor} => {iMac} 0.006914082 0.6938776 0.009964413 2.709125 68
## [7] {Apple Magic Keyboard,
## ASUS Monitor} => {iMac} 0.006812405 0.6700000 0.010167768 2.615899 67
## [8] {Acer Desktop,
## HP Laptop,
## ViewSonic Monitor} => {iMac} 0.006405694 0.6562500 0.009761057 2.562215 63
## [9] {Acer Desktop,
## ASUS 2 Monitor} => {iMac} 0.006405694 0.6428571 0.009964413 2.509925 63
## [10] {ASUS Monitor,
## ViewSonic Monitor} => {iMac} 0.008235892 0.6377953 0.012913066 2.490161 81
## [11] {ASUS Monitor,
## Dell Desktop} => {iMac} 0.007930859 0.6341463 0.012506355 2.475915 78
## [12] {Acer Desktop,
## HP Laptop,
## Lenovo Desktop Computer} => {iMac} 0.006304016 0.6326531 0.009964413 2.470085 62
## [13] {ASUS Monitor,
## Lenovo Desktop Computer} => {iMac} 0.009761057 0.6315789 0.015455008 2.465891 96
## [14] {ASUS 2 Monitor,
## Dell Desktop} => {iMac} 0.009049314 0.6312057 0.014336553 2.464433 89
## [15] {Acer Desktop,
## Apple Magic Keyboard} => {iMac} 0.006710727 0.6226415 0.010777834 2.430996 66
## [16] {HP Laptop,
## Lenovo Desktop Computer,
## ViewSonic Monitor} => {iMac} 0.008439248 0.6014493 0.014031520 2.348255 83
## [17] {Dell Desktop,
## Microsoft Office Home and Student 2016} => {iMac} 0.009456024 0.6000000 0.015760041 2.342596 93
Apriori 6 generated 17 rules, lift = 2.3-3.1
## Apriori #7
Rules7 <- apriori(trans, parameter = list(supp = 0.007, conf = 0.6, minlen = 3)) #Covers .07% transactions (N=68), 60% correct
## Apriori
##
## Parameter specification:
## confidence minval smax arem aval originalSupport maxtime support minlen
## 0.6 0.1 1 none FALSE TRUE 5 0.007 3
## 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: 68
##
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[125 item(s), 9835 transaction(s)] done [0.00s].
## sorting and recoding items ... [97 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 3 4 done [0.00s].
## writing ... [8 rule(s)] done [0.00s].
## creating S4 object ... done [0.00s].
inspect(sort(Rules7, by='lift'))
## lhs rhs support confidence coverage lift count
## [1] {Computer Game,
## ViewSonic Monitor} => {HP Laptop} 0.007422471 0.6186441 0.01199797 3.187200 73
## [2] {Acer Aspire,
## ViewSonic Monitor} => {HP Laptop} 0.010777834 0.6022727 0.01789527 3.102856 106
## [3] {ASUS Monitor,
## ViewSonic Monitor} => {iMac} 0.008235892 0.6377953 0.01291307 2.490161 81
## [4] {ASUS Monitor,
## Dell Desktop} => {iMac} 0.007930859 0.6341463 0.01250635 2.475915 78
## [5] {ASUS Monitor,
## Lenovo Desktop Computer} => {iMac} 0.009761057 0.6315789 0.01545501 2.465891 96
## [6] {ASUS 2 Monitor,
## Dell Desktop} => {iMac} 0.009049314 0.6312057 0.01433655 2.464433 89
## [7] {HP Laptop,
## Lenovo Desktop Computer,
## ViewSonic Monitor} => {iMac} 0.008439248 0.6014493 0.01403152 2.348255 83
## [8] {Dell Desktop,
## Microsoft Office Home and Student 2016} => {iMac} 0.009456024 0.6000000 0.01576004 2.342596 93
Apriori 7 generated 8 rules, lift = 2.3-3.1
## Apriori #8
Rules8 <- apriori(trans, parameter = list(supp = 0.008, conf = 0.6, minlen = 3)) #Covers .08% transactions (N=78), 60% correct
## Apriori
##
## Parameter specification:
## confidence minval smax arem aval originalSupport maxtime support minlen
## 0.6 0.1 1 none FALSE TRUE 5 0.008 3
## 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: 78
##
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[125 item(s), 9835 transaction(s)] done [0.00s].
## sorting and recoding items ... [93 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 3 4 done [0.00s].
## writing ... [6 rule(s)] done [0.00s].
## creating S4 object ... done [0.00s].
inspect(sort(Rules8, by='lift'))
## lhs rhs support confidence coverage lift count
## [1] {Acer Aspire,
## ViewSonic Monitor} => {HP Laptop} 0.010777834 0.6022727 0.01789527 3.102856 106
## [2] {ASUS Monitor,
## ViewSonic Monitor} => {iMac} 0.008235892 0.6377953 0.01291307 2.490161 81
## [3] {ASUS Monitor,
## Lenovo Desktop Computer} => {iMac} 0.009761057 0.6315789 0.01545501 2.465891 96
## [4] {ASUS 2 Monitor,
## Dell Desktop} => {iMac} 0.009049314 0.6312057 0.01433655 2.464433 89
## [5] {HP Laptop,
## Lenovo Desktop Computer,
## ViewSonic Monitor} => {iMac} 0.008439248 0.6014493 0.01403152 2.348255 83
## [6] {Dell Desktop,
## Microsoft Office Home and Student 2016} => {iMac} 0.009456024 0.6000000 0.01576004 2.342596 93
Apriori 8 generated 6 rules, lift = 2.3-3.1
## Apriori #9
Rules9 <- apriori(trans, parameter = list(supp = 0.009, conf = 0.6, minlen = 3)) #Covers .09% transactions (N=88), 60% correct
## Apriori
##
## Parameter specification:
## confidence minval smax arem aval originalSupport maxtime support minlen
## 0.6 0.1 1 none FALSE TRUE 5 0.009 3
## 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: 88
##
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[125 item(s), 9835 transaction(s)] done [0.00s].
## sorting and recoding items ... [87 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 3 4 done [0.00s].
## writing ... [4 rule(s)] done [0.00s].
## creating S4 object ... done [0.00s].
inspect(sort(Rules9, by='lift'))
## lhs rhs support confidence coverage lift count
## [1] {Acer Aspire,
## ViewSonic Monitor} => {HP Laptop} 0.010777834 0.6022727 0.01789527 3.102856 106
## [2] {ASUS Monitor,
## Lenovo Desktop Computer} => {iMac} 0.009761057 0.6315789 0.01545501 2.465891 96
## [3] {ASUS 2 Monitor,
## Dell Desktop} => {iMac} 0.009049314 0.6312057 0.01433655 2.464433 89
## [4] {Dell Desktop,
## Microsoft Office Home and Student 2016} => {iMac} 0.009456024 0.6000000 0.01576004 2.342596 93
Apriori 9 generated 6 rules with lift = 1.5-2.2
## Apriori #10
Rules10 <- apriori(trans, parameter = list(supp = 0.01, conf = 0.6, minlen = 3)) #Covers 1% transactions (N=98), 60% correct
## Apriori
##
## Parameter specification:
## confidence minval smax arem aval originalSupport maxtime support minlen
## 0.6 0.1 1 none FALSE TRUE 5 0.01 3
## 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: 98
##
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[125 item(s), 9835 transaction(s)] done [0.00s].
## sorting and recoding items ... [82 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 3 4 done [0.00s].
## writing ... [1 rule(s)] done [0.00s].
## creating S4 object ... done [0.00s].
inspect(sort(Rules10, by='lift'))
## lhs rhs support confidence
## [1] {Acer Aspire,ViewSonic Monitor} => {HP Laptop} 0.01077783 0.6022727
## coverage lift count
## [1] 0.01789527 3.102856 106
Apriori 10 generated 1 rule, lift = 3.1
## Apriori #11
Rules11 <- apriori(trans, parameter = list(supp = 0.01, conf = 0.5, minlen = 3)) ###Covers 1% transactions (N=98), 50% correct
## Apriori
##
## Parameter specification:
## confidence minval smax arem aval originalSupport maxtime support minlen
## 0.5 0.1 1 none FALSE TRUE 5 0.01 3
## 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: 98
##
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[125 item(s), 9835 transaction(s)] done [0.00s].
## sorting and recoding items ... [82 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 3 4 done [0.00s].
## writing ... [19 rule(s)] done [0.00s].
## creating S4 object ... done [0.00s].
inspect(sort(Rules11[1:10], by='lift'))
## lhs rhs support confidence coverage lift count
## [1] {Acer Aspire,
## ViewSonic Monitor} => {HP Laptop} 0.01077783 0.6022727 0.01789527 3.102856 106
## [2] {ASUS 2 Monitor,
## Lenovo Desktop Computer} => {iMac} 0.01087951 0.5911602 0.01840366 2.308083 107
## [3] {Apple Magic Keyboard,
## Dell Desktop} => {iMac} 0.01016777 0.5847953 0.01738688 2.283232 100
## [4] {ASUS Monitor,
## HP Laptop} => {iMac} 0.01179461 0.5829146 0.02023386 2.275889 116
## [5] {ASUS 2 Monitor,
## HP Laptop} => {iMac} 0.01108287 0.5828877 0.01901373 2.275784 109
## [6] {HP Laptop,
## Microsoft Office Home and Student 2016} => {iMac} 0.01291307 0.5521739 0.02338587 2.155868 127
## [7] {Acer Desktop,
## ViewSonic Monitor} => {iMac} 0.01006609 0.5439560 0.01850534 2.123782 99
## [8] {Apple Magic Keyboard,
## Lenovo Desktop Computer} => {iMac} 0.01138790 0.5161290 0.02206406 2.015137 112
## [9] {Apple Magic Keyboard,
## HP Laptop} => {iMac} 0.01474326 0.5105634 0.02887646 1.993406 145
## [10] {HP Laptop,
## HP Monitor} => {iMac} 0.01057448 0.5024155 0.02104728 1.961594 104
Apriori 11 generated 19 total association rules, lift = 1.9-3.1. This appears to be our best rule, because it generated 19 total rules, has a good amount of support (1% frequency), confidence (50% accuracy), and lift of 1.5-3.1 (>1 indicates effectiveness). We will further inspect support, confidence, and lift to confirm.
# inspect support
support11 <- data.frame(inspect(sort(Rules11, by = 'support', decreasing = TRUE))) #Dell desktop and ViewSonic Monitor (#2) had greatest support at 1.5% (n=150 count)
## lhs rhs support confidence coverage lift count
## [1] {HP Laptop,
## Lenovo Desktop Computer} => {iMac} 0.02308083 0.5000000 0.04616167 1.952164 227
## [2] {Dell Desktop,
## Lenovo Desktop Computer} => {iMac} 0.01860702 0.5069252 0.03670564 1.979202 183
## [3] {Acer Desktop,
## HP Laptop} => {iMac} 0.01596340 0.5114007 0.03121505 1.996675 157
## [4] {Lenovo Desktop Computer,
## ViewSonic Monitor} => {iMac} 0.01576004 0.5555556 0.02836807 2.169071 155
## [5] {Dell Desktop,
## ViewSonic Monitor} => {HP Laptop} 0.01525165 0.5747126 0.02653787 2.960869 150
## [6] {Apple Magic Keyboard,
## HP Laptop} => {iMac} 0.01474326 0.5105634 0.02887646 1.993406 145
## [7] {Dell Desktop,
## ViewSonic Monitor} => {iMac} 0.01474326 0.5555556 0.02653787 2.169071 145
## [8] {HP Laptop,
## Microsoft Office Home and Student 2016} => {iMac} 0.01291307 0.5521739 0.02338587 2.155868 127
## [9] {CYBERPOWER Gamer Desktop,
## ViewSonic Monitor} => {iMac} 0.01281139 0.5271967 0.02430097 2.058348 126
## [10] {Acer Desktop,
## Lenovo Desktop Computer} => {iMac} 0.01230300 0.5307018 0.02318251 2.072033 121
## [11] {CYBERPOWER Gamer Desktop,
## ViewSonic Monitor} => {HP Laptop} 0.01220132 0.5020921 0.02430097 2.586734 120
## [12] {ASUS Monitor,
## HP Laptop} => {iMac} 0.01179461 0.5829146 0.02023386 2.275889 116
## [13] {Apple Magic Keyboard,
## Lenovo Desktop Computer} => {iMac} 0.01138790 0.5161290 0.02206406 2.015137 112
## [14] {ASUS 2 Monitor,
## HP Laptop} => {iMac} 0.01108287 0.5828877 0.01901373 2.275784 109
## [15] {ASUS 2 Monitor,
## Lenovo Desktop Computer} => {iMac} 0.01087951 0.5911602 0.01840366 2.308083 107
## [16] {Acer Aspire,
## ViewSonic Monitor} => {HP Laptop} 0.01077783 0.6022727 0.01789527 3.102856 106
## [17] {HP Laptop,
## HP Monitor} => {iMac} 0.01057448 0.5024155 0.02104728 1.961594 104
## [18] {Apple Magic Keyboard,
## Dell Desktop} => {iMac} 0.01016777 0.5847953 0.01738688 2.283232 100
## [19] {Acer Desktop,
## ViewSonic Monitor} => {iMac} 0.01006609 0.5439560 0.01850534 2.123782 99
## data frame with 0 columns and 0 rows
# inspect confidence
confidence11 <- data.frame(inspect(sort(Rules11, by = 'confidence', decreasing = TRUE))) #Acer Aspire and ViewSonic Monitor (#1) had greatest confidence at 60% (although 2nd rule 57%)
## lhs rhs support confidence coverage lift count
## [1] {Acer Aspire,
## ViewSonic Monitor} => {HP Laptop} 0.01077783 0.6022727 0.01789527 3.102856 106
## [2] {ASUS 2 Monitor,
## Lenovo Desktop Computer} => {iMac} 0.01087951 0.5911602 0.01840366 2.308083 107
## [3] {Apple Magic Keyboard,
## Dell Desktop} => {iMac} 0.01016777 0.5847953 0.01738688 2.283232 100
## [4] {ASUS Monitor,
## HP Laptop} => {iMac} 0.01179461 0.5829146 0.02023386 2.275889 116
## [5] {ASUS 2 Monitor,
## HP Laptop} => {iMac} 0.01108287 0.5828877 0.01901373 2.275784 109
## [6] {Dell Desktop,
## ViewSonic Monitor} => {HP Laptop} 0.01525165 0.5747126 0.02653787 2.960869 150
## [7] {Dell Desktop,
## ViewSonic Monitor} => {iMac} 0.01474326 0.5555556 0.02653787 2.169071 145
## [8] {Lenovo Desktop Computer,
## ViewSonic Monitor} => {iMac} 0.01576004 0.5555556 0.02836807 2.169071 155
## [9] {HP Laptop,
## Microsoft Office Home and Student 2016} => {iMac} 0.01291307 0.5521739 0.02338587 2.155868 127
## [10] {Acer Desktop,
## ViewSonic Monitor} => {iMac} 0.01006609 0.5439560 0.01850534 2.123782 99
## [11] {Acer Desktop,
## Lenovo Desktop Computer} => {iMac} 0.01230300 0.5307018 0.02318251 2.072033 121
## [12] {CYBERPOWER Gamer Desktop,
## ViewSonic Monitor} => {iMac} 0.01281139 0.5271967 0.02430097 2.058348 126
## [13] {Apple Magic Keyboard,
## Lenovo Desktop Computer} => {iMac} 0.01138790 0.5161290 0.02206406 2.015137 112
## [14] {Acer Desktop,
## HP Laptop} => {iMac} 0.01596340 0.5114007 0.03121505 1.996675 157
## [15] {Apple Magic Keyboard,
## HP Laptop} => {iMac} 0.01474326 0.5105634 0.02887646 1.993406 145
## [16] {Dell Desktop,
## Lenovo Desktop Computer} => {iMac} 0.01860702 0.5069252 0.03670564 1.979202 183
## [17] {HP Laptop,
## HP Monitor} => {iMac} 0.01057448 0.5024155 0.02104728 1.961594 104
## [18] {CYBERPOWER Gamer Desktop,
## ViewSonic Monitor} => {HP Laptop} 0.01220132 0.5020921 0.02430097 2.586734 120
## [19] {HP Laptop,
## Lenovo Desktop Computer} => {iMac} 0.02308083 0.5000000 0.04616167 1.952164 227
## data frame with 0 columns and 0 rows
# inspect lift
lift11 <- data.frame(inspect(sort(Rules11, by = 'lift', decreasing = TRUE)))
## lhs rhs support confidence coverage lift count
## [1] {Acer Aspire,
## ViewSonic Monitor} => {HP Laptop} 0.01077783 0.6022727 0.01789527 3.102856 106
## [2] {Dell Desktop,
## ViewSonic Monitor} => {HP Laptop} 0.01525165 0.5747126 0.02653787 2.960869 150
## [3] {CYBERPOWER Gamer Desktop,
## ViewSonic Monitor} => {HP Laptop} 0.01220132 0.5020921 0.02430097 2.586734 120
## [4] {ASUS 2 Monitor,
## Lenovo Desktop Computer} => {iMac} 0.01087951 0.5911602 0.01840366 2.308083 107
## [5] {Apple Magic Keyboard,
## Dell Desktop} => {iMac} 0.01016777 0.5847953 0.01738688 2.283232 100
## [6] {ASUS Monitor,
## HP Laptop} => {iMac} 0.01179461 0.5829146 0.02023386 2.275889 116
## [7] {ASUS 2 Monitor,
## HP Laptop} => {iMac} 0.01108287 0.5828877 0.01901373 2.275784 109
## [8] {Dell Desktop,
## ViewSonic Monitor} => {iMac} 0.01474326 0.5555556 0.02653787 2.169071 145
## [9] {Lenovo Desktop Computer,
## ViewSonic Monitor} => {iMac} 0.01576004 0.5555556 0.02836807 2.169071 155
## [10] {HP Laptop,
## Microsoft Office Home and Student 2016} => {iMac} 0.01291307 0.5521739 0.02338587 2.155868 127
## [11] {Acer Desktop,
## ViewSonic Monitor} => {iMac} 0.01006609 0.5439560 0.01850534 2.123782 99
## [12] {Acer Desktop,
## Lenovo Desktop Computer} => {iMac} 0.01230300 0.5307018 0.02318251 2.072033 121
## [13] {CYBERPOWER Gamer Desktop,
## ViewSonic Monitor} => {iMac} 0.01281139 0.5271967 0.02430097 2.058348 126
## [14] {Apple Magic Keyboard,
## Lenovo Desktop Computer} => {iMac} 0.01138790 0.5161290 0.02206406 2.015137 112
## [15] {Acer Desktop,
## HP Laptop} => {iMac} 0.01596340 0.5114007 0.03121505 1.996675 157
## [16] {Apple Magic Keyboard,
## HP Laptop} => {iMac} 0.01474326 0.5105634 0.02887646 1.993406 145
## [17] {Dell Desktop,
## Lenovo Desktop Computer} => {iMac} 0.01860702 0.5069252 0.03670564 1.979202 183
## [18] {HP Laptop,
## HP Monitor} => {iMac} 0.01057448 0.5024155 0.02104728 1.961594 104
## [19] {HP Laptop,
## Lenovo Desktop Computer} => {iMac} 0.02308083 0.5000000 0.04616167 1.952164 227
## data frame with 0 columns and 0 rows
# check quality for rules 11
head(quality(Rules11))
## support confidence coverage lift count
## 1 0.01087951 0.5911602 0.01840366 2.308083 107
## 2 0.01108287 0.5828877 0.01901373 2.275784 109
## 3 0.01179461 0.5829146 0.02023386 2.275889 116
## 4 0.01291307 0.5521739 0.02338587 2.155868 127
## 5 0.01057448 0.5024155 0.02104728 1.961594 104
## 6 0.01016777 0.5847953 0.01738688 2.283232 100
# check for redundancy
inspect(Rules11[is.redundant(Rules11)]) #No redundant rules