The graph for quantitative data looks similar to a bar graph, except there are some major differences. First, in a bar graph the categories can be put in any order on the horizontal axis. There is no set order for these data values. You can’t say how the data is distributed based on the shape, since the shape can change just by putting the categories in different orders. With quantitative data, the data are in specific orders, since you are dealing with numbers. With quantitative data, you can talk about a distribution, since the shape only changes a little bit depending on how many categories you set up. This is called a frequency distribution. This leads to the second difference from bar graphs. In a bar graph, the categories that you made in the frequency table were determined by you. In quantitative data, the categories are numerical categories, and the numbers are determined by how many categories (or what are called classes) you choose. If two people have the same number of categories, then they will have the same frequency distribution. Whereas in qualitative data, there can be many different categories depending on the point of view of the author. The third difference is that the categories touch with quantitative data, and there will be no gaps in the graph. The reason that bar graphs have gaps is to show that the categories do not continue on, like they do in quantitative data. Since the graph for quantitative data is different from qualitative data, it is given a new name. The name of the graph is a histogram. To create a histogram, you must first create the frequency distribution. The idea of a frequency distribution is to take the interval that the data spans and divide it up into equal subintervals called classes.
Summary of the Steps Involved in Making a Frequency Distribution
Note The above description is for data values that are whole numbers. If you data value has decimal places, then your class width should be rounded up to the nearest value with the same number of decimal places as the original data. In addition, your class boundaries should have one more decimal place than the original data. As an example, if your data have one decimal place, then the class width would have one decimal place, and the class boundaries are formed by adding and subtracting 0.05 from each class limit.
Example \(\PageIndex{1}\) creating a frequency table Example \(\PageIndex{1}\) contains the amount of rent paid every month for 24 students from a statistics course. Make a relative frequency distribution using 7 classes.
Solution
Make sure the total of the frequencies is the same as the number of data points. R command for a frequency distribution: To create a frequency distribution: summary(variable) – so you can find out the minimum and maximum. breaks = seq(min, number above max, by = class width) breaks – so you can see the breaks that R made. variable.cut=cut(variable, breaks, right=FALSE) – this will cut up the data into the classes. variable.freq=table(variable.cut) – this will create the frequency table. variable.freq – this will display the frequency table. For the data in Example \(\PageIndex{1}\), the R command would be: rent<-c(1500, 1350, 350, 1200, 850, 900, 1500, 1150, 1500, 900, 1400, 1100, 1250, 600, 610, 960, 890, 1325, 900, 800, 2550, 495, 1200, 690) summary(rent) Output: \(\begin{array}{cccccc}{\text{Min} }&{1\text{st Qu.}}& {\text{Median}} & {\text{Mean}} & {3\text{rd Qu.}} & {\text{Max}} \\ {350} & {837.5} & {1030 .0} & {1082.0} & {1331.0} & {2550 .0} \end{array}\) breaks=seq(350, 3000, by = 315) Output: [1] 350 665 980 1295 1610 1925 2240 2555 2870 These are your lower limits of the frequency distribution. You can now write your own table. rent.cut=cut(rent, breaks, right=FALSE) Output: \(\begin{array}{cccccccc}{[350,665)} & {[665,980)} & {[980,1.3 e+03)} & {[1.3e+03, 1.61e+03)} & {[1.61e+03, 1.92e+03)} & {[1.92e+03, 2.24e+03)} & {[2.24e+03, 2.56e+03)} & {[2.56e+03, 2.87e+03)} \\ {4} & {8} & {5} & {6}& {0} & {0} & {1} & {0}\end{array}\) It is difficult to determine the basic shape of the distribution by looking at the frequency distribution. It would be easier to look at a graph. The graph of a frequency distribution for quantitative data is called a frequency histogram or just histogram for short.
Definition \(\PageIndex{1}\): Histogram A Histogram is a graph of the frequencies on the vertical axis and the class boundaries on the horizontal axis. Rectangles where the height is the frequency and the width is the class width are drawn for each class.
Example \(\PageIndex{2}\: Drawing a Histogram Draw a histogram for the distribution from Example \(\PageIndex{1}\). Solution The class boundaries are plotted on the horizontal axis and the frequencies are plotted on the vertical axis. You can plot the midpoints of the classes instead of the class boundaries. Graph 2.2.1 was created using the midpoints because it was easier to do with the software that created the graph. On R, the command is hist(variable, col="type in what color you want", breaks, main="type the title you want", xlab="type the label you want for the horizontal axis", For this example, the command in R would be (assuming you created a frequency distribution in R as described previously): hist(rent, col="blue", breaks, right=FALSE, main="Monthly Rent Paid by Students", ylim=c(0,8) xlab="Monthly Rent ($)") Figure \(\PageIndex{1}\): Histogram for Monthly RentIf no frequency distribution was created before the histogram, then the command would be: hist(variable, col="type in what color you want", number of classes, main="type the title you want", xlab="type the label you want for the horizontal axis") – produces histogram with specified color and number of classes (though the number of classes is an estimate and R will create the number of classes near this value). For this example, the R command without a frequency distribution created first would be: hist(rent, col="blue", 7, main="Monthly Rent Paid by Students", xlab="Monthly Rent ($)") Notice the graph has the axes labeled, the tick marks are labeled on each axis, and there is a title. Reviewing the graph you can see that most of the students pay around $750 per month for rent, with about $1500 being the other common value. You can see from the graph, that most students pay between $600 and $1600 per month for rent. Of course, these values are just estimates from the graph. There is a large gap between the $1500 class and the highest data value. This seems to say that one student is paying a great deal more than everyone else. This value could be considered an outlier. An outlier is a data value that is far from the rest of the values. It may be an unusual value or a mistake. It is a data value that should be investigated. In this case, the student lives in a very expensive part of town, thus the value is not a mistake, and is just very unusual. There are other aspects that can be discussed, but first some other concepts need to be introduced. Frequencies are helpful, but understanding the relative size each class is to the total is also useful. To find this you can divide the frequency by the total to create a relative frequency. If you have the relative frequencies for all of the classes, then you have a relative frequency distribution.
Definition \(\PageIndex{2}\) Relative Frequency Distribution A variation on a frequency distribution is a relative frequency distribution. Instead of giving the frequencies for each class, the relative frequencies are calculated. Relative frequency \(=\dfrac{\text { frequency }}{\# \text { of data points }}\) This gives you percentages of data that fall in each class.
Example \(\PageIndex{3}\) creating a relative frequency table Find the relative frequency for the grade data. Solution From Example \(\PageIndex{1}\), the frequency distribution is reproduced in Example \(\PageIndex{2}\).
Divide each frequency by the number of data points. \(\dfrac{4}{24}=0.17, \dfrac{8}{24}=0.33, \dfrac{5}{24}=0.21, \rightleftharpoons\)
The relative frequencies should add up to 1 or 100%. (This might be off a little due to rounding errors.) The graph of the relative frequency is known as a relative frequency histogram. It looks identical to the frequency histogram, but the vertical axis is relative frequency instead of just frequencies.
Example \(\PageIndex{4}\) drawing a relative frequency histogram Draw a relative frequency histogram for the grade distribution from Example \(\PageIndex{1}\). Solution The class boundaries are plotted on the horizontal axis and the relative frequencies are plotted on the vertical axis. (This is not easy to do in R, so use another technology to graph a relative frequency histogram.) Figure \(\PageIndex{2}\): Relative Frequency Histogram for Monthly RentNotice the shape is the same as the frequency distribution. Another useful piece of information is how many data points fall below a particular class boundary. As an example, a teacher may want to know how many students received below an 80%, a doctor may want to know how many adults have cholesterol below 160, or a manager may want to know how many stores gross less than $2000 per day. This is known as a cumulative frequency. If you want to know what percent of the data falls below a certain class boundary, then this would be a cumulative relative frequency. For cumulative frequencies you are finding how many data values fall below the upper class limit. To create a cumulative frequency distribution, count the number of data points that are below the upper class boundary, starting with the first class and working up to the top class. The last upper class boundary should have all of the data points below it. Also include the number of data points below the lowest class boundary, which is zero.
Example \(\PageIndex{5}\) creating a cumulative frequency distribution Create a cumulative frequency distribution for the data in Example \(\PageIndex{1}\). Solution The frequency distribution for the data is in Example \(\PageIndex{2}\).
Now ask yourself how many data points fall below each class boundary. Below 349.5, there are 0 data points. Below 664.5 there are 4 data points, below 979.5, there are 4 + 8 = 12 data points, below 1294.5 there are 4 + 8 + 5 = 17 data points, and continue this process until you reach the upper class boundary. This is summarized in Example \(\PageIndex{4}\). To produce cumulative frequencies in R, you need to have performed the commands for the frequency distribution. Once you have complete that, then use variable.cumfreq=cumsum(variable.freq) – creates the cumulative frequencies for the variable cumfreq0=c(0,variable.cumfreq) – creates a cumulative frequency table for the variable. cumfreq0 – displays the cumulative frequency table. For this example the command would be: rent.cumfreq=cumsum(rent.freq) cumfreq0=c(0,rent.cumfreq) cumfreq0 Output: \(\begin{array}{ccccccccc}{}&{[350,665)} & {[665,980)} & {[980,1.3e+03)}& {[1.3e+03, 1.61e+03)}&{[1.61e+03, 1.92e+03)}&{[1.92e+03,2.24e+03)}&{[2.24e+03, 2.56e+03)}&{[2.56e+03, 2.87e+03)} \\ {0}&{4} & {12}&{17}&{23}&{23}&{23}&{24}&{24}\end{array}\) Now type this into a table. See Example \(\PageIndex{4}\).
Again, it is hard to look at the data the way it is. A graph would be useful. The graph for cumulative frequency is called an ogive (o-jive). To create an ogive, first create a scale on both the horizontal and vertical axes that will fit the data. Then plot the points of the class upper class boundary versus the cumulative frequency. Make sure you include the point with the lowest class boundary and the 0 cumulative frequency. Then just connect the dots.
Example \(\PageIndex{6}\) drawing an ogive Draw an ogive for the data in Example \(\PageIndex{1}\). Solution In R, the commands would be: plot(breaks,cumfreq0, main="title you want to use", xlab="label you want to use", ylab="label you want to use", ylim=c(0, number above maximum cumulative frequency) – plots the ogive lines(breaks,cumfreq0) – connects the dots on the ogive For this example, the commands would be: Plot(breaks,cumfreq0, main=”Cumulative Frequency for Monthly Rent”, xlab=”Monthly Rent ($)”, ylab=”Cumulative Frequency”, ylim=c(0,25)) lines(breaks,cumfreq0) Figure \(\PageIndex{3}\): Ogive for Monthly RentThe usefulness of a ogive is to allow the reader to find out how many students pay less than a certain value, and also what amount of monthly rent is paid by a certain number of students. As an example, suppose you want to know how many students pay less than $1500 a month in rent, then you can go up from the $1500 until you hit the graph and then you go over to the cumulative frequency axes to see what value corresponds to this value. It appears that around 20 students pay less than $1500. (See Graph 2.2.4.) Figure \(\PageIndex{4}\): Ogive for Monthly Rent with ExampleAlso, if you want to know the amount that 15 students pay less than, then you start at 15 on the vertical axis and then go over to the graph and down to the horizontal axis where the line intersects the graph. You can see that 15 students pay less than about $1200 a month. (See Graph 2.2.5.) Figure \(\PageIndex{5}\): Ogive for Monthly Rent with ExampleIf you graph the cumulative relative frequency then you can find out what percentage is below a certain number instead of just the number of people below a certain value. Shapes of the distribution: When you look at a distribution, look at the basic shape. There are some basic shapes that are seen in histograms. Realize though that some distributions have no shape. The common shapes are symmetric, skewed, and uniform. Another interest is how many peaks a graph may have. This is known as modal. Symmetric means that you can fold the graph in half down the middle and the two sides will line up. You can think of the two sides as being mirror images of each other. Skewed means one “tail” of the graph is longer than the other. The graph is skewed in the direction of the longer tail (backwards from what you would expect). A uniform graph has all the bars the same height. Modal refers to the number of peaks. Unimodal has one peak and bimodal has two peaks. Usually if a graph has more than two peaks, the modal information is not longer of interest. Other important features to consider are gaps between bars, a repetitive pattern, how spread out is the data, and where the center of the graph is.
This graph is roughly symmetric and unimodal: FigureThis graph is symmetric and bimodal: FigureThis graph is skewed to the right: FigureThis graph is skewed to the left and has a gap: FigureThis graph is uniform since all the bars are the same height: Figure
Example \(\PageIndex{7}\) creating a frequency distribution, histogram, and ogive The following data represents the percent change in tuition levels at public, fouryear colleges (inflation adjusted) from 2008 to 2013 (Weissmann, 2013). Create a frequency distribution, histogram, and ogive for the data.
Solution
Make sure the total of the frequencies is the same as the number of data points. Figure \(\PageIndex{11}\): Histogram for Tuition Levels at Public, Four-Year CollegesThis graph is skewed right, with no gaps. This says that most percent increases in tuition were around 16.55%, with very few states having a percent increase greater than 45.35%. Figure \(\PageIndex{12}\): Ogive for Tuition Levels at Public, Four-Year CollegesLooking at the ogive, you can see that 30 states had a percent change in tuition levels of about 25% or less. There are occasions where the class limits in the frequency distribution are predetermined. Example \(\PageIndex{8}\) demonstrates this situation.
Example \(\PageIndex{8}\) creating a frequency distribution and histogram The following are the percentage grades of 25 students from a statistics course. Make a frequency distribution and histogram.
Solution Since this data is percent grades, it makes more sense to make the classes in multiples of 10, since grades are usually 90 to 100%, 80 to 90%, and so forth. It is easier to not use the class boundaries, but instead use the class limits and think of the upper class limit being up to but not including the next classes lower limit. As an example the class 80 – 90 means a grade of 80% up to but not including a 90%. A student with an 89.9% would be in the 80-90 class.
It appears that most of the students had between 60 to 90%. This graph looks somewhat symmetric and also bimodal. The same number of students earned between 60 to 70% and 80 to 90%. There are other types of graphs for quantitative data. They will be explored in the next section.
Exercise \(\PageIndex{1}\)
See solutions |