Centre for Multi-Dimensional Data Visualisation (MuViSU).
Department of Statistics and Actuarial Science, Stellenbosch University, South Africa.
24 July 2026
nienkemperj@sun.ac.zaR package development.R packages:This is the first stop on our path through data analysis.
You can think of it as the mother tongue of data analysis, this is where everyone starts.
Questions we need to answer: “What is a typical occurrence?”, “How different is one case from another?”, “Are there unusual subjects?”
We are interested in understanding the shape of the data, also referred to as the behaviour of the data.
Foundations: terminology, data, variable types and measurement scales
Central tendency: triple M (mean, median, mode)
Location: quantiles, percentiles
Dispersion: range, variance, standard deviation, coefficient of variation
Distribution shape: skewness, kurtosis, normality
Table summaries: frequencies and cross tabulations
Choosing suitable visualisations
Final remarks
Focus will be on interpretation, not computation.
gapminder (Bryan (2025)), a real data set will be used throughout to be able to expose the underlying story.
Excerpt from this project: Youtube Hans Rosling: The Joy of Stats
Motivation for this data set: categorical and continuous variables, as well as a time dimension.
Provides possible links between various disciplines: health, economics, demography, political science.
| Variable | Description |
|---|---|
country |
Country name (142 countries) |
continent |
Africa, Americas, Asia, Europe, Oceania (5 continents) |
year |
1952–2007, increments of 5 years |
lifeExp |
Life expectancy at birth (in years) |
gdpPercap |
Gross Domestic Product (GDP) per capita (US$); national wealth indicator |
pop |
Population size |
General terminology
Variable types and measurement scales
| Type | Scale | Definition | Possible summaries |
|---|---|---|---|
| Categorical | Nominal | Named categories, no order | Mode, frequencies |
| Categorical | Ordinal | Ordered categories, unequal spacing possible | Median, mode, ranks |
| Numerical | Interval | Ordered, no true zero | Mean, standard deviation, etc. |
| Numerical | Ratio | Ordered, true zero | Mean, standard deviation, all ratios |
Numerical: Continuous or Discrete
Gapminder variable classificationsThis is your first step in the process!
| Variable | Type | Scale |
|---|---|---|
continent |
Categorical | Nominal |
year |
Numerical, discrete | Interval |
lifeExp |
Numerical, continuous | Ratio |
gdpPercap |
Numerical, continuous | Ratio |
pop |
Numerical, discrete | Ratio |
Arithmetic mean, mode and median
\[\bar{x} = \frac{\sum_{i=1}^{n}x_i}{n}\] Requirements: numerical data - measured on an interval or ratio scale
\(M_e \rightarrow\) middle observation of the sorted observations
Requirements: numerical data, measured on an interval, ratio OR ordinal scaled data.
\(M_o \rightarrow\) observation that occurs the most frequently
Requirements: suitable for ALL measurement scales
The only option for nominal scaled variables.
Figure Zar (2013), page 27.
lifeExp: central tendency (numerical summary)Consider the life expectancy variable for the year 2007
Summaries:
| Statistics | Value |
|---|---|
| Sample size | 142 |
| Mean | 67.0074 |
| Median | 71.9355 |
| Mode | no mode |
mean \(<\) median
lifeExp: central tendency (visual summary)Majority of observations on the right. Distribution is skewed to the left - panel (d) on slide 12.
However, mean and median are reasonably close together and in relative closeness. Not severe skewness.
gdpPercap: central tendency (numerical summary)Consider the life expectancy variable for the year 2007
Summaries:
| Statistics | Value |
|---|---|
| Sample size | 142 |
| Mean | 11 680.07 |
| Median | 6 124.371 |
| Mode | no mode |
mean \(>>>\) median
gdpPercap: central tendency (visual summary)Majority of observations on the left. Distribution is severely skewed to the right - panel (c) on slide 12.
A small number of wealthy countries pull the mean above “typical” values. Mean and median are very different.
Quantiles, quartiles, percentiles
Boxplot: five-number summary
Minimum, Lower quartile (\(Q_1\)), Median (\(M_e\)), Upper quartile (\(Q_3\)) and Maximum.
Error bars? To be discussed.
Information on the spread and variation of the data
Range: Maximum - Minimum
Indicates the range of the entire data set.
Take note: Not robust against outliers and skewed distributions.
Interquartile range (IQR): Upper quartile - Lower quartile = \(Q_3 - Q_1\)
Indicates the range over the middle 50% of the data.
Take note: Robust against outliers.
Error bars: \(Q_3 + 1.5\times IQR\) and \(Q_1 - 1.5\times IQR\)
Values above \(Q_3 + 1.5\times IQR \rightarrow\) outliers to the right of the distribution
Values below \(Q_1 - 1.5\times IQR \rightarrow\) outliers to the left of the distribution
The variance is a measure of how far observations tend to be away from the mean.
\[s^2 = \frac{\sum_{i=1}^{n}(x_i-\bar{x})^2}{n-1}\]
An easier computational formula:
\[s^2 =\frac{\sum_{i=1}^{n}x_i^2-\frac{(\sum_{i=1}^{n}x_i)^2}{n}}{n-1}\]
Standard deviation: square-root of the variance. \(s= \sqrt{s^2}\)
Quantification of the variation in the original measurement scale.
Easier to interpret and understand.
Coefficient of variation: \(\frac{s}{\bar{x}}\), ratio of the standard deviation and mean
Gapminder: measures of dispersion| Variable | Std. Deviation | Variance | CV |
|---|---|---|---|
| lifeExp | 1.21e+01 | 1.46e+02 | 18.02% |
| gdpPercap | 1.29e+04 | 1.65e+08 | 110.10% |
| pop | 1.48e+08 | 2.18e+16 | 335.34% |
Life expectancy by continent, still considering 2007
| Continent | n | Mean | Median | Std. Deviation | Variance | CV |
|---|---|---|---|---|---|---|
| Africa | 52 | 54.81 | 52.93 | 9.63 | 92.75 | 17.57% |
| Americas | 25 | 73.61 | 72.90 | 4.44 | 19.72 | 6.03% |
| Asia | 33 | 70.73 | 72.40 | 7.96 | 63.42 | 11.26% |
| Europe | 30 | 77.65 | 78.61 | 2.98 | 8.88 | 3.84% |
| Oceania | 2 | 80.72 | 80.72 | 0.73 | 0.53 | 0.90% |
Africa has the most variation around the mean life expectancy.
Europe has the lowest variation around the mean life expectancy.
CAUTION: Oceania small sample size.
Only suitable for bell-shaped, symmetrical distributions.
Interpreting skewness and kurtosis. Figure: Zar (2013), page 96.
| Statistic | Skewness | Kurtosis |
|---|---|---|
| \(\approx 0\) | Roughly symmetrical | Tails similar to normal distribution |
| \(>0\) | Positively skewed | Heavier tails (more outliers) |
| \(<0\) | Negatively skewed | Lighter tails (more uniform) |
Typical variants:
| Type | Convention / Software | Skewness | Kurtosis |
|---|---|---|---|
| Type 1 (g1 / g2) | Simple moment coefficient | -0.6815 | -0.8428 |
| Type 2 (G1 / G2) | Bias-adjusted (SPSS/SAS) | -0.6888 | -0.8298 |
| Type 3 (b1 / b2) | MINITAB/BMDP | -0.6743 | -0.8731 |
The three conventions agree on direction (all negative — left-skewed) but differ in magnitude.
Always report which formula/software you used.
This also confirms the previous visual inspection and measures of central tendency (Slide 16).
Quantile-quantile (QQ) plot
When the points follow the diagonal line closely (“hugging”) it provides evidence of normality.
The concave shape (curves downwards) of life expectancy provides evidence of negative skewness.
The convex shape (curves upwards) of GDP per capita provides evidence of positive skewness.
Frequencies and cross-tabulations
Suitable to summarise information on categorical variables.
| Continent | Frequency | Percentage |
|---|---|---|
| Africa | 52 | 36.6% |
| Asia | 33 | 23.2% |
| Europe | 30 | 21.1% |
| Americas | 25 | 17.6% |
| Oceania | 2 | 1.4% |
| Total | 142 | 100.0% |
Using bins for the life expectancy
| Continent | <60 yrs | 60-70 | 70-80 | 80+ | Total |
|---|---|---|---|---|---|
| Africa | 40 | 5 | 7 | 0 | 52 |
| Americas | 0 | 3 | 21 | 1 | 25 |
| Asia | 3 | 8 | 19 | 3 | 33 |
| Europe | 0 | 0 | 23 | 7 | 30 |
| Oceania | 0 | 0 | 0 | 2 | 2 |
| Total | 43 | 16 | 70 | 13 | 142 |
Matching your data to a figure
| Data description | Possible figure |
Gapminder example |
|---|---|---|
| Counts within categories | Bar chart, pie chart | Countries per continent |
| Distribution of one continuous variable | Histogram, boxplot | Spread of life expectancy |
| Comparing a variable across groups | Boxplot | Life expectancy by continent |
| Relationship between two continuous variables | Scatterplot | GDP vs. life expectancy |
| Change over time | Line graph | Mean life expectancy, 1952–2007 |
| Several variables at once | Bubble chart, Biplot | GDP, life expectancy, population, continent |
Only connect data points if they represent sequential measurements, such as time.
Overall positive trend, but not linear.
A transformation should be applied to GDP before applying correlation or regression techniques.
Four variables in one figure. Wealth, health and population size.
Multivariate visualisation tool. Generalised scatterplot. biplotEZ Lubbe et al. (2024)
moveEZ Ganey and Nienkemper-Swanepoel (2026)
Generally, quantitative results chapters start with descriptive statistics:
Slides made in Quarto.
R Graphics Cookbook. Chang (2023)
R for Data Science. Wickham et al. (2023)
Portions of this material were developed with the assistance of Claude, a large language model developed by (Anthropic (2026)).
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.