Anonymous
Anonymous

Reputation: 25

Graph plot interpretation for market basket analysis

I'm new to market basket analysis and was able to make it until this part. However, can someone please help me understanding the interpretation of this graph?

Background : These are some unique drg codes and wanted to understand which code is most likely to go with other drg codes.

    library(ggplot2)
plot(subrules2, method = "graph", 
  control = list(
    edges = ggraph::geom_edge_link(
      end_cap = ggraph::circle(4, "mm"),
      start_cap = ggraph::circle(4, "mm"),
      color = "black",
      arrow = arrow(length = unit(2, "mm"), angle = 20, type = "closed"),
      alpha = .2
    ),
    nodes = ggraph::geom_node_point(aes_string(size = "support", color = "lift")),
    nodetext = ggraph::geom_node_label(aes_string(label = "label"), alpha = .8, repel = TRUE)
  ),
  limit = 10
  ) + 
  scale_color_gradient(low = "yellow", high = "red") + 
  scale_size(range = c(2, 10)) 

enter image description here

Upvotes: 0

Views: 201

Answers (1)

Michael Hahsler
Michael Hahsler

Reputation: 3075

This is from the manual page of arulesViz:

"graph" Represents the rules (or itemsets) as a graph with items as labeled vertices, and rules (or itemsets) represented as vertices connected to items using arrows. For rules, the LHS items are connected with arrows pointing to the vertex representing the rule, and the RHS has an arrow pointing to the item.

This is, unfortunately, not the best description. Basically, the colored bubbles are the rules where support is shown as size and lift using color. The boxes with numbers are items connected to the rules with arrows. Most of the code just changes the presentation.

You could use

plot(subrules2, method = "graph", limit = 10)

To show the 10 rules with the highest lift.

Upvotes: 0

Related Questions