Showing posts with label mode. Show all posts
Showing posts with label mode. Show all posts

Tuesday, January 21, 2014

Lecture notes for 21 Jan. 2014

Variables and values


Each element of a data set has different pieces of information that are collected. For example, let's say this some of the information on a driver's license.

Height: 5'11"
Weight: 175 lbs.
Eyes: Brown
Hair: Black
Date of birth: 7/27/1985

The variables here are Height, Weight, Eyes, Hair and Date of birth. Height, Weight and Date of birth are numerical variables, since the answers are numbers. Eyes and hair are categorical variables, where the answers are not numbers. "175 lbs." is the value associated with the variable Weight.

Continuous variables versus discrete variables

Consider shoe sizes. In the United States, the sizes are ½ apart, so the count goes 5, 5½, 6, 6½, 7, 7½, 8, 8½, etc. What this means is if you give me a show size, I can tell you then next highest and the next lowest. According to Wikipedia, the smallest shoe size is a 1, so for that size there is no next lowest, but the next highest is 1½. A situation like this means the variable is discrete.

Just because two people wear the same size shoe does not mean they have the same size feet. For example, if a man's foot is between 10.92" and 11.08" long, the most comfortable shoe should be a size 9. You cannot say that there is a size of foot that is "the next size up" or "the next size down" from any given foot. No matter how close two feet are in size, if they are not exactly the same, it should be possible to find a foot that is in between the two that are chosen. When that is the case, when there is no defined "next size" either up or down, we say a variable is continuous.

Types of numerical data 
Coded numerical or nominal data: Usually, with numbers there is a meaning we can give to the ideas of "more" and "less". With coded data, we don't necessarily have that. Examples are zip codes, social security numbers and driver's licenses. Finding the average zip code of a group of people is meaningless, as is the mid-range and median. Finding the mode means that is the most popular of the possible zip codes, and that does give valuable information.

Ordinal data: Here, the idea of a > b has meaning, but the distance between units isn't the same. In a ranking system, it's better to be first than it is to be second, but we can't say how much better, and we don't know if the difference between first and second is the same as the distance between second and third.

Often, when we switch from an ordered categorical system like grades (A, B, C, D, F) to the numbers used for grade points (4.0, 3.0, 2.0, 1.0, 0.0), the choice of what numbers to use is arbitrary. Is the distance from an A to B really the same as the distance from a C to a D? Is getting an A in one class and a C in another really the same as getting two Bs, since both would be a 3.0 Grade Point Average (GPA). How about 2 As and a D, which is 3.0, or 3 As and an F? Should all those situations be counted the same way?

The feeling of this instructor is that it should not. Again, like coded data, ordinal data can use some of the measures of center, like median and mode, but average and mid-range do not give useful information.

Interval data: This is the minimum requirement need for mean to make sense, the idea that the distance between two numbers, a - b, has a consistent meaning, like degrees in temperature readings or the number of strokes taken to complete a round of golf. In these system, the number zero does not mean the complete absence of a thing, so it dividing one number by another from the data set doesn't give meaningful information, but taking and average is about adding values together and dividing by the number of values, so an average temperature or an average of the scores in four rounds of golf does produce a useful statistic.

Rational data: This is data where not only a - b means something, but also a/b. The difference between interval and rational data is the meaning of the number zero. If zero indicates the complete lack of a thing, then we can talk about something between twice as much as another thing, or 10% less. A lot of numerical systems of measurement are rational, but not all.


Measures of center
 
Mode
Type of data: any data can be used, but only if there are duplicate values on the list.
Method: Find the most common value. If there is a tie for most common, there can be more than one mode.

Median
Type of data: numerical or ordered categorical
Method: Put the values in order and find the "middle value" which is the value in position (n+1)/2. If n is odd, there is a single median value on the list. If n is even, there are two middle values on the list, and if numerical, take the average of the two. If the data is categorical and the two values aren't the same, the median lies between two categories.

Mean (average)
Type of data: numerical
Method: add up all the numbers and divide by n (or N), the number of things on the list.

Mid-range
Type of data: numerical
Method: (high + low)/2

Let's take the Games Behind data from today's handout and find the mode, median, mean and mid-range. The dash at the top (-) actually signifies 0 games behind.

