This notebook answers the main RQ and the three sub-RQs from Part 1 (the sub-RQs are called RQ1–RQ3 in the section titles):

  • Main RQ: What are the main operational bottlenecks in IU canteens, what factors contribute to them, and how can canteen operations be improved?
  • SQ1 (RQ1): What operational problems do students most frequently experience?
  • SQ2 (RQ2): What factors contribute to the bottlenecks identified by students?
  • SQ3 (RQ3): What improvements could reduce these bottlenecks and improve service efficiency?

Data. Cleaned survey from Deliverable 1 (data/clean/). Code is collapsible: use Code → Show All Code at the top right, or click Show next to a chunk.

How each table or chart is written up. Before every table or chart there are 3–4 sentences (purpose, why this method, H0 if a test is run). After it there are 3–4 sentences (result with point estimate + 95% CI + p-value, practical meaning, limitation and next step). All numbers in the text after a table are computed by the code, so they always match the output. Tests use α = 0.05.

Data preparation

# Relative path (required by the submission rules) -> run from the GroupXX_Part2 folder
load("data/clean/IUCanteenSurvey_Clean.Rdata")   # objects: clean, problem_log, clean_summary

# Privacy: drop respondent names before anything is printed (this notebook may be published publicly)
clean <- clean %>% select(-StudentName) %>% mutate(across(where(is.factor), as.character))

datatable(tibble(Rows = nrow(clean), Columns = ncol(clean)), rownames = FALSE, options = list(dom = "t"))

Turning answer ranges into numbers (documented decision)

The survey recorded waiting times as ranges (e.g. “3 – 5 minutes”). To compute averages we use the midpoint of each range. Open-ended top ranges (“More than 10 minutes”) are set to 12.5 min (main scenario) and tested again at 15 min in Section 5.

add_minutes <- function(d, open_end = 12.5, tol_open = 17.5) {
  d %>% mutate(
    queue_min = case_when(str_detect(QueueTime, "^Under") ~ 1.5, str_detect(QueueTime, "^3") ~ 4,
                          str_detect(QueueTime, "^6") ~ 8,       str_detect(QueueTime, "^More") ~ open_end),
    food_min  = case_when(str_detect(FoodWaitTime, "^Under") ~ 1.5, str_detect(FoodWaitTime, "^3") ~ 4,
                          str_detect(FoodWaitTime, "^6") ~ 8,       str_detect(FoodWaitTime, "^More") ~ open_end),
    seat_min  = case_when(str_detect(SeatFindTime, "^Under") ~ 1, str_detect(SeatFindTime, "^3") ~ 4,
                          str_detect(SeatFindTime, "^6") ~ 8,     str_detect(SeatFindTime, "^More") ~ open_end),
    tol_min   = case_when(str_detect(MaxWaitTolerated, "^Under") ~ 2.5, str_detect(MaxWaitTolerated, "^5") ~ 7.5,
                          str_detect(MaxWaitTolerated, "^11") ~ 13,     str_detect(MaxWaitTolerated, "^More") ~ tol_open),
    total_min = queue_min + food_min + seat_min,
    gap_min   = total_min - tol_min,
    over_tol  = total_min > tol_min,
    # ordinal scores (1 = low ... high) used for correlations
    full_score = case_when(str_detect(FullnessLevel, "^Below") ~ 1L, str_detect(FullnessLevel, "^50") ~ 2L,
                           str_detect(FullnessLevel, "^76") ~ 3L,    str_detect(FullnessLevel, "^100") ~ 4L),
    ext_score  = match(NoticeExternalStudents, c("Never", "Rarely", "Sometimes", "Frequently", "Always")),
    rule_score = match(RuleClarity, c("Not clear yet", "Normal", "Quite clear", "Very clear")),
    fullness   = factor(full_score, levels = 1:4, labels = c("<50%", "50–75%", "76–95%", "100%")),
    ext_f      = factor(ext_score, levels = 1:5, labels = c("Never", "Rarely", "Sometimes", "Frequently", "Always")),
    visit_time = factor(VisitTime, levels = c("Before 11:00 AM", "11:00 AM – 11:59 AM",
                                              "12:00 PM – 12:59 PM", "1:00 PM or later")),
    IUStudent  = factor(IUStudent, levels = c("Yes", "No"), labels = c("IU student", "Non-IU student")),
    # yes/no indicators for the accompanying problems (used in RQ1)
    stockout_weekly       = str_detect(SoldOutFreq, "^(Sometimes|Frequently)"),
    dirty_table           = str_detect(TableCleanliness, "^(Dirty|Very unhygienic)"),
    group_table_hard      = !str_detect(TableDifficulty, "^Easy"),
    group_table_very_hard = str_detect(TableDifficulty, "^(Very|Extremely)"),
    # short labels for what students do when the canteen is overcrowded (used in RQ3)
    alt_short = case_when(str_detect(OvercrowdAlternative, "^Ordering") ~ "Order delivery via app",
                          str_detect(OvercrowdAlternative, "^Eating")   ~ "Eat at stalls/restaurants outside",
                          str_detect(OvercrowdAlternative, "^Buying")   ~ "Buy packaged food at a convenience store",
                          str_detect(OvercrowdAlternative, "^Skipping") ~ "Skip lunch until the afternoon")
  )
}
df <- add_minutes(clean)

# CHECK: no value should be NA after mapping. If something is NA, a label in the data differs from the pattern above.
na_check <- df %>% summarise(across(c(queue_min, food_min, seat_min, tol_min, full_score, ext_score, rule_score,
                                      fullness, ext_f, alt_short), ~ sum(is.na(.x))))
datatable(na_check, rownames = FALSE, options = list(dom = "t", scrollX = TRUE))
# Exact (Clopper-Pearson) 95% CI for a proportion
prop_ci <- function(x, n) { b <- binom.test(x, n); tibble(prop = x / n, lo = b$conf.int[1], hi = b$conf.int[2]) }

# Adjusted Fisher-Pearson skewness (same as e1071::skewness type 2), no extra package needed
skew_g1 <- function(x) {
  n <- length(x); m <- mean(x)
  g1 <- mean((x - m)^3) / mean((x - m)^2)^1.5
  g1 * sqrt(n * (n - 1)) / (n - 2)
}

# Spearman rho with a 95% CI (Bonett-Wright approximation) and p-value
spearman_ci <- function(x, y) {
  ct <- suppressWarnings(cor.test(x, y, method = "spearman", exact = FALSE))
  r <- unname(ct$estimate); n <- sum(complete.cases(x, y))
  se <- sqrt((1 + r^2 / 2) / (n - 3)); z <- atanh(r)
  tibble(rho = r, lo = tanh(z - 1.96 * se), hi = tanh(z + 1.96 * se), p = ct$p.value, n = n)
}

# Text helpers: the numbers in the written comments come from these, so they always match the tables
num      <- function(x, d = 2) formatC(x, format = "f", digits = d)
pct      <- function(x, d = 1) paste0(formatC(100 * x, format = "f", digits = d), "%")
fmt_p    <- function(p) ifelse(p < 0.001, "< 0.001", paste0("= ", formatC(p, format = "f", digits = 3)))
p_txt    <- function(p) ifelse(p < 0.001, "<0.001", formatC(p, format = "f", digits = 3))
decide   <- function(p, alpha = 0.05) ifelse(p < alpha, "reject H0", "cannot reject H0")
ci_pct   <- function(p, lo, hi) paste0(pct(p), " (95% CI ", pct(lo), "–", pct(hi), ")")
ci_num   <- function(est, lo, hi, d = 2) paste0(num(est, d), " (95% CI ", num(lo, d), " to ", num(hi, d), ")")
pick     <- function(tbl, col, val) tbl[tbl[[col]] == val, ]

# Interactive table in the same style as the EDA report
show_dt <- function(d, caption = NULL, colnames = NULL, n = nrow(d)) {
  d <- d %>% mutate(across(where(is.numeric), ~ round(.x, 3)))
  datatable(d, rownames = FALSE, caption = caption,
            colnames = if (is.null(colnames)) names(d) else colnames,
            options = list(dom = "t", pageLength = n, scrollX = TRUE))
}

sat_lab <- c(SatQueueing = "Queuing speed", SatFoodPickup = "Food pickup & availability",
             SatSeating = "Seat availability", SatCleanliness = "Table cleanliness & tray return",
             SatTotalTime = "Total time acceptable", SatOverall = "Overall experience")

1 Data overview

1.1 Sample profile and population context

The survey has N = 90 respondents who use the IU canteen, so before any analysis we need to know who they are: IU vs. non-IU students, the time they usually arrive, and why they come. This tells us which population our later estimates speak for (the people eating at the canteen around lunchtime), and it frames every group comparison in Section 3. All three variables are categorical, so the right summary is a count and a share per category, with an exact (Clopper–Pearson) 95% confidence interval for each share to show how far the sample share could be from the population share. No hypothesis test is run here, because this table only describes the sample.

