data("HCI", package = "ShinyItemAnalysis")
mean(HCI$total)[1] 12.21198
median(HCI$total)[1] 12
This appendix provides an overview of essential descriptive statistics for measurement data.
Before performing any statistical analysis, it is important to understand the type of measurement scale. The typology, originally proposed by Stevens (1946), distinguishes between four types of scales:
Nominal scale: Categories with no inherent ordering. Examples include gender, ethnicity, or answer options in a multiple-choice test (before scoring).
Ordinal scale: Categories with a natural ordering, but distances between categories are not meaningful. Examples include Likert scales (strongly disagree – disagree – neutral – agree – strongly agree) or education level (high school – college – graduate).
Interval scale: Numerical values with meaningful distances, but no true zero point. Examples include temperature in Celsius or calendar year.
Ratio scale: Numerical values with meaningful distances and a true zero point. Examples include height, weight, or response time.
For statistical analysis:
The sample mean (arithmetic average) for \(n\) observations \(x_1, x_2, \ldots, x_n\) is defined as:
\[ \bar{x} = \frac{1}{n} \sum_{i=1}^{n} x_i \tag{B.1}\]
The sample median is the middle value when observations are ordered. For an odd number of observations, it is the middle value. For an even number, it is typically the average of the two middle values.
The mode is the most frequently occurring value.
In R:
data("HCI", package = "ShinyItemAnalysis")
mean(HCI$total)[1] 12.21198
median(HCI$total)[1] 12
The sample variance is the average squared deviation from the mean:
\[ s^2 = \frac{1}{n-1} \sum_{i=1}^{n} (x_i - \bar{x})^2 \tag{B.2}\]
The sample standard deviation is the square root of the variance:
\[ s = \sqrt{s^2} \tag{B.3}\]
The range is the difference between the maximum and minimum values.
The interquartile range (IQR) is the difference between the 75th and 25th percentiles.
In R:
var(HCI$total)[1] 13.2473
sd(HCI$total)[1] 3.639684
range(HCI$total)[1] 3 20
IQR(HCI$total)[1] 5
The sample skewness measures the asymmetry of the distribution:
\[ \text{Skewness} = \frac{1}{n} \sum_{i=1}^{n} \left( \frac{x_i - \bar{x}}{s} \right)^3 \tag{B.4}\]
The sample kurtosis measures the “tailedness” of the distribution:
\[ \text{Kurtosis} = \frac{1}{n} \sum_{i=1}^{n} \left( \frac{x_i - \bar{x}}{s} \right)^4 \tag{B.5}\]
Note: Some software reports excess kurtosis (kurtosis − 3), so a normal distribution has excess kurtosis of 0.
In R, the moments package provides these functions:
library(moments)
skewness(HCI$total)[1] -0.1982404
kurtosis(HCI$total)[1] 2.347352
The p-th percentile is the value below which p% of the data falls. The quantile function is the generalization, where the 0.25 quantile equals the 25th percentile.
Special quantiles:
In R:
quantile(HCI$total, probs = c(0.25, 0.50, 0.75))25% 50% 75%
10 12 15
A comprehensive summary can be obtained using:
summary(HCI$total) Min. 1st Qu. Median Mean 3rd Qu. Max.
3.00 10.00 12.00 12.21 15.00 20.00
For more detailed statistics:
psych::describe(HCI$total) vars n mean sd median trimmed mad min max range skew kurtosis se
X1 1 651 12.21 3.64 12 12.32 4.45 3 20 17 -0.2 -0.66 0.14