StatCrunch logo (home)

< StatCrunch Examples
Creating simple bar plots with summary data
This tutorial covers the steps for creating simple bar plots in StatCrunch with summary data. To begin, load the Categorical Variable In Summary Form data set, which will be used throughout this tutorial. This toy data set contains only two columns of data. The var1 column contains the unique observations of a categorical variable. The Counts column contains the number of times each associated value in the var1 column was observed. In this case, the value b was observed four times, and the value a was observed six times. In StatCrunch jargon, this data set is in summary form. To see an example of constructing bar plots with this data in raw form see Creating simple bar plots with raw data.
Creating a bar plot with frequency on the y-axis
To create a bar plot of this summary data, choose the Graph > Bar Plot > With Summary menu option. Select the var1 column under the Categories in option, select the Counts column under the Counts in option, and click Compute!. The y-axis on the resulting bar plot shown below indicates a frequency of six for the a values and a frequency of four for the b values.
Creating a bar plot with relative frequeny or percent on the y-axis
StatCrunch can also tally the relative frequency (proportion) or percent (of total) associated with each unique value on the y-axis. These items are available under the Type option. For example, in the window containing the resulting bar plot above, choose Options > Edit to reopen the bar plot dialog window. Change the Type option to Percent and click Compute!. The resulting bar plot below shows the percent of the values in the var1 column taking on the value of a (60%) and b (40%).
Changing the ordering of values on the x-axis
Under the Order by option, StatCrunch offers a number of different methods for ordering the values on the x-axis. The default Value Ascending ordering places the a value before the b value in a standard alphabetical a to z ordering. The Value Descending method reverses this ordering. For example, in the window containing the resulting bar plot above, choose Options > Edit to reopen the bar plot dialog window. Change the Order by option to Value Descending and press Compute!. Now the b value is placed before the a value. Note this is also the case if Worksheet order is used since b appears before a in the var1 column. The Count Ascending and Count Descending options can be used to order the values on the x-axis based on the frequencies associated with the values rather than the values themselves. Note the Count Descending option can be used to construct a bar plot in standard Pareto form with decreasing bar heights (frequencies) from left to right. In this example, changing to the Count Descending option will revert the values back to the original ordering because the a value has a higher frequency than the b value in the Counts column.
Combining all values with small relative frequencies into a single Other* category
In situations where a selected column has a few values which occur frequently and a larger number of values that do not occur often, the resulting bar plot can be quite messy with little room to properly label all of the values on the x-axis. In such cases, it is often times advantageous to combine the values with low relative frequencies into a single Other* category using the "Other*" if percent less than option in StatCrunch. To illustrate, in the window containing the resulting bar plot above, choose Options > Edit to reopen the bar plot dialog window. Change the "Other*" if percent less than option to 50 and click Compute!. In this case, the b value is simply relabeled as Other* since the count of b values only makes up 40% of the total. While probably not a great idea for this data set, this change shows how StatCrunch can create a catch all category (Other*) by combining all categories with an associated percent of total below a specified threshold. The Other* category is also always displayed last in the ordering.
Displaying values above the bars
StatCrunch can also be used to display the tallied numerical values above each of the bars. As an example, in the window containing the resulting bar plot above, choose Options > Edit to reopen the bar plot dialog. When the dialog window reappears, turn on the Value above bar option by checking the associated box under Display and click Compute!. The resulting bar plot shown below now displays the percents associated with both the a and b (relabeled as Other*) values. Note a value may be suppressed if there is not enough room to display it above the corresponding bar.

Always Learning