# ──────────────────────────────────────────────────────────────── # Task 1: Arithmetic Mean of a Small Group of Scores # We have 5 scores, calculate the mean, and interpret it. # ────────────────────────────────────────────────────────────────
# 1. Create the dataset scores <- c(12, 15, 14, 10, 13) # Create vector 'scores' with five values
# 2. Display the dataset scores # Display all five scores in the vector #> [1] 12 15 14 10 13
# 3. Calculate the arithmetic mean mean(scores) # Calculate the mean of the five scores #> [1] 12.8
# Interpretation questions: # - What does the mean (12.8 here) say about the average performance of this group? # - Would your assessment change if one value were very large or very small?
Task 2
# ──────────────────────────────────────────────────────────────────────────────── # Task 2: Median of Waiting Times # We have 5 waiting times, determine the median, and discuss its robustness. # ────────────────────────────────────────────────────────────────────────────────
# 1. Create the dataset waits <- c(5, 7, 3, 10, 6) # Vector 'waits' contains five waiting times in minutes.
# 2. Display the dataset waits # Display all waiting times #> [1] 5 7 3 10 6
# 3. Calculate the median median(waits) # Output the median of the waiting times #> [1] 6
# Interpretation questions: # - Why is the median (6 here) more robust against outliers than the arithmetic mean? # - How would the median change if one waiting time were 100?
Task 3
# ──────────────────────────────────────────────────────────────────────────────── # Task 3: Temperature range # We have 5 temperature measurements, calculate the range, and interpret it. # ────────────────────────────────────────────────────────────────────────────────
# 1. Create the dataset temps <- c(20, 22, 19, 25, 23) # Five temperature values in °C
# 2. Determine the minimum and maximum range(temps) # Display the smallest and largest temperature value #> [1] 19 25
# 3. Calculate the range diff(range(temps)) # Difference between the maximum and minimum → range #> [1] 6
# Interpretation questions: # - What does a range of 6 °C say about the range of weather conditions? # - What information is missing that the range does not provide?
Task 4
# ──────────────────────────────────────────────────────────────────────── # Task 4: Sample variance of dice rolls # We have 5 dice results, calculate the variance, and interpret it. # ────────────────────────────────────────────────────────────────────────
# 1. Create the dataset rolls <- c(3, 6, 2, 5, 4) # Vector 'rolls' with five results
# 2. Display the values rolls # Display all five die rolls #> [1] 3 6 2 5 4
# 3. Calculate the sample variance var(rolls) # Variance of the five results #> [1] 2.5
# Interpretation questions: # - What does a variance of 2.5 mean in the context of dice? # - How would the variance change if one result were 6 instead of 2?
Task 5
# ──────────────────────────────────────────────────────────────────────────────── # Exercise 5: Boxplot of salaries # We consider 6 monthly salaries, summarize them statistically, and visualize them. # ────────────────────────────────────────────────────────────────────────────────
# 1. Create dataset salary <- c(45, 50, 55, 60, 48, 52) # Monthly salaries (in k€) of 6 people
# 2. Descriptive statistics summary(salary) # Min, 1st Qu., Median, Mean, 3rd Qu., Max #> Min. 1st Qu. Median Mean 3rd Qu. Max. #> 45.00 48.00 51.00 51.67 55.00 60.00
# 3. Create boxplot boxplot(salary, main="Monthly salaries", ylab="k€") # Boxplot with labels # (graphically in the Plots window)
# Questions for interpretation: # - What values do the median and quartiles provide? # - Are there any outliers, and what would you do with them?