profile_var <- function(d, var, label) {
  d %>% mutate(category = .data[[var]]) %>% count(category, name = "n") %>%
    mutate(variable = label, N = sum(n)) %>%
    rowwise() %>% mutate(ci = list(prop_ci(n, N))) %>% unnest(ci) %>% ungroup() %>%
    transmute(variable, category = as.character(category), n,
              pct = percent(prop, 0.1), ci95 = paste0(percent(lo, 0.1), " – ", percent(hi, 0.1)))
}
profile <- bind_rows(
  profile_var(df, "IUStudent",    "Student status"),
  profile_var(df, "visit_time",   "Usual visit time"),
  profile_var(df, "VisitPurpose", "Main purpose of visit")
)
datatable(profile, rownames = FALSE,
          colnames = c("Variable", "Category", "n", "Share", "95% CI"),
          caption = "Table 1.1 — Sample profile (N = 90) with exact 95% confidence intervals",
          options = list(dom = "t", pageLength = 20, scrollX = TRUE))

IU students are 70 of 90 respondents (77.8%, 95% CI 67.8%–85.9%) and non-IU students are 20 (22.2%, 14.1%–32.2%). Almost half of the sample arrives between 11:00 and 11:59 (48.9%, 38.2%–59.7%), and 71.1% (60.6%–80.2%) come to eat at the canteen rather than take food away. No p-value is reported because nothing is tested here. The sample is dominated by IU students eating at the canteen around the lunch peak, so our findings mostly describe lunchtime diners; the intervals are about ±10 percentage points wide, so even the larger shares are only roughly known. This is a convenience sample, so the intervals assume random sampling and probably understate real uncertainty, and the non-IU group (n = 20) is small. Figure 1.1 shows how thin the subgroup cells are.

Figure 1.1 asks whether IU and non-IU students arrive at different times, because if they do, any later comparison of their waiting times is partly a comparison of different times of day. We use grouped columns with the share within each group (each group sums to 100%), because the groups differ a lot in size (70 vs. 20); hovering over a column shows the number of students behind it. No test is run; this is a descriptive picture.

fig11 <- df %>% count(IUStudent, visit_time) %>%
  complete(IUStudent, visit_time, fill = list(n = 0)) %>%
  group_by(IUStudent) %>% mutate(pct = round(n / sum(n) * 100, 1)) %>% ungroup()

hchart(fig11, type = "column", hcaes(x = visit_time, y = pct, group = IUStudent, n = n)) %>%
  hc_plotOptions(column = list(dataLabels = list(enabled = TRUE, format = "{point.y}%"))) %>%
  hc_tooltip(pointFormat = "<b>{point.y}%</b> of {series.name} (n = {point.n})") %>%
  hc_title(text = "Non-IU students are few, and none of the 20 arrives after 1:00 PM") %>%
  hc_xAxis(title = list(text = "Usual visit time")) %>%
  hc_yAxis(title = list(text = "Percentage within student group (%)")) %>%
  hc_chart(zoomType = "xy")

Among non-IU students 55.0% (11 of 20) arrive at 11:00–11:59 and 30.0% (6 of 20) arrive before 11:00, compared with 47.1% (33 of 70) and 8.6% (6 of 70) of IU students; no non-IU student (0 of 20) arrives after 1:00 PM, while 12.9% (9 of 70) of IU students do. No test or p-value is given, so these gaps may be chance. The two groups do not use the canteen at quite the same times, and several non-IU columns rest on 3 to 6 people, so a later difference in waiting time between the groups could partly reflect arrival time. We cannot separate group from time of day with only 20 non-IU students; Section 3 therefore compares the groups with a rank test and reports an effect size, not only a p-value.

1.2 Baseline statistics and assumption checks

This table gives the baseline numbers for the waiting times and the six satisfaction scores (sample mean, median, SD) and checks the shape of each distribution. The result decides whether Sections 2–4 can use parametric tests (t-test, ANOVA) or must use non-parametric tests (Wilcoxon, Mann–Whitney, Kruskal–Wallis). The mean is given with a t-based 95% CI, the shape is summarised by skewness, and normality is tested with the Shapiro–Wilk test, which suits a sample of 90. The variable comes from a normal distribution; we reject it when p < 0.05.

time_vars <- c(queue_min = "Queuing to order & pay", food_min = "Waiting for food",
               seat_min = "Finding a seat", total_min = "Total time (queue + food + seat)",
               tol_min = "Maximum tolerated wait", gap_min = "Gap = total − tolerated")

base_stats <- function(v, label, type) {
  x <- as.numeric(df[[v]]); tt <- t.test(x); sw <- shapiro.test(x)
  tibble(type = type, measure = label, n = length(x), mean = mean(x),
         ci_lo = tt$conf.int[1], ci_hi = tt$conf.int[2],
         median = median(x), sd = sd(x), skew = skew_g1(x),
         W = unname(sw$statistic), p_shapiro = sw$p.value)
}

baseline <- bind_rows(
  map2_dfr(names(time_vars), unname(time_vars), ~ base_stats(.x, .y, "Time (min)")),
  map2_dfr(names(sat_lab),   unname(sat_lab),   ~ base_stats(.x, .y, "Satisfaction (1–5)"))
) %>%
  mutate(decision  = if_else(p_shapiro < 0.05, "Non-parametric", "Parametric OK"),
         p_shapiro = if_else(p_shapiro < 0.001, "<0.001", sprintf("%.3f", p_shapiro)),
         across(c(mean, ci_lo, ci_hi, median, sd, skew), ~ round(.x, 2)),
         W = round(W, 3),
         ci95 = paste0(ci_lo, " – ", ci_hi)) %>%
  select(type, measure, n, mean, ci95, median, sd, skew, W, p_shapiro, decision)

datatable(baseline, rownames = FALSE,
          colnames = c("Type", "Measure", "n", "Mean", "95% CI (mean)", "Median", "SD", "Skewness", "Shapiro W", "p (Shapiro)", "Test family"),
          caption = "Table 1.2 — Sample statistics and normality checks",
          options = list(dom = "t", pageLength = 12, scrollX = TRUE))

The average total time is 16.19 minutes (95% CI 14.60–17.78; median 16.0; SD 7.59), against an average maximum tolerated wait of 9.66 minutes (8.69–10.62). Normality is rejected for all 12 measures (Shapiro–Wilk p < 0.05 in every row, W between 0.83 and 0.96). The stage times and the gap are right-skewed (skewness 0.65–0.88), while the satisfaction scores lean towards the high end (skewness −0.77 to −0.12). The typical total visit is well above what students say they tolerate on average, and most students rate each stage at 3 or 4 out of 5, which is why differences between stages will be small in size. Waiting times are midpoints of ranges, so they take only a few distinct values and cannot be truly normal, and satisfaction scores are ordinal; Shapiro–Wilk with n = 90 also flags small departures. We therefore use non-parametric tests as the main method and report t-tests only as a robustness check; Figure 1.2 shows the shapes behind these numbers.

Figure 1.2 shows the actual shape of the waiting-time distributions, so we can confirm by eye what the skewness and Shapiro–Wilk numbers say. A histogram per measure is the standard choice for the distribution of a numeric variable, with a separate scale for each panel because the measures differ in range. No test is run; this is a visual check of Table 1.2.

plot_vars <- c("queue_min", "food_min", "seat_min", "total_min", "gap_min")

make_hist <- function(v) {
  hchart(hist(df[[v]], breaks = "Sturges", plot = FALSE)) %>%
    hc_title(text = unname(time_vars[v])) %>%
    hc_xAxis(title = list(text = "Minutes")) %>%
    hc_yAxis(title = list(text = "Respondents")) %>%
    hc_legend(enabled = FALSE) %>%
    hc_chart(zoomType = "xy")
}

htmltools::tagList(lapply(plot_vars, make_hist))

Each stage time piles up at the lower midpoints (4 or 8 minutes) with a thinner tail up to 12.5 minutes, and total time and the gap also have a longer right tail (skewness 0.71 and 0.74). This matches the Shapiro–Wilk rejections in Table 1.2 (all p < 0.05), so the data are not normal. A small group of students with long waits pulls the mean above the median for the stage times (for example, queuing: mean 5.96 vs. median 4.0 minutes), so averages can hide how long the slowest students wait. The gaps between columns come from converting ranges to midpoints, not from real measurement. The next sections therefore use rank-based tests and report medians together with means, starting with Section 2 (SQ1).

2 Research Question 1: What operational problems do students most frequently experience?

2.1 Describe

Figure 2.1 shows how many of the 90 students named each of the five service stages as a bottleneck, which answers the first part of RQ1 (which problems are most common). Students were asked to choose at most two stages, but 13 chose more, so the counts add up to more than 90. A bar chart of counts is the simplest way to compare five categories of a multi-select question; each student counts once per stage. No test is run; Section 2.2.1 turns these counts into estimates with confidence intervals.

bn_lab <- c(BN_Queueing = "Queueing to order", BN_Payment = "Order processing & payment",
            BN_Kitchen = "Food preparation (kitchen)", BN_Pickup = "Waiting at pickup counter",
            BN_Seating = "Finding a seat")

