Statistical Analysis Summary
Central Tendency Metrics
I2.2 Suppose that the data for analysis includes the attribute age. The age values for the data
tuples are (in increasing order) 13, 15, 16, 16, 19, 20, 20, 21, 22, 22, 25, 25, 25, 25, 30,
33, 33, 35, 35, 35, 35, 36, 40, 45, 46, 52, 70.
(a) What is the mean of the data? What is the median?
(b) What is the mode of the data?
Mean
29.96
Median
25
Mode
25, 35
Bimodal (Freq: 4)
Methodology & Calculations
Dataset Context
N = 27 observations (Sorted Age Attributes)
MEAN
Calculated by dividing the sum of all data elements by the total population size (N).
μ = 809 / 27 = 29.9629...
MEDIAN
Identified as the structural midpoint of the ordered dataset. For an odd population size (N = 27), the value aligns with position (N + 1) / 2.
Target Index: 14th position → 25
MODE
Determined by peak structural frequency. The values 25 and 35 share the highest recurring density within the sample profile.
Maximum Frequency: 4 occurrences each
import numpy as np
from scipy import stats
ages = [13, 15, 16, 16, 19, 20, 20, 21, 22, 22, 25, 25, 25, 25, 30, 33, 33, 35, 35, 35, 35, 36, 40, 45, 46, 52, 70]
# Total count
n = len(ages)
# Mean
mean_val = np.mean(ages)
# Median
median_val = np.median(ages)
# Mode
mode_result = stats.mode(ages, keepdims=True)
mode_val = mode_result.mode[0]
mode_count = mode_result.count[0]
# Find all modes just in case it is multimodal
from collections import Counter
counts = Counter(ages)
max_count = max(counts.values())
all_modes = [k for k, v in counts.items() if v == max_count]
print(f"Count: {n}")
print(f"Sum: {sum(ages)}")
print(f"Mean: {mean_val:.2f}")
print(f"Median: {median_val}")
print(f"Modes: {all_modes} with count {max_count}")
No comments:
Post a Comment