Describing Behavior with Visualizations: Categorical and Continuous Data

Categorical Data Visualisations: Pie Charts and Bar Graphs

  • Visualising data provides a pictorial representation of behaviour alongside numerical data.

  • Data is split into two primary types for visualisation: categorical and continuous.

Pie Charts

  • Definition: A pie chart is a circular graphic used to visualise categorical data. The circle (the pie) is divided into slices (areas), where the area of each slice is proportional to the percentage or count of observations in that category.

  • Example Case Study: In a fictitious study of 150150 people regarding their favourite season:

    • Categories: Spring, Summer, Winter, and Autumn.

    • Observation: The majority of participants favoured autumn, which was represented by the largest slice in the pie chart.

    • Legend: Used to distinguish categories via colour-coding.

  • Advantages: They provide an excellent visual summary that can be interpreted quickly and easily for simple datasets.

  • Pitfalls and Limitations:

    • Category Limit: Pie charts become confusing and difficult to read if there are too many categories. It is recommended to avoid using them if there are more than 1010 categories.

    • Shakespeare Example: A pie chart of causes of death in Shakespearean plays shows stabbing accounts for more than 5050 % of deaths. However, because there are many minor categories, it is difficult to distinguish the proportions of the smaller slices.

    • Small Percentages: When percentages are tiny, they are visually indistinguishable. For instance, a 2007 Wikipedia graph of the US federal budget shows that while large categories are clear, smaller spending areas are nearly impossible to differentiate.

  • Optimal Use: Best used for a small number of categories with relatively large percentage differences.

Bar Charts

  • Structure:

    • X-axis (Horizontal): Represents the categories (e.g., Spring, Summer, Winter, Autumn).

    • Y-axis (Vertical): Represents the frequency (count) or a summary statistic.

  • Function: Users compare the height of the bars to determine differences across categories.

  • Types of Y-axis Values:

    • Raw Values: Simple counts or votes (e.g., how many people voted for each season).

    • Summary Statistics: Values describing the overall behaviour of a group, such as the mean (μ\mu) or median.

  • Athletic Performance Example:

    • Study involving 2020 athletes per group across categories: Bowling, Athletics, Swimming, Hockey, and Football.

    • The Y-axis represents the mean race time (RTRT) for a 100m100\,m sprint.

    • Results: Bowling athletes had a mean race time of approximately 25s25\,s, while athletics athletes had a much faster mean time of approximately 10s10\,s.

  • Error Bars: Used with summary statistics to indicate variability. Common error bars represent plus or minus one standard deviation (±1σ\pm 1\,\sigma) around the mean.

  • Comparing Multiple Variables & Interactions:

    • Bar charts can compare data across two variables (e.g., athlete type vs. country of origin).

    • Trends: Comparisons can show consistent patterns (e.g., hockey players being faster than bowlers in both Country A and Country B).

    • Interactions: An interaction occurs when the effect of one variable depends on the level of another.

    • Interaction Example: Bowling athletes from Country A are slower than those from Country B, but swimming athletes from Country A are faster than those from Country B.

  • Bar Chart Pitfalls:

    • Like pie charts, they become cluttered with too many categories or when counts differ dramatically (e.g., Shakespeare death data where stabbing dwarfs all other categories).

    • Scaling Issues (Truncated Axis): The Y-axis scale can be manipulated to exaggerate differences.

    • Fox News Example: An infographic showed the number of people on welfare (108108 million) versus people with full-time jobs (101101 million). By starting the Y-axis at 101101 million rather than 00, the difference appeared massive. When replotted starting at 00, the difference is visually much smaller.

Continuous Data Visualisations: Stem and Leaf Plots

  • Purpose: Like histograms, they show frequency distributions for continuous data but retain more numerical detail.

  • Composition:

    • Stem: Includes everything but the last digit of the number.

    • Leaf: The final digit of the number.

  • Construction Process (Using IQ scores: 89,96,105,109,11889, 96, 105, 109, 118):

    • 1. Draw a vertical line to separate the stem and leaf.

    • 2. List the stems in ascending order in the left column: 8,9,10,118, 9, 10, 11.

    • 3. Add the corresponding leaves to the right:

      • 88 | 99 (representing 8989)

      • 99 | 66 (representing 9696)

      • 1010 | 5,95, 9 (representing 105105 and 109109)

      • 1111 | 88 (representing 118118)

  • Visual Interpretation: If rotated 9090 degrees to the right, the leaves form a shape identical to a histogram.

  • Stem and Leaf vs. Histogram:

    • Stem and Leaf: Provides more numerical detail (individual scores are visible).

    • Histogram: Offers more visual impact and makes identifying shape and spread easier.