bn_counts <- df %>% summarise(across(all_of(names(bn_lab)), ~ sum(.x))) %>%
  pivot_longer(everything(), names_to = "code", values_to = "n") %>%
  mutate(stage = unname(bn_lab[code]), share = round(n / nrow(df) * 100, 1)) %>%
  arrange(desc(n))

hchart(bn_counts, type = "bar", hcaes(x = stage, y = n, share = share), name = "Respondents") %>%
  hc_plotOptions(bar = list(dataLabels = list(enabled = TRUE))) %>%
  hc_tooltip(pointFormat = "<b>{point.y}</b> of 90 students ({point.share}%)") %>%
  hc_title(text = "Queueing and the kitchen are named most often, but no stage stands alone") %>%
  hc_xAxis(title = list(text = "Service stage")) %>%
  hc_yAxis(title = list(text = "Number of students (multi-select)")) %>%
  hc_legend(enabled = FALSE) %>%
  hc_chart(zoomType = "xy")

Queueing to order is named by 37 of 90 students, followed by the kitchen (35), finding a seat (31), order processing and payment (29) and the pickup counter (26). The counts are close together, and no p-value is attached because this is description only. No single stage dominates, so the problem is spread along the whole service chain and a fix at one stage alone is unlikely to remove the bottleneck. Some students named more than two stages, so counts overlap; Table 2.2 adds confidence intervals to show which differences are large enough to trust.

Table 2.1 describes three problems that come with the bottlenecks: wanted items being sold out, dirty tables, and difficulty finding a table for a group. Each question has ordered answer categories, so a frequency table with counts and shares shows the full picture before we collapse them into yes/no indicators in Table 2.2. No test is run.

acc <- bind_rows(
  df %>% count(level = SoldOutFreq)       %>% mutate(issue = "Wanted item sold out"),
  df %>% count(level = TableCleanliness)  %>% mutate(issue = "Table cleanliness on arrival"),
  df %>% count(level = TableDifficulty)   %>% mutate(issue = "Finding a table for the group")
) %>%
  group_by(issue) %>% mutate(share = percent(n / sum(n), 0.1)) %>% ungroup() %>%
  arrange(issue, desc(n)) %>% select(issue, level, n, share)

show_dt(acc, caption = "Table 2.1 — Accompanying problems (N = 90)",
        colnames = c("Problem", "Answer", "n", "Share"), n = nrow(acc))

44 of 90 students (48.9%) say the item they wanted was sold out at least once or twice a week, 25 (27.8%) find tables dirty or unhygienic, and 76 (84.4%) find it at least somewhat difficult to get a table for their group, including 31 (34.4%) who find it very or extremely difficult. No p-value is given for a description. Seating for groups and stock-outs are the most common companions of the queueing problem, while dirty tables affect a smaller but still sizeable group of more than one in four. All three items are self-reported and each has its own scale; Table 2.2 puts them on one footing with confidence intervals.

2.2 Analyze

2.2.1 Estimation (point estimate and 95% CI)

Table 2.2 turns the sample shares into estimates for all students who use the IU canteen, so we can say how common each bottleneck and accompanying problem is in the population and not only among these 90 students. The exact (Clopper–Pearson) 95% CI is used because n = 90 is modest and several shares are far from 50%, where the normal approximation is unreliable. Estimation has no H0; the width of the interval plays the role of the p-value.

est <- tibble(
  item = c(unname(bn_lab), "Wanted item sold out at least weekly", "Dirty or unhygienic table on arrival",
           "Group table at least somewhat difficult", "Group table very or extremely difficult"),
  x = c(unname(colSums(df[names(bn_lab)])), sum(df$stockout_weekly), sum(df$dirty_table),
        sum(df$group_table_hard), sum(df$group_table_very_hard))
) %>%
  mutate(N = nrow(df)) %>%
  rowwise() %>% mutate(ci = list(prop_ci(x, N))) %>% unnest(ci) %>% ungroup()

fmt_est <- function(item) { r <- est[est$item == item, ]; ci_pct(r$prop, r$lo, r$hi) }

est %>% transmute(Indicator = item, n = x, Estimate = pct(prop), `95% CI` = paste0(pct(lo), " – ", pct(hi))) %>%
  show_dt(caption = "Table 2.2 — Estimated share of students affected (exact 95% CI)", n = nrow(est))

The estimated share who name queueing to order as a bottleneck is 41.1% (95% CI 30.8%–52.0%), the highest of the five stages, while the pickup counter is lowest at 28.9% (95% CI 19.8%–39.4%). The five stage intervals overlap strongly (each is about ±10 percentage points), so the ranking of stages cannot be trusted; by contrast, 84.4% (95% CI 75.3%–91.2%) find a table for their group at least somewhat difficult, and even the lower end of that interval is above the upper end of every stage. No p-value applies to an estimate. Difficulty seating a group is the most widespread problem, and about half of students (48.9% (95% CI 38.2%–59.7%)) meet stock-outs every week. This is a convenience sample, so the true uncertainty is probably larger than the intervals show; Section 2.2.2 now asks whether the time students actually spend is longer than they can tolerate.

2.2.2 Compare against baseline (H0 vs. H1)

Figure 2.2 shows, for each student, how far the total time (queueing + waiting for food + finding a seat) is above or below that student’s own maximum tolerated wait; the gap is total − tolerated, so a value above 0 means longer than tolerated. A histogram of the gap shows its shape, which decides between a t-test (needs roughly normal data) and a Wilcoxon signed-rank test (does not); Section 1.2 already found the gap to be right-skewed. No test yet; the red line marks 0, the point of no difference.

gap_n <- df$gap_min

hchart(hist(gap_n, breaks = "Sturges", plot = FALSE)) %>%
  hc_title(text = "Most students spend longer than they say they can tolerate") %>%
  hc_xAxis(title = list(text = "Gap = total time − maximum tolerated wait (minutes)"),
           plotLines = list(list(value = 0, color = "#d62728", width = 2, dashStyle = "Dash",
                                 label = list(text = "Tolerance limit")))) %>%
  hc_yAxis(title = list(text = "Respondents")) %>%
  hc_legend(enabled = FALSE) %>%
  hc_chart(zoomType = "xy")

The gap runs from -11 to 30 minutes, and 81.1% (95% CI 71.5%–88.6%) of students have a gap above 0 (total time longer than tolerated). This is a descriptive picture, so the formal p-value follows in Table 2.3. The bulk of the distribution sits to the right of the red line, so being over the tolerance limit is the typical experience at lunch time, not the exception. Both the times and the tolerance are answer ranges turned into midpoints, so a gap of a few minutes is imprecise; Table 2.3 tests the gap formally.

Table 2.3 tests whether students’ total time is really longer than their tolerated wait, or whether the gap in Figure 2.2 could be chance. Because the gap is not normal (Shapiro–Wilk p = 0.012, skewness 0.74), the Wilcoxon signed-rank test is the main test, with the one-sample t-test shown as a check; both are two-sided with effect sizes (r for Wilcoxon, d for the t-test). The typical gap is 0 (total time equals tolerated wait); H1: it is not 0.

sw_gap <- shapiro.test(gap_n)
tt <- t.test(gap_n, mu = 0)
wt <- wilcox.test(gap_n, mu = 0, conf.int = TRUE, exact = FALSE, correct = TRUE)
n_nz  <- sum(gap_n != 0)                                   # the Wilcoxon test drops pairs with gap = 0
z_w   <- qnorm(wt$p.value / 2, lower.tail = FALSE)
r_w   <- z_w / sqrt(n_nz)
d_z   <- mean(gap_n) / sd(gap_n)
oc    <- prop_ci(sum(df$over_tol), nrow(df))

gap_tbl <- tibble(
  Test      = c("Wilcoxon signed-rank (typical gap, Hodges–Lehmann)", "One-sample t-test (mean gap)"),
  Estimate  = c(unname(wt$estimate), unname(tt$estimate)),
  CI_low    = c(wt$conf.int[1], tt$conf.int[1]),
  CI_high   = c(wt$conf.int[2], tt$conf.int[2]),
  Statistic = c(unname(wt$statistic), unname(tt$statistic)),
  p         = c(wt$p.value, tt$p.value),
  Effect    = c(paste0("r = ", num(r_w)), paste0("d = ", num(d_z)))
)

gap_tbl %>% transmute(Test, `Estimate (min)` = num(Estimate), `95% CI` = paste0(num(CI_low), " – ", num(CI_high)),
                      Statistic = num(Statistic), `p-value` = p_txt(p), `Effect size` = Effect) %>%
  show_dt(caption = "Table 2.3 — Is total time longer than the tolerated wait? (H0: gap = 0)")

The typical gap is 6.00 (95% CI 4.75 to 7.50) minutes (Wilcoxon, p < 0.001, so we reject H0) and the mean gap is 6.53 (95% CI 5.05 to 8.01) minutes (t-test, p < 0.001); 0 lies outside both intervals. The effect sizes are r = 0.76 and d = 0.92, both large by the usual benchmarks (r above 0.5, d above 0.8). Statistical significance is not the only point: the gap is several minutes in a visit that averages 16.2 minutes, and it is borne by 81% of students. The times are self-reported ranges and the tolerance is a stated, not observed, limit; Section 5.1 re-runs this test under different assumptions.

