Method · Statistics Library

Frequency table

A frequency table lists every level of one variable with its count, its percent of all rows, its valid percent (of the rows with a value, when some are blank) and the cumulative percent.

Topic indexA reference reading outside the guided chapter sequence

Understand the idea

A frequency table answers "how many of each?" for one column. Every different value (a level) gets a line with the number of rows that hold it and what share of the rows that is.

When some rows are blank there are two kinds of share. Percent divides by all rows, blanks included; valid percent divides only by the rows that have a value. If 11 of 344 penguins have no recorded sex, "48.0% are female" (of all) and "49.5% are female" (of those recorded) are both true; say which one you mean.

The cumulative percent adds the valid percents down the table: the share of rows at or below each level. It makes sense only when the levels have an order (years, sizes, ratings), and it changes if you sort the table by count instead of by level.

Practitioner explanation

KernelStats counts every distinct value (whole-number floats print without ".0"), sorts the levels by value (numbers numerically, text alphabetically) or by count (the Sort by option), and reports count, percent of all rows, valid percent when there are blanks, and the cumulative valid percent. Blank cells (missing or empty text) are counted on their own "(blank)" row and never vanish silently.

The numbers equal R's table() for the counts and 100 * cumsum(prop.table(table(x))) for the cumulative percent. More than 200 levels: the 200 most common are shown with a note; the exported code prints them all. A frequency table is descriptive; whether the counts differ from given proportions is the Chi-Square Goodness-of-Fit Test. KernelStats keeps this as its own entry rather than the one-variable case of the crosstab because a student looking for "frequencies" expects one column and no test, and the crosstab form asks for two variables.

When to use it

Consider it when

You want the counts and shares of each level of one variable: frequencies, tabulate, counts by category.

Use caution when

You want to test whether the shares match a hypothesis (use the Chi-Square Goodness-of-Fit Test) or how two variables combine (use the Contingency Table).

Formulas and symbols

Cumulative valid percent

Ck=100∑i≤kniNvalidC_k = 100 \sum_{i \le k} \dfrac{n_i}{N_{valid}}

n_i the count of level i in table order; N_valid the number of rows with a value.

Alternatives

  • Chi-Square Goodness-of-Fit Test (Chi-Square Goodness-of-Fit Test). You want to test the counts against equal shares or given proportions.
  • Contingency Table (Contingency Table (Crosstab)). You have two variables and want their counts and percentages together.

Worked example

Scenario

Penguin sex in 344 birds, 11 not recorded.

Result

female 165 (47.97% of all, 49.55% valid), male 168 (48.84%, 50.45%), blank 11 (3.20%); cumulative 49.55% then 100%.

Interpretation

Among the birds with a recorded sex the split is almost even; 3.2% of the birds have no recorded sex.

Dataset: penguins.csv

Common misconceptions

Misconception

Percent and valid percent are the same thing, so it doesn't matter which one I quote.

Correction

They differ whenever rows are blank: percent divides by all rows, valid percent by the rows with a value. Quote valid percent to describe the answers given, percent when the blanks themselves matter, and say which one you used.

Misconception

One level has the biggest percentage, so it is significantly more common than the others.

Correction

A frequency table describes; it does not test. Whether the shares differ more than chance would allow is a question for the Chi-Square Goodness-of-Fit Test.

References

  1. NIST/SEMATECH e-Handbook of Statistical Methods, §1.3.3.14 Histogram (frequency counts), NIST/SEMATECH (2012).