Continuous Data Visualisations: Box Plots

  • Components: Box plots (or box-and-whisker plots) use five key summary statistics:

    • Median (Q2Q2): The middle value separating the data into two halves.

    • Quartile 1 (Q1Q1): The 25th percentile (middle of the lower half).

    • Quartile 3 (Q3Q3): The 75th percentile (middle of the upper half).

    • Interquartile Range (IQRIQR): Calculated as IQR=Q3Q1IQR = Q3 - Q1. It represents the middle 5050 % of the data.

    • 1.5 IQR Rule: Used to identify potential outliers.

  • Example Case Study (Memory Test Data, N=32N = 32):

    • Median: 66 (1616 participants above, 1616 below).

    • Q1=5Q1 = 5; Q3=7Q3 = 7.

    • IQR=75=2IQR = 7 - 5 = 2.

    • Outlier Thresholds:

      • Upper cut-off = Q3+(1.5×IQR)=7+(1.5×2)=10Q3 + (1.5 \times IQR) = 7 + (1.5 \times 2) = 10.

      • Lower cut-off = Q1(1.5×IQR)=5(1.5×2)=2Q1 - (1.5 \times IQR) = 5 - (1.5 \times 2) = 2.

    • Results: Scores below 22 or above 1010 are outliers. In this set, scores of 11 and 2626 (an error) were identified.

  • Visual Anatomy of a Box Plot:

    • Box: Bottom is Q1Q1, top is Q3Q3. The vertical height is the IQRIQR.

    • Line inside box: Represents the Median (Q2Q2).

    • Whiskers: Lines extending to the largest and smallest values that fall within the calculated cut-offs.

    • Circles/Dots: Individual points representing potential outliers beyond the whiskers.

  • Identifying Skewness:

    • Positive Skew: The median line is positioned closer to the bottom of the box; the upper whisker is often longer.

    • Negative Skew: The median line is positioned closer to the top of the box; the lower whisker is often longer.

  • Comparing Multiple Box Plots: Useful for comparing distributions across categories (e.g., Movie genre vs. Critic ratings).

    • Families/Music movies: Lower median ratings.

    • Fantasy/Mystery: Negatively skewed distributions.

    • Biography: Contains several low-rating outliers.

Principles for Describing Data

  • The Simplicity Principle: Keep graphs clean and simple. Avoid excessive textures, 3D effects, or orientations that distract from the data (inappropriate vs. appropriate graphs).

  • Pictures vs. Numbers:

    • Use Pictures (Histograms and Box Plots) to evaluate data shape: Normality, skewness, kurtosis, and modality (number of peaks).

    • Use Numbers (Mean, Median, Mode, SD, IQRIQR) to define the centre and spread.

    • Use Both to identify outliers (e.g., using the 1.5×IQR1.5 \times IQR rule or the 22 to 33 Standard Deviation rule alongside visual inspection).

  • Selection Flowchart:

    • 1. Is the distribution badly skewed?

      • Yes: Support with Median, IQRIQR, and Box Plot.

    • 2. Are there major outliers?

      • Yes: Support with Median, IQRIQR, and Box Plot.

    • 3. If no major skew or outliers:

      • Use Mean, Standard Deviation, and Histogram.

  • Modality: Histograms are superior to box plots for identifying if a distribution is unimodal, bimodal, or multimodal.

Summary of Visualisation Tools

  • Pie Charts: Proportional categorical data (best for <10 categories).

  • Bar Charts: Categorical counts or summary statistics (means/medians).

  • Stem and Leaf Plots: Continuous frequency data with numerical detail.

  • Histograms: Continuous frequency data with visual impact for shape/spread.

  • Box Plots: Continuous data distribution using quartiles, medians, and outlier detection.