2.3 Interpret & Recommend

Statistical significance vs. practical importance. The test is highly significant (p < 0.001), but significance alone only says the gap is not zero. The practical size matters more: the average total time (16.2 min) is about 68% longer than the average tolerated wait (9.7 min), so a typical student loses roughly 7 extra minutes of a lunch break at the canteen, and 81% of students (95% CI 71%–89%) are affected.

Direct recommendations. (1) Treat total time, not a single stage, as the target: the problems are spread over queueing, the kitchen and seating (Figure 2.1), so the canteen should set a target for total time at the lunch peak and measure it. (2) Because difficulty finding a table for a group is the most widespread problem (Table 2.2), seat management is the first operational lever, and stock-outs, affecting about half of students weekly, call for better stock planning at the peak.

Data limits. Waiting times are answer ranges converted to midpoints, so the gap is approximate; the tolerance is what students say, not what they do; and the sample is a convenience sample of mostly lunchtime IU diners.

3 Research Question 2: What factors contribute to the bottlenecks identified by students?

3.1 Describe

Table 3.1 shows how waiting time and overall satisfaction differ across the factors RQ2 asks about: how full the canteen was (crowding), the usual visit time, IU vs. non-IU students, and what students do after eating. Each factor is a small set of groups, so the median and mean of total time (the median is safer for skewed data, Section 1.2), the mean seat-search time and the mean overall satisfaction are shown per group with the group size. No test is run here; Section 3.2 tests the differences.

grp_desc <- function(d, var, label) {
  d %>% group_by(level = .data[[var]]) %>%
    summarise(n = n(), median_total = median(total_min), mean_total = mean(total_min),
              mean_seat = mean(seat_min), mean_sat_overall = mean(SatOverall), .groups = "drop") %>%
    mutate(level = as.character(level), factor = label, .before = 1)
}

grp_tbl <- bind_rows(
  grp_desc(df, "fullness",   "Crowding on arrival"),
  grp_desc(df, "visit_time", "Usual visit time"),
  grp_desc(df, "IUStudent",  "Student group"),
  grp_desc(df, "StayReason", "After eating")
)

show_dt(grp_tbl, caption = "Table 3.1 — Waiting time and satisfaction by group",
        colnames = c("Factor", "Group", "n", "Median total (min)", "Mean total (min)", "Mean seat search (min)", "Mean overall satisfaction (1–5)"),
        n = nrow(grp_tbl))

Total time rises steadily with crowding: the median is 9 minutes when the canteen was under 50% full, 16 and 16.5 minutes at 50–75% and 76–95%, and 33 minutes when it was full (100%), while mean overall satisfaction falls from 4.47 to 3.33. By visit time the medians are close (12 to 16 minutes), and IU and non-IU students are similar (16 vs. 14.5 minutes). No p-values are given in a descriptive table. How crowded the canteen is at the moment of arrival looks more important than the clock time or who the student is. Several groups are small (6 students at 100% full, 4 who study after eating, 20 non-IU), so these gaps may be noise; Section 3.2 tests them.

Figure 3.1 shows the spread of total time at each crowding level, which a table of medians hides. A boxplot (median, quartiles and outliers) suits a skewed numeric variable compared across ordered groups. No test is run.

hcboxplot(x = df$total_min, var = df$fullness, outliers = TRUE) %>%
  hc_chart(type = "column", zoomType = "xy") %>%
  hc_title(text = "Total time grows with crowding, and the fullest canteen has the longest visits") %>%
  hc_xAxis(title = list(text = "Crowding on arrival")) %>%
  hc_yAxis(title = list(text = "Total time (minutes)"))

The box moves upward with each crowding level, and the box for a full canteen sits well above the others, with a median of about 33 minutes. This is a picture, so no p-value is attached. The students who arrive when the canteen is full wait roughly twice as long as those who arrive at half-full, which is the group the canteen could help most. The 100% group has only 6 students, so its box is fragile; Table 3.2 tests the differences with a method that suits small groups.

3.2 Analyze

3.2.1 Compare (group differences and categorical tests)

Table 3.2 asks whether waiting times really differ between three or more groups: crowding levels, visit times and what students do after eating. The Kruskal–Wallis test is used because the times are not normal (Section 1.2) and some groups are small (6 to 12 students), with epsilon-squared as the effect size and the ANOVA p-value as a check; p-values are adjusted for 7 tests with the Holm method. The waiting time has the same distribution in all groups.

kw_specs <- tribble(
  ~key,             ~var,        ~grp,         ~outcome,           ~factor_label,
  "total~fullness", "total_min", "fullness",   "Total time",       "Crowding on arrival",
  "seat~fullness",  "seat_min",  "fullness",   "Seat search time", "Crowding on arrival",
  "queue~fullness", "queue_min", "fullness",   "Queuing time",     "Crowding on arrival",
  "total~visit",    "total_min", "visit_time", "Total time",       "Usual visit time",
  "queue~visit",    "queue_min", "visit_time", "Queuing time",     "Usual visit time",
  "seat~visit",     "seat_min",  "visit_time", "Seat search time", "Usual visit time",
  "total~stay",     "total_min", "StayReason", "Total time",       "What students do after eating"
)

kw_tbl <- pmap_dfr(kw_specs, function(key, var, grp, outcome, factor_label) {
  x <- df[[var]]; f <- factor(df[[grp]]); k <- kruskal.test(x ~ f)
  tibble(key = key, Outcome = outcome, Factor = factor_label, groups = nlevels(f),
         H = unname(k$statistic), df = unname(k$parameter), p = k$p.value,
         epsilon2 = unname(k$statistic) / (length(x) - 1),
         p_anova = summary(aov(x ~ f))[[1]][["Pr(>F)"]][1])
}) %>% mutate(p_holm = p.adjust(p, "holm"))

kwv <- function(key, col) kw_tbl[[col]][kw_tbl$key == key]

kw_tbl %>% transmute(Outcome, Factor, Groups = groups, H = num(H, 2), df, `p-value` = p_txt(p),
                     `p (Holm)` = p_txt(p_holm), `Effect size (ε²)` = num(epsilon2, 3), `ANOVA p` = p_txt(p_anova)) %>%
  show_dt(caption = "Table 3.2 — Kruskal–Wallis tests of waiting time across groups")

Crowding clearly matters: total time differs across crowding levels (H = 24.6, p < 0.001, ε² = 0.28, so we reject H0), and the same holds for seat search and queuing time after the Holm adjustment. Visit time does not matter for total time (p = 0.522, ε² = 0.025, so we cannot reject H0), and what students do after eating gives a borderline raw p = 0.049 that is not significant once adjusted (Holm p = 0.196). An effect of ε² = 0.28 is large (benchmarks: 0.01 small, 0.08 medium, 0.26 large), so crowding explains a real share of why waits differ, whereas the clock time and lingering at the tables do not show reliable effects. Differences between crowding levels do not say that crowding causes waiting, since long queues may themselves make the canteen look full, and the 100% group has only 6 students; Table 3.6 measures the strength of the link.

Table 3.3 checks the common belief that non-IU students (n = 20) slow the canteen down, by comparing them with IU students (n = 70) on waiting times and satisfaction. The Mann–Whitney U test (Wilcoxon rank-sum) suits two unequal groups of non-normal data; it is reported with the Hodges–Lehmann shift (IU minus non-IU) and its 95% CI, the effect size r, and Holm-adjusted p-values across 7 measures. The measure has the same distribution for IU and non-IU students.

mw_specs <- c(queue_min = "Queuing time (min)", food_min = "Waiting for food (min)",
              seat_min = "Seat search time (min)", total_min = "Total time (min)",
              SatSeating = "Satisfaction: seats (1–5)", SatCleanliness = "Satisfaction: cleanliness (1–5)",
              SatOverall = "Satisfaction: overall (1–5)")

mw_row <- function(var, label) {
  x <- df[[var]]; g <- df$IUStudent
  w <- wilcox.test(x ~ g, conf.int = TRUE, exact = FALSE)
  z <- qnorm(w$p.value / 2, lower.tail = FALSE)
  tibble(Measure = label, median_IU = median(x[g == "IU student"]), median_nonIU = median(x[g == "Non-IU student"]),
         shift = unname(w$estimate), ci_lo = w$conf.int[1], ci_hi = w$conf.int[2],
         W = unname(w$statistic), p = w$p.value, r = z / sqrt(length(x)))
}

mw_tbl <- map2_dfr(names(mw_specs), unname(mw_specs), mw_row) %>% mutate(p_holm = p.adjust(p, "holm"))

mw_tbl %>% transmute(Measure, `Median IU` = median_IU, `Median non-IU` = median_nonIU,
                     `Shift IU − non-IU` = num(shift), `95% CI` = paste0(num(ci_lo), " – ", num(ci_hi)),
                     `p-value` = p_txt(p), `p (Holm)` = p_txt(p_holm), `Effect size r` = num(r)) %>%
  show_dt(caption = "Table 3.3 — IU (n = 70) vs. non-IU (n = 20) students")

