01-01: Exercises — Statistics Basics and Data Types¶
Notes reference: 01-01: Statistics Basics and Data Types
Q1: Population, sample, parameter, statistic¶
A university has 18,400 students. A researcher surveys 350 of them and finds that their mean weekly study time is 14.2 hours. The true mean for all students is unknown.
Identify: (a) the population, (b) the sample, (c) N and n, (d) whether 14.2 is a parameter or a statistic, and (e) the correct symbol for it.
Solution
(a) Population All 18,400 students at the university
(b) Sample The 350 students surveyed
(c) N = 18,400 n = 350
(d) 14.2 is computed FROM THE SAMPLE → it is a STATISTIC
(e) Symbol x̄ = 14.2
The unknown true mean for all 18,400 students would be the parameter μ.
Q2: Descriptive or inferential?¶
Classify each statement.
- "The 40 patients in this trial had a mean blood pressure of 128 mmHg."
- "Based on this trial, we estimate the drug lowers blood pressure by 6 to 11 mmHg for all similar patients."
- "62% of the 1,200 people polled support the measure."
- "We are 95% confident that between 59% and 65% of all voters support the measure."
Solution
1. DESCRIPTIVE — summarizes only the 40 patients observed
2. INFERENTIAL — generalizes beyond the trial, with an interval estimate
3. DESCRIPTIVE — a summary of the 1,200 people actually polled
4. INFERENTIAL — a confidence interval for ALL voters
The tell: does the claim stay inside the data (descriptive) or reach beyond it with stated uncertainty (inferential)?
Q3: Qualitative vs. quantitative, discrete vs. continuous¶
Classify each variable.
| Variable | Qual/Quant | Discrete/Continuous |
|---|---|---|
| Number of siblings | ? | ? |
| Shirt size (S, M, L) | ? | ? |
| Time to run 5 km | ? | ? |
| Employee ID number | ? | ? |
| Annual rainfall (mm) | ? | ? |
| Number of defects per batch | ? | ? |
| Political party | ? | ? |
| Body temperature | ? | ? |
Solution
| Variable | Qual/Quant | Discrete/Continuous |
|---|---|---|
| Number of siblings | Quantitative | Discrete (countable, no half-siblings in this sense) |
| Shirt size (S, M, L) | Qualitative (ordered) | — |
| Time to run 5 km | Quantitative | Continuous |
| Employee ID number | Qualitative | — (a number used as a label) |
| Annual rainfall (mm) | Quantitative | Continuous |
| Number of defects per batch | Quantitative | Discrete |
| Political party | Qualitative | — |
| Body temperature | Quantitative | Continuous |
Trap: employee ID is stored as a number but has no arithmetic meaning. Averaging it is nonsense.
Q4: Levels of measurement¶
Give the level of measurement for each, and justify with the "true zero" or "equal intervals" test.
- Jersey numbers on a team
- Finishing position in a race (1st, 2nd, 3rd)
- Temperature in degrees Celsius
- Weight in kilograms
- Year of birth
- Customer satisfaction: very poor / poor / fair / good / excellent
- Number of emails received today
- IQ score
Solution
1. NOMINAL Labels only; jersey 20 is not "twice" jersey 10
2. ORDINAL Ordered, but the gap between 1st and 2nd ≠ gap between 2nd and 3rd
3. INTERVAL Equal intervals, but 0 °C is arbitrary → 40 °C is NOT twice 20 °C
4. RATIO 0 kg means no weight → 40 kg IS twice 20 kg
5. INTERVAL Year 0 is a convention, not "no time"
6. ORDINAL Ordered categories with unequal, unquantified spacing
7. RATIO 0 emails means none; 20 is twice 10
8. INTERVAL Equal-interval by construction, but IQ 0 is not "no intelligence"
Q5: Which centre is legal?¶
For each variable in Q4, state which measures of central tendency are valid.
Solution
Nominal (1) → MODE only
Ordinal (2, 6) → Mode, MEDIAN
Interval (3, 5, 8) → Mode, median, MEAN
Ratio (4, 7) → Mode, median, mean, and ratios/geometric mean
Each level supports everything the level above it supports, plus one more operation.
Q6: Spot the error¶
A report states: "The average zip code of our customers is 48,207, and the average customer-satisfaction rating is 3.4 on our 5-point scale, so satisfaction is 68% of the maximum."
Find two errors.
Solution
ERROR 1 Zip codes are NOMINAL. An average zip code is meaningless — the number
is a label, not a quantity. Report the MODE or a frequency table instead.
ERROR 2 A 5-point satisfaction scale is ORDINAL. The gap between "3" and "4"
is not guaranteed equal to the gap between "1" and "2", so
(a) the mean is questionable, and
(b) "3.4 out of 5 = 68% of the maximum" treats it as RATIO data,
which requires a meaningful zero. Report the median and the
full distribution of ratings.
Q7: Classify a data set in software¶
The file patients.csv has columns patient_id, blood_type, pain_1_to_10, weight_kg, visits.
Declare each column's measurement level correctly.
Solution
# R
df$patient_id <- as.character(df$patient_id) # nominal, a label
df$blood_type <- factor(df$blood_type,
levels = c("A", "B", "AB", "O")) # nominal
df$pain_1_to_10 <- factor(df$pain_1_to_10,
levels = 1:10, ordered = TRUE) # ordinal
df$weight_kg <- as.numeric(df$weight_kg) # ratio
df$visits <- as.integer(df$visits) # ratio, discrete
str(df)
mean(df$blood_type) # Warning + NA — R blocks the illegal operation
# Python
df["patient_id"] = df["patient_id"].astype(str) # nominal
df["blood_type"] = df["blood_type"].astype("category") # nominal
df["pain_1_to_10"] = pd.Categorical(df["pain_1_to_10"],
categories=range(1, 11),
ordered=True) # ordinal
df["weight_kg"] = pd.to_numeric(df["weight_kg"]) # ratio
df["visits"] = df["visits"].astype(int) # ratio
df.dtypes
df["blood_type"].value_counts() # the legal summary for nominal data
' Excel — enforce the level with Data Validation and the right formula
' blood_type: Data ▸ Data Validation ▸ List ▸ Source: A,B,AB,O
=COUNTIF(B2:B201, "O") / COUNTA(B2:B201) ' nominal: proportions, not a mean
=MEDIAN(C2:C201) ' ordinal: median is the ceiling
=AVERAGE(D2:D201) ' ratio: mean is legal
Q8: Choose the tool from the level¶
A colleague wants to know whether blood type is related to pain rating. Which test from this course applies, and why?
Solution
Blood type = NOMINAL (4 categories)
Pain rating = ORDINAL (10 levels, could be collapsed to Low/Medium/High)
Both are categorical → CHI-SQUARE TEST OF INDEPENDENCE (chapter 12-02)
NOT a t-test (needs interval/ratio data)
NOT Pearson correlation (needs two quantitative variables)
If pain were treated as quantitative and blood type kept as 4 groups,
one-way ANOVA (12-03) would be the alternative — but that requires
assuming the pain scale has equal intervals, which ordinal data does not
guarantee. Kruskal-Wallis is the safer nonparametric choice.
➡️ Next: 01-02: Exercises — Data Representation and Organization