Data set: 0, 4½, 12, 13, 13, 13, 15½, 16½, 16½, 18½, 18½, 20, 20½, 22½, 26
size of data set: n = 15

Mode: Mode is easy when the data is put in order like this. There are three 13 values, but only two 16½ values and two 18½ values. The mode is 13.

Median: Since n = 15,  the middle position counting from left or right is (15+1)/2 = 16/2 = 8. There is a single number in the eighth position whether counting from the left or the right.

0, 4½, 12, 13, 13, 13, 15½, 16½, 16½, 18½, 18½, 20, 20½, 22½, 26

The first 16½ on the list is the median.

Mean: The total is 230, so the mean is 230/15 = 15.3333..., which we will round to the nearest tenth, so the mean is rounded to 15.3

Mid-range: The biggest number is 26, the smallest number is 0 and (26+0)/2 = 13, so the mid-range is 13.

Wednesday, June 24, 2009

Notes for 6/23

Types of numerical data

Coded numerical: Usually, with numbers there is a meaning we can give to the ideas of "more" and "less". With coded data, we don't necessarily have that. Examples are zip codes, social security numbers and driver's licenses. Finding the average zip code of a group of people is meaningless, as is the mid-range and median. Finding the mode means that is the most popular of the possible zip codes, and that does give valuable information.

Ordinal data: Here, the idea of a > b has meaning, but the distance between units isn't the same. In a ranking system, it's better to be first than it is to be second, but we can't say how much better, and we don't know if the difference between first and second is the same as the distance between second and third.

Often, when we switch from an ordered categorical system like grades (A, B, C, D, F) to the numbers used for grade points (4.0, 3.0, 2.0, 1.0, 0.0), the choice of what numbers to use is arbitrary. Is the distance from an A to B really the same as the distance from a C to a D? Is getting an A in one class and a C in another really the same as getting two Bs, since both would be a 3.0 Grade Point Average (GPA). How about 2 As and a D, which is 3.0, or 3 As and an F? Should all those situations be counted the same way?

The feeling of this instructor is that it should not. Again, like coded data, ordinal data can use some of the measures of center, like median and mode, but average and mid-range do not give useful information.

Interval data: This is the minimum requirement need for mean to make sense, the idea that the distance between two numbers, a - b, has a consistent meaning, like degrees in temperature readings or the number of strokes taken to complete a round of golf. In these system, the number zero does not mean the complete absence of a thing, so it dividing one number by another from the data set doesn't give meaningful information, but taking and average is about adding values together and dividing by the number of values, so an average temperature or an average of the scores in four rounds of golf does produce a useful statistic.

Rational data: This is data where not only a - b means something, but also a/b. The difference between interval and rational data is the meaning of the number zero. If zero indicates the complete lack of a thing, then we can talk about something between twice as much as another thing, or 10% less. A lot of numerical systems of measurement are rational, but not all.


Measures of center

Mode
Type of data: any data can be used, but only if there are duplicate values on the list.
Method: Find the most common value. If there is a tie for most common, there can be more than one mode.

Median
Type of data: numerical or ordered categorical
Method: Put the values in order and find the "middle value" which is the value in position (n+1)/2. If n is odd, there is a single median value on the list. If n is even, there are two middle values on the list, and if numerical, take the average of the two. If the data is categorical and the two values aren't the same, the median lies between two categories.

Mean (average)
Type of data: numerical
Method: add up all the numbers and divide by n (or N), the number of things on the list.

Mid-range
Type of data: numerical
Method: (high + low)/2

Tuesday, January 20, 2009

Class notes for 1/21


Parameters and statistics. Any number associated with a population is a parameter. Any number associated with a sample is a statistic. It's easy to remember because the associated words begin with the same letter. Methods for remembering things are called mnemonics, pronounced with the leading m silent, named for Mneme, the Greek goddess of memory. The first parameter we learned about is the size of the population, which is always represented with N. The first statistic is the size of the sample, represented by the lowercase letter n.