For total time the typical difference is 0.00 (95% CI -3.00 to 4.00) minutes (IU minus non-IU, p = 0.622, so we cannot reject H0), and 0 of the 7 measures reaches p < 0.05 (smallest raw p = 0.155). The largest effect size is r = 0.15, which is small (below 0.3). The data give no evidence that non-IU students wait longer or are less satisfied, so blaming outsiders is not supported empirically. With only 20 non-IU students the intervals are wide and a real but modest difference could be missed (absence of evidence is not evidence of absence); Tables 3.4–3.5 look at what each group believes.

Table 3.4 shows what IU and non-IU students believe is the main cause of overcrowding and how clear they find the canteen rules, because perceptions shape which fixes students will accept. Counts with row percentages within each group are used because the groups differ in size and both variables are categories. No test is run here; Table 3.5 tests it.

perc <- bind_rows(
  df %>% count(IUStudent, level = OvercrowdCauses) %>% mutate(variable = "Main cause of overcrowding"),
  df %>% count(IUStudent, level = RuleClarity)     %>% mutate(variable = "Clarity of canteen-use rules")
) %>%
  group_by(variable, IUStudent) %>% mutate(share = n / sum(n)) %>% ungroup() %>%
  mutate(cell = paste0(n, " (", pct(share), ")")) %>%
  select(variable, level, IUStudent, cell) %>%
  pivot_wider(names_from = IUStudent, values_from = cell, values_fill = "0 (0.0%)") %>%
  arrange(variable, level)

show_dt(perc, caption = "Table 3.4 — Perceptions by student group: n (row %)",
        colnames = c("Question", "Answer", "IU students (n = 70)", "Non-IU students (n = 20)"), n = nrow(perc))

Both groups mostly blame the large number of users, including students from other universities (38 of 70 IU students, 54.3%; 10 of 20 non-IU students, 50.0%), so the two groups give a similar picture of the cause. The rules are called “not clear yet” by 20 of 70 IU students (28.6%) but only 1 of 20 non-IU students (5.0%). No p-value is attached to percentages in a descriptive table. IU students themselves, who are the majority of users, are the group that finds the rules unclear, which matters for any plan based on rules or zones. Some answer cells hold 1 to 3 people, so chi-square assumptions are not met; Table 3.5 uses a test that suits small counts.

Table 3.5 tests whether the differences between IU and non-IU students in Table 3.4 are larger than chance. Several cells have fewer than 5 expected students, so Fisher’s exact test (Monte Carlo version for tables larger than 2×2, 20,000 draws) is the main test, with the chi-square p-value and Cramér’s V (effect size) shown for comparison; p-values are Holm-adjusted for the 2 tests. Student group and the answer are independent (no association).

cat_row <- function(var, label) {
  tb  <- table(df$IUStudent, df[[var]])
  chi <- suppressWarnings(chisq.test(tb, correct = FALSE))
  set.seed(2026)
  fe  <- fisher.test(tb, simulate.p.value = TRUE, B = 20000)
  tibble(Variable = label, chi2 = unname(chi$statistic), df = unname(chi$parameter), p_chi = chi$p.value,
         p_fisher = fe$p.value,
         cramers_V = sqrt(unname(chi$statistic) / (sum(tb) * (min(dim(tb)) - 1))),
         min_expected = min(chi$expected))
}

cat_tbl <- bind_rows(cat_row("OvercrowdCauses", "Main cause of overcrowding"),
                     cat_row("RuleClarity", "Clarity of canteen-use rules")) %>%
  mutate(p_holm = p.adjust(p_fisher, "holm"))

cat_tbl %>% transmute(Variable, `Chi-square` = num(chi2, 2), df, `p (chi-square)` = p_txt(p_chi),
                      `p (Fisher)` = p_txt(p_fisher), `p (Fisher, Holm)` = p_txt(p_holm),
                      `Cramér's V` = num(cramers_V), `Smallest expected count` = num(min_expected, 1)) %>%
  show_dt(caption = "Table 3.5 — IU vs. non-IU: association with perceptions")

The main cause of overcrowding is unrelated to student group (Fisher p = 0.953, Cramér’s V = 0.09, so we cannot reject H0). Rule clarity is borderline: Fisher p = 0.042 (we reject H0) but chi-square p = 0.057 and Holm-adjusted p = 0.085, with V = 0.29 (medium). Students of both groups agree on the cause, and the sign that IU students find the rules less clear is worth acting on cheaply (publish the rules) but should not be treated as firm evidence. The result depends on one non-IU student saying “not clear yet”, and several smallest expected counts are below 5, so it is fragile.

3.2.2 Find a relationship (correlation)

Figures 3.2 and 3.3 look at the shape of two relationships before any coefficient is computed: whether finding a seat takes longer when the canteen is crowded, and whether students who notice more outside students also report longer seat searches. A boxplot per level of an ordered variable shows whether the trend is steadily rising (suited to Spearman’s rank correlation) or bent. No test is run.

hcboxplot(x = df$seat_min, var = df$fullness, outliers = TRUE) %>%
  hc_chart(type = "column", zoomType = "xy") %>%
  hc_title(text = "Finding a seat takes longer as the canteen fills up") %>%
  hc_xAxis(title = list(text = "Crowding on arrival")) %>%
  hc_yAxis(title = list(text = "Seat search time (minutes)"))

The median seat-search time is 1 minute when the canteen is under 50% full and 10.25 minutes when it is full, rising in steps. This is a picture, so no p-value yet. The trend is steady, so a rank-based correlation is appropriate. The seat-search times come from only four ranges, so many students tie at the same value; Table 3.6 gives the strength of the link.

Figure 3.3 asks whether noticing outside students goes with longer seat searches, the other half of the common explanation for the bottleneck. A boxplot by how often the student notices outsiders (Never to Always). No test is run.

hcboxplot(x = df$seat_min, var = df$ext_f, outliers = TRUE) %>%
  hc_chart(type = "column", zoomType = "xy") %>%
  hc_title(text = "Noticing outside students shows no clear link to seat search time") %>%
  hc_xAxis(title = list(text = "How often the student notices students from other universities")) %>%
  hc_yAxis(title = list(text = "Seat search time (minutes)"))

The boxes are at similar heights across the five answers with no steady upward trend, which suggests no link between noticing outsiders and the real seat-search time. This is a picture, so Table 3.6 gives the p-value. The perceived presence of outsiders does not line up with longer actual searches for a seat. Some answers (“Never”, “Always”) hold few students, so the boxes are uneven; the correlations follow.

Table 3.6 measures how strong and in which direction crowding and the noticing of outsiders are related to waiting times and seat satisfaction. Spearman’s rho is used because crowding and the notice score are ordered categories and times are skewed; the 95% CI uses the Bonett–Wright approximation; correlation does not prove causation. There is no monotonic association (rho = 0).

cor_specs <- tribble(
  ~key,            ~x,           ~y,           ~label,
  "full~queue",    "full_score", "queue_min",  "Crowding vs. queuing time",
  "full~seat",     "full_score", "seat_min",   "Crowding vs. seat search time",
  "full~total",    "full_score", "total_min",  "Crowding vs. total time",
  "ext~seat",      "ext_score",  "seat_min",   "Noticing outsiders vs. seat search time",
  "ext~total",     "ext_score",  "total_min",  "Noticing outsiders vs. total time",
  "ext~satseat",   "ext_score",  "SatSeating", "Noticing outsiders vs. seat satisfaction"
)

cor_tbl <- pmap_dfr(cor_specs, function(key, x, y, label) {
  spearman_ci(df[[x]], df[[y]]) %>% mutate(key = key, label = label, .before = 1)
}) %>% mutate(p_holm = p.adjust(p, "holm"))

cor_tbl %>% transmute(Pair = label, n, `Spearman rho` = num(rho), `95% CI` = paste0(num(lo), " – ", num(hi)),
                      `p-value` = p_txt(p), `p (Holm)` = p_txt(p_holm)) %>%
  show_dt(caption = "Table 3.6 — Spearman correlations")

Crowding is moderately related to total time (rho = 0.45 (95% CI 0.26 to 0.61), p < 0.001, so we reject H0) and to seat search time (rho = 0.38 (95% CI 0.18 to 0.55), p < 0.001). Noticing outsiders is unrelated to seat search time (rho = -0.08 (95% CI -0.28 to 0.13), p = 0.473) but goes with lower seat satisfaction (rho = -0.30 (95% CI -0.48 to -0.10), Holm p = 0.012). Crowding goes with a medium-sized increase in every stage of the wait, while the sense that “outsiders are here” is a feeling about seats rather than a longer actual search. These are associations, and perception and satisfaction are both self-reported, which can inflate their link; the regression in Table 3.8 asks which service stage matters most for overall satisfaction.

3.2.3 Predict (multiple regression)

