Create Venn-Diagram in R

A Venn diagram (also sometimes also called primary diagram or set diagram) is a diagram that depicts all possible logical relations between a collection of sets. Certain subjects, such as omitted variable bias, can be best be explained by using a Venn diagram. This post shows how to construct a Venn diagram in R.

The following code produces the Venn diagram used in the post explaining the omitted variable bias.

# start with an empty workspace
rm(list = ls())

# load EulerR pkg

# create sets
fit <- euler(c(Price = 500, Miles = 500, Age= 500, 
               "Price&Miles" = 200,
               "Price&Age" = 200,
               "Miles&Age" = 200))

plot(fit, fill_opacity = 0.3)

The code produces the following Venn diagram:

This entry was posted in Computing and Others and tagged , . Bookmark the permalink.

One Response to Create Venn-Diagram in R

  1. Pingback: Omitted Variable Bias: Understanding the Bias | Economic Theory Blog

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.