Lesson 4 – I am a visual person

So am I. Aren’t we all? Our brain likes it that way.

Let us activate our visual cortex to learn more about Sets. Imagine that you are taking a headcount for high school or college intramurals. You have players who are interested in basketball and players who are interested in soccer. Some of them are interested in participating in both basketball and soccer.

Let us ask them to organize themselves into the basketball and soccer teams. A simple visual of this would look like:

Let us call our basketball players Team Basket (B). Let us call our soccer players Team Soccer (S). Let us call all of them Team Intramural (I).
If Team Intramural is the set of all players interested in participating in sports, Team Basket and Team Soccer are subsets of Team Intramural. All the players in Team Basket and Team Soccer also belong to Team Intramural.

All players who do not play soccer are the complement of Team Soccer. The complement of a set is used to denote everything but the set.

If you want to know how many players are interested in basketball or soccer, you can visualize the entire space that includes Team Basket or Team Soccer. The union of these two teams or set.

If you want to know how many players are interested in basketball and soccer, you can visualize the space that includes players that like to participate in both. The individuals who intersect the two teams.

If you want to take a count of players interested in only one sport but not both, you can visualize a space that includes players that like basketball or players that like soccer, but the players that like both will miss out. This grouping is also called symmetric difference, or the Union – Intersection.

Now imagine another class of students approached you inquiring about field hockey. Let us call this new team, Team Hockey. Team Hockey will become a subset of Team Intramural. However, the players of Team Hockey and the players of Team Soccer do not have anything in common. They are mutually exclusive. They are disjoint. They don’t cross lines — their intersection is 0.

Next week, we will learn how to use real data in RStudio, how to categorize the data into sets, and how to check for intersections, unions, and exclusiveness. In the meantime, try to visualize how our players and teams fit these other Set Properties.

If the union of all sets makes up the entire space, then the sets are collectively exhaustive. Our Team Soccer, Team Basketball, and Team Hockey are collectively Team Intramural (Exhaustive).

I finally think my students got the idea of mutually exclusive and collectively exhaustive sets when I told them that the mid terms are mutually exclusive, but the final exam is collectively exhaustive !! They must have visualized the final.

 

If you find this useful, please like, share and subscribe.
You can also follow me on Twitter @realDevineni for updates on new lessons.

Lesson 3 – The ‘Set’up

We begin our quest with the idea of classifying things. Whether it is Aristotle grouping animals into those living in water and those living on land, or you and me grouping our daily activities into those best done in the morning and those best done in the evening, we are all obsessed with putting things in order – into blocks — groups — SETS.

Math puritans can start with Georg Cantor’s Set Theory. Others can think of SET as a collection of distinct elements.

The fruit basket in your house is a set of fruits consisting of apples, bananas, and grapes – {apple, banana, grapes}.

After work, you can visit a local hangout place where you find a set of people interested in alcohol or food or both.

The vowels in English alphabets are a set {a, e, i, o, u}. The English alphabets are a set {a, b, c, …, x, y, z}.

The outcomes of a coin toss are a set {Head, Tail}.

In the game of Monopoly, you move by the outcomes of the dice. These outcomes are a set of number combinations – {(1,1), (1,2) … (6,6)}.

We all tried rolling a double to get out of jail. Did you know that the odds of getting out of jail by rolling a double are only 16.6%?

There are six possible doubles (see the red background combinations along the diagonal – {(1,1), (2,2), (3,3), (4,4), (5,5), (6,6)}) when you roll two dice. The entire set of possible combinations are 36. The odds are 6/36. Maybe you should have paid the $50 to get out of jail immediately.

Think about sets and possible outcomes in whatever you do this week — Happy President’s Day.

Speaking of Presidents, you should have already imagined a Set of

 

If you find this useful, please like, share and subscribe.
You can also follow me on Twitter @realDevineni for updates on new lessons.

Lesson 2 – R is your companion

  is your companion in this journey through data. It is a software environment that performs the analysis and creates plots for us upon instruction. People who are familiar with computer programming need no introduction. Others who are just getting started with data analysis but are skeptical about computer programming – count the number of 1’s in this data. You will need no more convincing to embrace R.

You can follow these steps to install R and its partner RStudio.

1) Installing R: Use this link https://cran.r-project.org to download and install R on your computer. There are separate download links for Mac, Windows or Linux users.

2) Installing RStudio: Use this link https://www.rstudio.com/products/rstudio/download/ to download and install RStudio on your computer. RStudio will be your environment for coding and visualizations. For RStudio to run, you need to install R; which is why we followed step 1.

Getting started with RStudio
Open RStudio – you should see three panels, the console, environment and history and the files panels.

In the console panel, you will get a copyright message and a “>” prompt. Type 1+2 and hit enter here to check that RStudio is working. You should see the number 3 pop up, which means you are ready to go.

Writing your code
You can use a text editor to give instructions to RStudio (writing your code) and save those instructions (saving your code). In the text editor, you can also write comments to help you remember the steps and make it user-friendly and readable. As a simple example, imagine you want to add 2 numbers, 1 and 2 and you want to write instructions for this. You can type

The first line starts with a #; it is a comment — for people to know that you are adding 2 numbers.

The second line is the actual code or instruction to add 1 and 2.

Remember, a well-written code with clear comments is like having good handwriting.

Opening the text editor
Once you load RStudio, go to “File >> New >> R script”.
You will now see the text editor as the 4th panels on RStudio. You can save the code using the “save” button or by using “Ctrl+S”. Use .R as the extension — “code.R”.

Some simple code
Type the following lines in your code and execute them by clicking the “Run” button on the top right.

Shortcut: You can also place the cursor on the line and hit “Ctrl+Enter” if you are using Windows or “Cmd+Enter” if you are using a Mac. Notice the results of your code in the console.

I have more simple instructions for practice here. Copy them to your code and have fun coding.

We will learn data analysis using RStudio. I will provide more coding tricks as we go along.

 

If you find this useful, please like, share and subscribe.
You can also follow me on Twitter @realDevineni for updates on new lessons.

Lesson 1 – When you see something, say data

Data is the key to understanding patterns, learning about behaviors, testing your theories, and supporting your arguments. It provides an entry point to get a general idea about anything. Make a commitment to yourself that you will think about data when you see something. Here, I provide some common situations to prime the pump.

  • Preferred Coffee: I am writing this post from a coffee shop. My favorite coffee is espresso. I am curious about what others visiting this shop prefer. I can either sit all day and watch what they buy (which will get the manager suspicious) or ask the cashier about how many people purchased espresso or other coffee (tell them it’s a scientific experiment first!).

  • Cars and Tolls: We all waited in line to pay the toll to use the bridge. Friends from the tri-state area are thinking EZPASS. Yes, next time you pass a toll, think about how many cars pass the toll in a day. We can use this data to understand how many people use the bridge and how much revenue it generates.

  • Fitbit: Look at your Fitbit or smartphone health app. Tell me how many hours your sleep on average.

  • You get the point.

 

If you find this useful, please like, share and subscribe.
You can also follow me on Twitter @realDevineni for updates on new lessons.

error

Enjoy this blog? Please spread the word :)