Table 3.7 checks that the five service ratings, which will be used together to predict overall satisfaction, are not so closely related that their effects cannot be told apart. The variance inflation factor (VIF) of each predictor; values below 5 are usually acceptable and below 10 tolerable. No test is run.

preds <- c("SatQueueing", "SatFoodPickup", "SatSeating", "SatCleanliness", "SatTotalTime")

vif_tbl <- tibble(
  predictor = unname(sat_lab[preds]),
  VIF = map_dbl(preds, ~ 1 / (1 - summary(lm(reformulate(setdiff(preds, .x), .x), data = df))$r.squared))
)

show_dt(vif_tbl, caption = "Table 3.7 — Variance inflation factors", colnames = c("Predictor", "VIF"))

The VIFs range from 1.78 to 2.87, all well below 5. No p-value applies. The service ratings overlap somewhat (they are rated by the same people) but not so much that the model cannot separate them. VIF only checks overlap, not whether the linear model fits; Table 3.8 fits the model and Figure 3.4 checks its residuals.

Table 3.8 estimates how much overall satisfaction changes when the rating of one service stage rises by one point, holding the other four fixed, to find which stage matters most. An ordinary least squares multiple regression, reporting the slope (point estimate) with its 95% CI and p-value, a standardised coefficient to compare stages, and a bootstrap 95% CI (2,000 resamples) as a check because the residuals may not be normal. For each stage the slope is 0 (no effect after controlling for the others).

m  <- lm(SatOverall ~ SatQueueing + SatFoodPickup + SatSeating + SatCleanliness + SatTotalTime, data = df)
gl <- broom::glance(m)
sd_y <- sd(df$SatOverall)

set.seed(2026)
boot <- replicate(2000, coef(lm(SatOverall ~ ., data = df[sample(nrow(df), replace = TRUE), c("SatOverall", preds)]))[preds])
boot_ci <- t(apply(boot, 1, quantile, probs = c(0.025, 0.975)))

coef_tbl <- broom::tidy(m, conf.int = TRUE) %>%
  filter(term != "(Intercept)") %>%
  mutate(std_beta = estimate * map_dbl(term, ~ sd(df[[.x]])) / sd_y,
         boot_lo = boot_ci[term, 1], boot_hi = boot_ci[term, 2],
         predictor = unname(sat_lab[term]))

coef_tbl %>% transmute(Predictor = predictor, `Slope` = num(estimate), `95% CI (OLS)` = paste0(num(conf.low), " – ", num(conf.high)),
                       `95% CI (bootstrap)` = paste0(num(boot_lo), " – ", num(boot_hi)),
                       `p-value` = p_txt(p.value), `Standardised β` = num(std_beta)) %>%
  show_dt(caption = paste0("Table 3.8 — Regression of overall satisfaction on five service ratings (R² = ",
                           num(gl$r.squared), ", adjusted R² = ", num(gl$adj.r.squared), ")"))

The model explains 59% of the variation in overall satisfaction (adjusted R² = 0.57, F-test p < 0.001). The largest slopes are for food pickup and availability (0.39 (95% CI 0.16 to 0.62), p < 0.001) and total time acceptable (0.31 (95% CI 0.14 to 0.47), p < 0.001), so we reject H0 for both; the other three slopes have CIs that include 0 and the queuing slope is slightly negative because of overlap with the other ratings (VIF 2.9). One extra point on food pickup raises overall satisfaction by about 0.4 points, so pickup and perceived total time are the stages where improvement is most likely to lift the overall experience. This is an association between ratings given by the same students, not proof that fixing a stage causes higher satisfaction; Figure 3.4 checks whether the model assumptions hold.

Figure 3.4 checks the linear model’s assumptions by plotting residuals against fitted values, together with a normality test of the residuals. A residual plot shows whether the spread is even and whether any pattern is left; Shapiro–Wilk tests normality. The residuals are normally distributed.

sw_res   <- shapiro.test(resid(m))
resid_df <- tibble(fitted = fitted(m), residual = resid(m))

hchart(resid_df, "scatter", hcaes(x = fitted, y = residual)) %>%
  hc_title(text = "Residuals show no strong pattern, but they are not perfectly normal") %>%
  hc_xAxis(title = list(text = "Fitted overall satisfaction")) %>%
  hc_yAxis(title = list(text = "Residual"),
           plotLines = list(list(value = 0, color = "#d62728", width = 1, dashStyle = "Dash"))) %>%
  hc_legend(enabled = FALSE) %>%
  hc_chart(zoomType = "xy")

The residuals are centred on 0 with no clear curve, but the Shapiro–Wilk test gives W = 0.946, p < 0.001, so we reject H0: the residuals are not normal. The lines of dots come from whole-number satisfaction scores and a ceiling at 5, which explains the departure; the bootstrap intervals in Table 3.8, which do not rely on normal residuals, still exclude 0 for food pickup and total time, so the main conclusion stands. With ordinal 1–5 scores a linear model is an approximation, and the model is one of several possible; Section 5.1 repeats key results under other assumptions.

3.3 Interpret & Recommend

Statistical significance vs. practical importance. Crowding on arrival is the factor with both statistical and practical weight: total time differs across crowding levels (p < 0.001, large ε² = 0.28) and correlates moderately with each stage (rho about 0.4). Student group and visit time are not significant (p = 0.622 and p = 0.522), and their effect sizes are small (r up to 0.15), so the claim that non-IU students cause the bottleneck has little empirical support, with the caution that only 20 non-IU students answered. The regression shows food pickup and the feeling of an acceptable total time as the strongest links to overall satisfaction.

Mechanism from the interviews. The two in-depth interviews from Part 1 should explain why crowding raises waiting, for example how orders and pickup queue at the same counter. Please add the verified quotes in Table 3.9; they are left as placeholders, since the transcripts are not part of the survey data.

interviews <- tribble(
  ~Finding,                                        ~`Interview quote (to be added from the transcripts)`,  ~`Mechanism it helps explain`,
  "Crowding raises every stage of the wait",       "[Quote from Interview 1]",                              "[e.g. peak-hour orders and pickup share one counter]",
  "Lingering at tables reduces available seats",   "[Quote from Interview 2]",                              "[e.g. no turnover rule at peak hours]",
  "Rules are unclear to IU students",              "[Quote from Interview 1 or 2]",                         "[e.g. no signage on peak-hour use]"
)
show_dt(interviews, caption = "Table 3.9 — Interview evidence (placeholders)")

Recommended actions. (1) Manage crowding at the 11:00–13:00 peak with extra staff or an extra counter, since total time rises most when the canteen is full. (2) Improve the pickup flow and food availability first, since these have the largest slopes for overall satisfaction. (3) Publish simple rules for seat use and peak hours, because IU students are the group who find them unclear, and manage seats actively (clearing tables, limiting lingering) rather than restricting non-IU students. Data limits: self-reported ranges, a small non-IU group, and associations that do not prove cause.

4 Research Question 3: What improvements could reduce these bottlenecks and improve service efficiency?

4.1 Describe

Figure 4.1 shows which service stage students would fix first, which is the most direct answer RQ3 can take from the survey. Students could choose one stage only, so a bar chart of counts shows the whole distribution. No test is run; Section 4.2 tests and estimates.

pri_map <- c("Ordering process" = "Queueing to order",
             "Order processing / Payment systems and equipment" = "Order processing & payment",
             "Food preparation speed" = "Food preparation (kitchen)",
             "Food pickup process" = "Waiting at pickup counter",
             "Seating management and arrangement" = "Finding a seat")

pri_counts <- df %>% count(PriorityImprovement, name = "n") %>%
  mutate(stage = unname(pri_map[PriorityImprovement]), share = round(n / nrow(df) * 100, 1)) %>%
  arrange(desc(n))

hchart(pri_counts, type = "bar", hcaes(x = stage, y = n, share = share), name = "Respondents") %>%
  hc_plotOptions(bar = list(dataLabels = list(enabled = TRUE))) %>%
  hc_tooltip(pointFormat = "<b>{point.y}</b> of 90 students ({point.share}%)") %>%
  hc_title(text = "Payment systems and seating are the most-wanted fixes; pickup is rarely chosen") %>%
  hc_xAxis(title = list(text = "Stage to fix first")) %>%
  hc_yAxis(title = list(text = "Number of students (one choice each)")) %>%
  hc_legend(enabled = FALSE) %>%
  hc_chart(zoomType = "xy")

Order processing and payment is chosen by 27 of 90 students (30.0%) and seating management by 26 (28.9%), followed by ordering (18, 20.0%), food preparation (15, 16.7%) and food pickup (4, 4.4%). No p-value is attached to a description. Students ask first for faster payment and better seating, even though queueing and the kitchen were named most often as bottlenecks (Figure 2.1). Each student gave one answer, so a stage that is a close second is hidden; Table 4.2 links these choices to the bottlenecks students named.

Figure 4.2 shows what students say they would do when the canteen is overcrowded, which indicates the demand the canteen may lose. A bar chart of counts for four mutually exclusive answers, all of which mean not eating at the canteen. No test is run.

alt_counts <- df %>% count(alt_short, name = "n") %>%
  mutate(share = round(n / nrow(df) * 100, 1)) %>% arrange(desc(n))

