# What summary statistics to use with categorical or qualitative variables?

Just to clarify, when I mean summary statistics, I refer to the Mean, Median Quartile ranges, Variance, Standard Deviation.

When summarising a univariate which is categorical or qualitative, considering both Nominal and Ordinal cases, does it make sense to find its mean, median, quartile ranges, variance, and standard deviation?

If so is it different than if you were summarising a continuous variable, and how?

• I barely see any difference between categorical and qualitative variable, except one of terminology. Anyway, that would be very difficult to compute anything like mean or SD on a nominal variable (e.g., hair color). Maybe you are thinking of categorical variables with ordered levels?
– chl
Commented Jul 23, 2012 at 7:57
• Nope, if the categorical data has an order or ranked levels they are said to be Ordinal according to this website: [stats.gla.ac.uk/steps/glossary/presenting_data.html#orddat], and it says "You can count and order, but not measure, ordinal data" Commented Jul 23, 2012 at 9:02
• But am I wrong? Commented Jul 23, 2012 at 12:44

In general, the answer is no. However, one could argue that you can take the median of ordinal data, but you will, of course, have a category as the median, not a number. The median divides the data equally: Half above, half below. Ordinal data depends only on order.

Further, in some cases, the ordinality can be made into rough interval level data. This is true when the ordinal data are grouped (e.g. questions about income are often asked this way). In this case, you can find a precise median, and you may be able to approximate the other values, especially if the lower and upper bounds are specified: You can assume some distribution (e.g. uniform) within each category. Another case of ordinal data that can be made interval is when the levels are given numeric equivalents. For example: Never (0%), sometimes (10-30%), about half the time (50%) and so on.

To (once again) quote David Cox:

There are no routine statistical questions, only questionable statistical routines

• You provide good related information but I think in response to chl question, the OP made it clear that he is talking about categorical data that is not ordinal. So your response is really not an answwer but I am not one who would give a downvote. But I do think you should change it to a comment. Commented Jul 23, 2012 at 11:34
• No, I won't downvote the answer as I do think it has added some value to my limited understanding. I should have made it clear in my description that I am considering both Ordinal and Nominal Summary statistics, so the fault is mine. Commented Jul 23, 2012 at 12:41

As has been mentioned, means, SDs and hinge points are not meaningful for categorical data. Hinge points (e.g., median and quartiles) may be meaningful for ordinal data. Your title also asks what summary statistics should be used to describe categorical data. It is standard to characterize categorical data by counts and percentages. (You may also want to include a 95% confidence interval around the percentages.) For example, if your data were:

"Hispanic"         "Hispanic"        "White"             "White"
"White"            "White"           "African American"  "Hispanic"
"White"            "White"           "White"             "other"
"White"            "White"           "White"             "African American"
"Asian"


You could summarize them like so:

White             10 (59%)
African American   2 (12%)
Hispanic           3 (18%)
Asian              1 ( 6%)
other              1 ( 6%)


If you have nominal variables there is no ordering or distance function. So how could you define any of the summary statistics that you mention? I don't think you can. Quartiles and range at least require ordering and means and variance require numerical data. I think bar graphs and pie chart are typical examples of the proper ways to summarize qualitative variables that are not ordinal.

• @PeterFlom My point was not to list all the possiblr graphical procedures for summarizing qualitative data. I really want to emphasize that it is really proportion that can be compared and the way the proportions are distributed across the categories. For visually recognizing differences in proportions I think bar charts are easier to visualize than pie charts but they are just two popular ways to summarize categorical data. I don't want to say they are the best as I am not familiar with all the available methods. Commented Jul 23, 2012 at 11:25
• They are certainly popular! But I think it's part of our responsibility, as experts in the field, to make pie charts less popular. Commented Jul 23, 2012 at 11:31
• Cleveland showed, first, that people are worse at perceiving angular measurement than linear distance. Second, that changing the colors in a pie chart changed people's perceptions of the size of the slices. Third, that rotating the pie chart changed people's perceptions of the size of the slices. Fourth that people had trouble ordering the slices from largest to smallest unless they were very different sized. Cleveland dot plots avoid all these. Commented Jul 24, 2012 at 10:21
• @Michael "A table is nearly always better than a dumb pie chart; the only worse design than a pie chart is several of them ... pie charts should never be used."--Tufte. "Data that can be shown by pie charts always can be shown by a dot chart. ... in the 1920's a battle raged on the pages of JASA about the relative merits of pie charts and divided bar charts ... both camps lose because other graphs perform far better than either divided bar charts or pie charts."--Cleveland. As you know, Cleveland is not prescriptive: this is as strong as he gets about anything.
– whuber
Commented Jul 24, 2012 at 19:43
• BTW, @Michael, I do agree with you and the arguments you are making in this thread (which I find convincing and well presented), but as a moderator I have to convey strong objections voiced by community members concerning the "tone of voice" you are adopting. Please follow the site's etiquette: stick to the subject and don't attack others. Don't even write stuff that might sound like an attack, even in jest. Of course the same admonition extends to everybody.
– whuber
Commented Jul 24, 2012 at 19:46

Mode still works! Is that not an important summary statistic? (What's the most common category?) I think the median suggestion has little to no value as a statistic, but the mode does.

Also count distinct would be valuable. (How many categories do you have?)

You might create ratios, like (most common category) / (least common category) or (#1 most common category) / (#2 most common category). Also (most common category) / (all other categories), like the 80/20 rule.

You can also assign numbers to your categories and go nuts with all the usual statistics. AA=1, Hisp=2, etc. Now you can compute mean, median, mode, SD, etc.

I do appreciate the other answers, but it seems to me that some topological background would give a much-needed structure to the responses.

# Definitions

• categorical variable is one whose domain contains elements, but there's no known relationship between them (thus we have only categories). Examples, depend on the context, but I'd say in the general case, it is difficult to compare days of the week: is Monday before Sunday, if so, what about next Monday? Maybe an easier, but less used example are pieces of clothes: without providing some context that would make sense of an order, it is difficult to say whether trousers come before jumpers or vice versa.

• ordinal variable is one that has a total order defined over the domain, i.e. for every two elements of the domain, we can tell that either they are identical, or one is bigger than the other. A Likert-scale is a good example of a definition of an ordinal variable. "somewhat agree" is definitely closer to "strongly agree" than "disagree".

• interval variable is one, whose domain defines distances between elements (a metric), thus allowing us to define intervals.

# Domain examples

As the most common set that we use, natural and real numbers have standard total order and metrics. This is why we need to be careful when we assign numbers to our categories. If we are not careful to disregard order and distance, we practically convert our categorical data in interval data. When one uses a machine learning algorithm without knowing how it works, one risks making such assumptions unwillingly, thus potentially invalidating one's own results. For example, most popular deep learning algorithms work with real numbers taking advantage of their interval and continuous properties. Another example, think of 5-point Likert scales, and how the analysis we apply on them assumes that the distance between strongly agree and agree is the same as disagree and neither agree nor disagree. Hard to make a case for such a relationship.

Another set that we often work with is strings. There are a number of string similarity metrics that come in handy when working with strings. However, these are not always useful. For example, for addresses, John Smith Street and John Smith Road are quite close in terms of string similarity, but obviously represent two different entities that could be miles apart.

# Summary statistics

Ok, now let's see how some summary statistics fit in this. Since statistics works with numbers, its functions are well defined over intervals. But let's see examples on whether/how we could generalise them to categorical or ordinal data:

• mode - both when working with categorical and ordinal data, we can tell which element is most frequently used. So we have this. Then we can also derive all the other measures that @Maddenker lists in their answer. @gung's confidence interval could also be useful.
• median - as @peter-flom says, as long as you have an order, you can derive your median.
• mean, but also standard deviation, percentiles, etc. - you get these only with interval data, due to the need for a distance metric.

# Example of data contextuality

At the end, I want to stress again that the order and metrics you define on your data are very contextual. This should be obvious by now, but let me give you a last example: when working with geographical locations, we have lots of different way to approach them:

• if we are interested in the distance between them, we can work with their geolocation, which basically gives us a two-dimensional numerical space, thus interval.
• if we are interested in their part of relationship, we can define a total order (e.g. a street is part of a city, two cities are equal, a continent contains a country)
• if we are interested in whether two strings represent the same address, we could work with some string distance that would tolerate spelling mistakes and swapping positions of words, but make sure to distinguish different terms and names. This is not an easy thing, but just to make the case.
• There are plenty of other use cases, that all of us encounter daily, where none of this makes sense. In some of them there's nothing more to do than treat the addresses as just different categories, in others it comes down to very smart data modelling and preprocessing.