Subscripts. In general math problems, the letters x and y are often used as variable names. Any letter can be used, and sometimes letters from other languages, most notably Greek are used, especially in trigonometry. When a variable represents a quantity in the world, it makes sense mnemonically to use the letter the word begins with. For instance, if we want to represent the height of a flagpole, the letter h could be used. What if the problem has a second object whose height needs to be measured? Maybe we could call that second height a letter near to h in the alphabet, like g or i or j. What if there are three or four or even more things whose heights have to be kept track of? This is a situation where subscripts become handy.

We could call the height of the first thing h1, the second height h2, the third h3 and so on. We pronounce these names "h one", "h two", "h three", etc. and because there are infinitely many positive whole numbers, we don't have to worry about running out. If you have to write this in a text editor that does not let you make subscripts, the standard is to use an underscore, such as h_1, h_2, h_3, etc. There is more about this in the post about text editor workarounds.

What about data that has been left blank in a list? Sometimes when we have a data set, we have several pieces of information about each unit on the list, but some data has been left blank. There are a couple of things we can do.

Option #1: Change the size of the data set. If the variable is numerical, Option #1 is the only option. In the class survey handed out on Wednesday, for example, we have 38 people who responded to questions in Data Set #1, so n = 38. Three students did not give a response to height in inches, so for that information we have no choice but to change n to 35 for that particular variable. We will need to use n (or N in the case of a population) when calculating the mean and median, as shown below.

Option #2: Create a new categorical value. With categorical variables, we can either ignore the blanks, or create a new category called "left blank" or "did not respond" or "none of the above". For instance, when voting, leaving one field blank on a ballot does not invalidate the entire ballot. You can vote for president, but decide not to vote for anyone for city council, and the presidential vote still counts. There have been ballots made from time to time that gave the option of "none of the above", which is like the idea of "left blank".

Mean, median and mode. There are several ways of stating a single number which gives an idea of the central measure of a set of numbers. The most used numbers are mean, median and mode.

Mean. Also known as average, to take the mean of a set of numbers (and this can only be done with numerical values), find the sum of all the numbers and divide by n. If the data set is a population, the mean is represented by the Greek letter mu, with a subscript of the letter of the variable. If the variable is called x, the mean is mux .If the variable is called d, the mean is mud. If the data set is a sample, we put a bar over the letter used for the variable name, like x-bar or d-bar. (In this text editor, there is no easy way to put a bar above a symbol, so I will type x-bar instead.)

Median. First, the numbers must be put in order, either from low to high or high to low. The median is the number "in the middle", which is to say position (n + 1)/2. If n is odd, then this will mean a specific single position. If n is even, then there are two things "in the middle", and the median will be the average of the two things.

Mode. The mode is the most common value, as long as there are any repeated values. If there are no repeats, there is no mode. If there are repeats and there is a tie for most common, there can be more than one mode.

Let's do some examples.

Data set #1: 11, 11, 9, 7, 13, 12, 8, 5, 12, 11, 4, 4, 8, 8, 5, 2
n = 16
Mean: The sum is 130, so the average is 130/16 = 8.125. The standard for rounding to to round the average to one place farther than the data, so this would round to 8.1

Median: First, put the numbers in order.
13, 12, 12, 11, 11, 11, 9, 8, 8, 8, 7, 5, 5, 4, 4, 2

Because there are 16 things on the list the middle position is (16+1)/2 = 8.5, which is to say we will take the average of the 8th and 9th values. Those two values are the first two 8s on the list, which are in bold and underlined. Obviously, the average of 8 and 8 is 8, so 8 is the median.

Mode: Both 11 and 8 show up on the list three times, which is the most, so both 8 and 11 are modes for this variable.

Data set #2: 33, 32, 35, 25, 24, 22, 20, 21, 19, 18, 17, 17, 16, 15, 9
n = 15

Mean: The sum of the numbers is 323, so the mean is 323/15 = 21.5333..., which rounds to 21.5 if we round to the nearest tenth.

Median: First we put the numbers in order.

35, 33, 32, 25, 23, 22, 20, 21, 19, 18, 17, 17, 16, 15, 9

The middle position is (15+1)/2 = 8, so the value in the eighth position, whether we count left to right or right to left is 21.

Mode: There is only one repeated value on the list, and that is 17.

(Data Set #1: Number of wins of the teams in the AFC at season's end.)
(Data Set #2: Number of wins of the teams in the Eastern Conference of the NBA as of the end of play on Jan. 21, 2009.)