hchart(alt_counts, type = "bar", hcaes(x = alt_short, y = n, share = share), name = "Respondents") %>%
  hc_plotOptions(bar = list(dataLabels = list(enabled = TRUE))) %>%
  hc_tooltip(pointFormat = "<b>{point.y}</b> of 90 students ({point.share}%)") %>%
  hc_title(text = "When the canteen is overcrowded, almost half of students would order delivery") %>%
  hc_xAxis(title = list(text = "What the student would do")) %>%
  hc_yAxis(title = list(text = "Number of students")) %>%
  hc_legend(enabled = FALSE) %>%
  hc_chart(zoomType = "xy")

Ordering delivery through an app is the most common answer (41 of 90, 45.6%), followed by eating at stalls outside (18, 20.0%), buying packaged food at a convenience store (16, 17.8%) and skipping lunch until the afternoon (15, 16.7%). All four answers mean the canteen loses the sale, and no p-value is given for a description. Overcrowding pushes demand away from the canteen, and the largest share goes to a service (delivery) that the canteen could compete with by offering its own pre-order. This is stated, hypothetical behaviour and does not say how often it happens; Table 4.3 gives confidence intervals.

Table 4.1 groups the 49 open-ended suggestions into themes, to show which improvements students ask for in their own words. A first-pass keyword coding of the comments into five themes (one comment can fall into several), with counts and shares. No test is run.

themes <- tribble(
  ~theme,                                             ~pattern,
  "Add staff / counters / capacity",                  "larger|bigger|more (food )?counter|more staff|hire|add more|expand",
  "Seating and table management",                     "table|seat|layout|rearrange|chair|sleep|study|linger",
  "Priority for IU students / check student status",  "priorit|only iu|non-iu|external|outside|separate|two areas|verify|check who|limit|fee",
  "Apps / online pre-ordering",                       "\\bapps?\\b|online|pre-order|website|kiosk|notif|message|\\bqr\\b",
  "Trays and cleanliness",                            "tray|clean|trash|return|dish"
)

fb <- df %>% filter(!is.na(FeedbackSuggestions)) %>% mutate(text = str_to_lower(FeedbackSuggestions))
theme_counts <- themes %>% mutate(x = map_int(pattern, ~ sum(str_detect(fb$text, .x))), N = nrow(fb))
n_uncoded <- sum(!map_lgl(fb$text, ~ any(str_detect(.x, themes$pattern))))

theme_counts %>% transmute(Theme = theme, n = x, Share = pct(x / N)) %>%
  arrange(desc(n)) %>%
  show_dt(caption = paste0("Table 4.1 — Themes in the open suggestions (", nrow(fb), " comments)"))

Of the 49 comments, adding staff or capacity and managing seating each appear in 15 (30.6%), priority or checking of student status in 12 (24.5%), apps or online ordering in 5 (10.2%) and trays or cleanliness in 3 (6.1%), while 14 comments match no theme. No p-value is attached to counts of comments. Students’ own words agree with the survey scales: more capacity at peak and better seat management come first. Only 49 of 90 students wrote a comment, keyword coding is a first pass that should be checked by reading the comments, and Table 4.3 gives confidence intervals.

4.2 Analyze

4.2.1 Categorical association

Table 4.2 asks whether students want to fix first the stage they say is a bottleneck, which would show that the stages named in RQ1 are the stages students want improved. The “worst stage” is taken as the stage a student named as a bottleneck (multi-select), and for each stage Fisher’s exact test (chosen because several cells have fewer than 5 students) compares students who named the stage with those who did not on whether they chose it as first priority; the odds ratio has a 95% CI and p-values are Holm-adjusted for 5 tests. Naming a stage as a bottleneck is independent of choosing it as the first priority (odds ratio = 1).

assoc_map <- tibble(priority = names(pri_map),
                    bn = c("BN_Queueing", "BN_Payment", "BN_Kitchen", "BN_Pickup", "BN_Seating"),
                    stage = unname(pri_map))

assoc <- pmap_dfr(assoc_map, function(priority, bn, stage) {
  named  <- df[[bn]] == 1
  chosen <- df$PriorityImprovement == priority
  tb <- table(factor(named, c(TRUE, FALSE)), factor(chosen, c(TRUE, FALSE)))
  fe <- fisher.test(tb)
  tibble(stage = stage, n_named = sum(tb[1, ]),
         chosen_if_named = tb[1, 1] / sum(tb[1, ]), chosen_if_not = tb[2, 1] / sum(tb[2, ]),
         odds_ratio = unname(fe$estimate), or_lo = fe$conf.int[1], or_hi = fe$conf.int[2], p = fe$p.value)
}) %>% mutate(p_holm = p.adjust(p, "holm"))

assoc %>% transmute(Stage = stage, `Named as bottleneck (n)` = n_named,
                    `Chosen first if named` = pct(chosen_if_named), `Chosen first if not named` = pct(chosen_if_not),
                    `Odds ratio` = num(odds_ratio, 1), `95% CI` = paste0(num(or_lo, 1), " – ", num(or_hi, 1)),
                    `p-value` = p_txt(p), `p (Holm)` = p_txt(p_holm)) %>%
  show_dt(caption = "Table 4.2 — Is a stage named as a bottleneck also chosen as the first priority?")

For queueing, 35% of the students who named it chose it first versus 9% of those who did not (odds ratio 5.1 (95% CI 1.5 to 20.5), Fisher p = 0.006, Holm p = 0.031, so we reject H0 after adjustment). For the other four stages the Holm-adjusted p-value is at or above = 0.085, so we cannot show the same link. Students who suffer from queueing are the ones who want it fixed, while payment and seating are wanted fixes by many students whether or not they named them, which points to general rather than personal problems. Students could name up to two stages, so “worst” is approximate, and several cells are very small; Table 4.3 estimates how large each demand is.

4.2.2 Estimation of demand loss and solutions

Table 4.3 estimates, for all students who use the canteen, how large the lost demand is, which stage students want fixed first, and how common each suggested solution is, to show managers how urgent each is. The exact (Clopper–Pearson) 95% CI for each share; suggestion shares are out of the 49 students who wrote a comment. Estimation has no H0.

est2 <- bind_rows(
  df %>% count(item = alt_short, name = "x") %>%
    mutate(N = nrow(df), block = "What students would do when overcrowded (lost demand)"),
  df %>% mutate(item = unname(pri_map[PriorityImprovement])) %>% count(item, name = "x") %>%
    mutate(N = nrow(df), block = "Stage to fix first"),
  theme_counts %>% transmute(item = theme, x, N, block = "Themes in open suggestions (students who commented)")
) %>%
  rowwise() %>% mutate(ci = list(prop_ci(x, N))) %>% unnest(ci) %>% ungroup()

e2 <- function(item) { r <- est2[est2$item == item, ]; ci_pct(r$prop, r$lo, r$hi) }

est2 %>% transmute(Block = block, Item = item, n = x, N, Estimate = pct(prop), `95% CI` = paste0(pct(lo), " – ", pct(hi))) %>%
  show_dt(caption = "Table 4.3 — Estimated shares with exact 95% CI")

An estimated 45.6% (95% CI 35.0%–56.4%) of students would turn to delivery when the canteen is overcrowded, and 16.7% (95% CI 9.6%–26.0%) would skip lunch. Among stages to fix first, order processing and payment is estimated at 30.0% (95% CI 20.8%–40.6%) and seating at 28.9% (95% CI 19.8%–39.4%), while pickup is only 4.4% (95% CI 1.2%–11.0%); among comments, capacity is mentioned in 30.6% (95% CI 18.3%–45.4%). No p-value applies to estimates. The lost demand is large: at least a third and plausibly more than half of students would leave for delivery when the canteen is crowded, which is a business case for relieving the peak. These are stated intentions from a convenience sample and the comment shares rest on 49 students, so they show direction, not exact amounts.

4.3 Interpret & Recommend

What matters in practice. The shares are large, and the intervals are wide enough that the order of the stages should not be over-read: payment and seating are the most wanted fixes (about three in ten each), and the only significant link between a named bottleneck and a priority is for queueing (Holm p = 0.031). The estimate that 45.6% (95% CI 35.0%–56.4%) would turn to delivery shows that crowding costs the canteen customers, not only time.

Table 4.4 turns the findings into an action matrix. The numbers in it come from Tables 2.2, 2.3, 3.2, 3.5, 3.8, 4.2 and 4.3.

