Descriptive Statistics for Categorical Data

Introduction to Descriptive Statistics

  • Descriptive statistics involve techniques for exploring and summarizing variables to describe the information available in a specific sample.

  • This branch of statistics focuses on graphical and numerical methods to summarize data. Generalizing these conclusions to an entire population is reserved for later statistical inference.

  • The analysis begins with research questions involving a single variable of interest. The appropriate descriptive techniques differ based on whether the variable is categorical or numerical.

  • Relationships between variables are also explored within a sample, where the type of variables (categorical or numerical) dictates which techniques are suitable.

Considering Categorical Data

  • Categorical data is analyzed using tables and basic tools. This analysis often utilizes the email data set, which consists of information on 39213921 emails. A smaller subsample called the email50 data set is also used for specific illustrations.

Frequency Tables and Bar Plots

  • Frequency Tables: A frequency table displays the number of times each particular outcome occurs in a data set.

    • Absolute Frequency: This refers to the specific count of each outcome.

    • Relative Frequency: This is obtained by dividing the absolute frequency by the total sample size nn. Relative frequencies can be expressed as proportions or percentages.

    • Mode: The mode is defined as the outcome that occurs most frequently in the data set.

  • Example: The number Variable: A frequency table for the number variable (based on the email data set where n=3921n = 3921) demonstrates these concepts:

    • Outcome: none: Absolute frequency = 549549; Relative frequency = 0.1400.140.

    • Outcome: small: Absolute frequency = 28272827; Relative frequency = 0.7210.721.

    • Outcome: big: Absolute frequency = 545545; Relative frequency = 0.1390.139.

    • Total: Absolute frequency = 39213921; Relative frequency = 11.

    • For the outcome "none", the relative frequency is calculated as 5493921=0.140\frac{549}{3921} = 0.140.

    • The mode for this data set is the outcome "small".

  • Bar Plots: These are standard graphical representations for single categorical variables.

    • Plots can be based on counts (absolute frequency) or proportions (relative frequency).

    • In a bar plot of proportions, the y-axis indicates the proportion of observations falling into each category level.

  • Pie Charts: While common, pie charts are generally less useful for data analysis than bar plots.

    • Comparing the sizes of groups is more difficult in a pie chart, particularly when categories have very similar counts.

    • In the number variable example, the categories "none" (549549) and "big" (545545) are so similar in size that they are nearly indistinguishable in both pie charts and bar plots.

Cumulative Frequencies for Ordinal Variables

  • Cumulative frequencies and cumulative percentages are applicable to ordinal variables, which have a natural ordering.

  • Cumulative Frequency: This is the total of the absolute frequencies for all outcomes at or below a specific outcome.

  • Example 2.1: Number of Characters in email50: This example uses a new ordinal variable num_char_ord derived from the character count in the email50 data set:

    • Category 1 (≤10000\le 10000): Frequency = 3131; Cumulative Frequency = 3131; Percentage = 0.620.62; Cumulative Percentage = 0.620.62.

    • Category 2 (10000,2000010000, 20000]: Frequency = 88; Cumulative Frequency = 3939; Percentage = 0.160.16; Cumulative Percentage = 0.780.78.

    • Category 3 (20000,3000020000, 30000]: Frequency = 88; Cumulative Frequency = 4747; Percentage = 0.160.16; Cumulative Percentage = 0.940.94.

    • Category 4 (>30000> 30000): Frequency = 33; Cumulative Frequency = 5050; Percentage = 0.060.06; Cumulative Percentage = 11.

  • 100% Stacked Bar Plots: This graphical display represents ordinal information by stacking categories. The cumulative percentages can be read directly from the y-axis of the plot.

  • Distribution Information: Cumulative percentages and standard percentages provide identical information regarding the distribution of outcomes. If one set is known for all outcomes, the other can be derived.

Mathematical Notation for Categorical Data

  • Outcomes: Possible outcomes of a categorical variable are denoted as m1,…,mkm_1, \dots, m_k.

  • Frequencies: The absolute frequencies for these outcomes are denoted as n1,…,nkn_1, \dots, n_k.

  • Sample Size: The total sample size nn is the sum of all frequencies:     n=n1+⋯+nkn = n_1 + \dots + n_k

  • Sample Proportions (Relative Frequencies): These are denoted as p^1,…,p^k\hat{p}_1, \dots, \hat{p}_k, where:     p^i=nin\hat{p}_i = \frac{n_i}{n}

  • Cumulative Proportions: For ordinal variables, cumulative proportions are denoted as F1,…,FkF_1, \dots, F_k. The cumulative proportion for the jj-th category is defined as:     Fj=p^1+⋯+p^jF_j = \hat{p}_1 + \dots + \hat{p}_j