Problem (RQ1) Evidence Likely factor (RQ2) Recommended action Who acts Feasibility
Visits longer than students tolerate 81.1% (95% CI 71.5%–88.6%) over their limit; typical gap 6.0 min, p < 0.001 Crowding at the peak (ε² = 0.28, p < 0.001) Extra staff or counter 11:00–13:00; set and track a total-time target Canteen management Medium (staffing cost)
Hard to find a table for a group 84.4% (95% CI 75.3%–91.2%) Crowding and lingering at tables (rho with seat search time 0.38) Active table clearing at peak, zoned or time-limited seating, rearranged layout Canteen management and university facilities Medium
Food pickup and perceived total time drive the experience Slopes 0.39 and 0.31, both p < 0.001 Kitchen flow, stock-outs (48.9% (95% CI 38.2%–59.7%) weekly) Stock planning for peak items; separate ordering and pickup flow Canteen management High (internal change)
Lost demand to delivery and outside food 45.6% (95% CI 35.0%–56.4%) would use delivery Overload with no pre-order option Pilot online pre-order with a pickup window Canteen management with university IT Medium (needs a system)
Rules unclear to IU students Fisher p = 0.042, Holm p = 0.085 (fragile) No visible peak-hour rules Publish simple seat and peak-hour rules University High (low cost)
Blame on non-IU students Total-time difference p = 0.622, r ≤ 0.15 Not supported by the data Do not restrict access on this evidence; recheck with a larger non-IU sample University n/a

Data limits. The survey is a convenience sample of mostly IU lunchtime diners, answers are self-reported ranges, the demand-loss answers are intentions, and the open comments cover 49 students, so the recommendations should be tested in a small pilot before wider change.

5 Robustness & Synthesis

5.1 Sensitivity and assumption checks

Table 5.1 checks whether the main estimates, confidence intervals and p-values change when two assumptions change: the value given to the open-ended top answer (“More than 10 minutes”, 12.5 minutes in the main analysis), and the inclusion of responses flagged as inconsistent in the cleaning step. The same estimates and tests are recomputed in three scenarios: the main one, a top range of 15 minutes (and 20 minutes for the tolerance), and the main one without the 15 flagged responses. The same as in the original tests (gap = 0; rho = 0; no IU vs. non-IU difference).

key_stats <- function(d, label) {
  n  <- nrow(d); ci <- prop_ci(sum(d$over_tol), n)
  wt_s <- wilcox.test(d$gap_min, mu = 0, exact = FALSE, conf.int = TRUE)
  sp <- spearman_ci(d$full_score, d$seat_min)
  mw <- wilcox.test(total_min ~ IUStudent, data = d, exact = FALSE)
  tibble(Scenario = label, n = n, mean_total = mean(d$total_min),
         pct_over = ci$prop, pct_lo = ci$lo, pct_hi = ci$hi,
         gap = unname(wt_s$estimate), p_gap = wt_s$p.value,
         rho = sp$rho, rho_lo = sp$lo, rho_hi = sp$hi, p_rho = sp$p, p_iu = mw$p.value)
}

sens <- bind_rows(
  key_stats(df, "Main: top range = 12.5 min"),
  key_stats(add_minutes(clean, open_end = 15, tol_open = 20), "Sensitivity: top range = 15 min"),
  key_stats(df %>% filter(InconsistentTime == 0, BN_OverLimit == 0), "Excluding flagged responses")
)

sens %>% transmute(Scenario, n, `Mean total (min)` = num(mean_total, 1),
                   `% over tolerance (95% CI)` = ci_pct(pct_over, pct_lo, pct_hi),
                   `Typical gap (min)` = num(gap, 2), `p (gap = 0)` = p_txt(p_gap),
                   `Crowding vs. seat time: rho (95% CI)` = ci_num(rho, rho_lo, rho_hi), `p (rho = 0)` = p_txt(p_rho),
                   `p (IU vs. non-IU, total time)` = p_txt(p_iu)) %>%
  show_dt(caption = "Table 5.1 — Key results under different assumptions")

The share over the tolerance limit moves between 78.9% and 81.1% across scenarios (main: 81.1% (95% CI 71.5%–88.6%)), and the typical gap stays between 5.8 and 6.2 minutes with the largest p-value < 0.001. The crowding correlation stays between rho = 0.33 and 0.38 with the largest p-value = 0.003, and the IU vs. non-IU difference is never significant (smallest p = 0.602). The conclusions do not depend on how the open-ended top answer is valued or on the 15 flagged responses, so they are robust to these two choices. Only two assumptions were varied; the midpoint rule for the other ranges (for example lower or upper limits) and the regression were not re-run, and these could be added if time allows.

5.2 Main RQ synthesis and analytical governance

Table 5.2 gathers the seven core insights that answer the main RQ, each with its point estimate, 95% CI, p-value and effect size, for use in the Deliverable 3 slides. Every figure is taken from the tables above by code, so the synthesis cannot drift from the analysis. As in each original test.

qrow <- pick(est, "item", "Queueing to order")
prow <- pick(est, "item", "Waiting at pickup counter")
grow <- pick(est, "item", "Group table at least somewhat difficult")
mwt  <- pick(mw_tbl, "Measure", "Total time (min)")
ct   <- pick(cor_tbl, "key", "full~total")
cf   <- pick(coef_tbl, "term", "SatFoodPickup")
ctt  <- pick(coef_tbl, "term", "SatTotalTime")
pay  <- pick(est2, "item", "Order processing & payment")
qa   <- pick(assoc, "stage", "Queueing to order")
del  <- pick(est2, "item", "Order delivery via app")
skp  <- pick(est2, "item", "Skip lunch until the afternoon")

insights <- tibble(
  ID = paste0("I", 1:7),
  `Sub-RQ` = c("RQ1", "RQ1", "RQ2", "RQ2", "RQ2", "RQ3", "RQ3"),
  Insight = c(
    "Most students spend longer in the canteen than they say they can tolerate",
    "Finding a table for a group is the most widespread problem; no single service stage clearly dominates",
    "Crowding on arrival, not the clock time, goes with longer waits",
    "No evidence that non-IU students lengthen waits",
    "Food pickup and an acceptable total time are the strongest links to overall satisfaction",
    "Payment systems and seating are the fixes students want first; queueing is fixed first by those who suffer it",
    "Overcrowding sends a large share of demand to delivery and outside food"),
  `Point estimate (95% CI)` = c(
    ci_pct(oc$prop, oc$lo, oc$hi),
    paste0("Group-table difficulty ", ci_pct(grow$prop, grow$lo, grow$hi)),
    paste0("rho (crowding, total time) = ", ci_num(ct$rho, ct$lo, ct$hi)),
    paste0("Shift IU − non-IU = ", ci_num(mwt$shift, mwt$ci_lo, mwt$ci_hi), " min"),
    paste0("Food pickup slope = ", ci_num(cf$estimate, cf$conf.low, cf$conf.high)),
    paste0("Payment first: ", ci_pct(pay$prop, pay$lo, pay$hi)),
    paste0("Delivery: ", ci_pct(del$prop, del$lo, del$hi))),
  `p-value` = c(
    p_txt(wt$p.value), "n/a (estimation)", p_txt(ct$p), p_txt(mwt$p), p_txt(cf$p.value),
    paste0("Queueing link: ", p_txt(qa$p), " (Holm ", p_txt(qa$p_holm), ")"), "n/a (estimation)"),
  `Effect size / note` = c(
    paste0("Typical gap ", ci_num(wt$estimate, wt$conf.int[1], wt$conf.int[2], 1), " min; r = ", num(r_w)),
    paste0("Stage shares range from ", pct(prow$prop), " to ", pct(qrow$prop), "; intervals overlap"),
    paste0("Kruskal–Wallis ε² = ", num(kwv("total~fullness", "epsilon2"))),
    paste0("r = ", num(mwt$r), " (small); only 20 non-IU students"),
    paste0("Total-time slope = ", ci_num(ctt$estimate, ctt$conf.low, ctt$conf.high), "; R² = ", num(gl$r.squared)),
    paste0("Queueing odds ratio = ", num(qa$odds_ratio, 1), " (95% CI ", num(qa$or_lo, 1), " to ", num(qa$or_hi, 1), ")"),
    paste0("Skip lunch: ", ci_pct(skp$prop, skp$lo, skp$hi)))
)

show_dt(insights, caption = "Table 5.2 — Core insights for the main RQ")

The seven insights show that students’ visits run longer than they can tolerate (81.1% (95% CI 71.5%–88.6%), p < 0.001), that crowding is the clearest factor behind this (ε² = 0.28), and that the fixes students ask for first are payment and seating. For the Deliverable 3 slides, the story is: long waits at the peak, driven by crowding and not by who the student is, concentrated in pickup, seating and payment, with delivery taking the lost demand. The effect sizes are from a single convenience sample, so the slides should show intervals and not only the point estimates.

Analytical governance note. Group 02 should confirm this statement before submission: every number in this notebook is produced by code that runs from the cleaned data, and the choice of each test followed the data (normality in Section 1.2, expected counts in Table 3.5, VIF and residuals in Tables 3.7–3.8 and Figure 3.4). AI was used as a drafting aid for code and wording; its output was not copied as results, and the group re-checked the assumptions and the numbers independently.

Limitations. (1) Convenience sample of 90, mostly IU students at lunchtime, so intervals probably understate real uncertainty. (2) Waiting times are answer ranges turned into midpoints. (3) Tolerance, satisfaction and perceptions are self-reported, so correlations may be inflated. (4) Only 20 non-IU students, so comparisons with them have low power. (5) Associations do not prove cause.