Operations Analytics Using R

9 Introduction to Statistical Analysis for Operations

image

Learning Objectives

By the end of this chapter, students will be able to:

  1. Summarize operational data (mean, median, standard deviation) in Excel and R.

  2. Choose and apply Normal, Binomial, and Poisson models; compute probabilities/quantiles.

  3. Run a two-sample t-test; report the difference in means, confidence interval, and p-value.

  4. Analyze association with correlation and simple linear regression; interpret slope and R².

  5. Perform quick checks for outliers, variance, and independence; note limits of the analysis.

  6. Convert results into a concise operations recommendation.

9.1 Basic Statistical Terms (Operations Context)

In earlier chapters you organized data, improved quality, and visualized performance. Here we formalize those summaries with a few core statistics you already know from your prerequisite course, focusing on how to apply and interpret them in operations. We’ll compute each measure in Excel and mirror it in R, using two Pemi Coffee Roasters datasets: Dataset A (fulfillment times, days) and Dataset B (items per order and fulfillment time).

Mean and Median

The mean summarizes average performance; the median is the middle value and is less sensitive to a few slow orders.

  • Excel (Dataset A in B2:B25)
    =AVERAGE(B2:B25)5.875
    =MEDIAN(B2:B25)5

  • R

    dfA <- read.csv("Chapter9_Dataset_A_FulfillmentTimes.csv")
    mean(dfA$FulfillmentTimeDays) # [1] 5.875
    median(dfA$FulfillmentTimeDays) # [1] 5

Variability: Range, Variance, Standard Deviation

Consistency matters. The range is max − min. Variance and standard deviation quantify spread around the mean.

  • Excel
    =MAX(B2:B25)-MIN(B2:B25)8
    =VAR.S(B2:B25)3.592
    =STDEV.S(B2:B25)1.895

  • R

    max(dfA$FulfillmentTimeDays) - min(dfA$FulfillmentTimeDays) # [1] 8
    var(dfA$FulfillmentTimeDays) # [1] 3.592389
    sd(dfA$FulfillmentTimeDays) # [1] 1.895360

Association (Preview): Correlation

Correlation indicates whether two variables move together—for example, whether larger orders take longer to fulfill.

  • Excel (Dataset B: items in B2:B31, time in C2:C31)
    =CORREL(B2:B31, C2:C31) → 0.991
  • R

    dfB <- read.csv("Chapter9_Dataset_B_OrderSize_vs_Fulfillment.csv")
    cor(dfB$ItemsInOrder, dfB$FulfillmentTimeDays) # [1] 0.9911393

Applied Example: Fulfillment Times at Pemi (Dataset A)Excel

Mean: =AVERAGE(B2:B25)5.875

Median: =MEDIAN(B2:B25)5

Std. dev.: =STDEV.S(B2:B25)1.895

Optional histogram: Data → Data Analysis → Histogram

R

dfA <- read.csv("Chapter9_Dataset_A_FulfillmentTimes.csv")
mean(dfA$FulfillmentTimeDays) # [1] 5.875
median(dfA$FulfillmentTimeDays) # [1] 5
sd(dfA$FulfillmentTimeDays) # [1] 1.895360
hist(dfA$FulfillmentTimeDays)

Interpretation
The mean exceeds the median, indicating a right tail (a few slow orders). A standard deviation near 1.9 suggests noticeable variability. Next steps: isolate slow orders and investigate causes (capacity, supplier delays, address issues).

9.3 Hypothesis testing: two-sample t-test (small vs. large orders)

Question: do larger orders take longer to fulfill?

Define two groups in Dataset B:

  • Small orders: items ≤ 3

  • Large orders: items > 3

Set up in Excel: add a helper column size_group with
=IF(B2<=3,"Small","Large")

Compare mean fulfillment time by group using Welch’s two-sample t-test (unequal variances).

Excel

  1. Compute group means and standard deviations with =AVERAGEIFS() and =STDEV.S(IF(...)) or with filters/pivots.

  2. Data → Data Analysis → t-Test: Two-Sample Assuming Unequal Variances.

    • Variable 1 Range: times for Small

    • Variable 2 Range: times for Large

    • Hypothesized mean difference: 0

    • Output to a new range

R

dfB <- read.csv("Chapter9_Dataset_B_OrderSize_vs_Fulfillment.csv")
dfB$size_group <- ifelse(dfB$ItemsInOrder <= 3, "Small", "Large")
t.test(FulfillmentTimeDays ~ size_group, data = dfB) # Welch by default

What you should see with the provided data:

  • Difference in means ≈ 1.54 days (Large − Small)

  • 95% CI ≈ [1.22, 1.86]

  • p < 0.001

Interpretation: in this sample, larger orders take longer by about a day and a half on average. The effect is practically and statistically meaningful.

Transition: correlation and a simple linear model quantify the items → time relationship directly.

9.4 Correlation and simple linear regression

Use correlation to summarize association and a simple linear regression to estimate how much time increases per added item.

Excel

  • Correlation: =CORREL(B2:B31, C2:C31)

  • Scatterplot: Insert → Scatter. Add a trendline → display equation and R².

  • Functions: =SLOPE(C2:C31, B2:B31), =INTERCEPT(C2:C31, B2:B31), =RSQ(C2:C31, B2:B31)

R

cor(dfB$ItemsInOrder, dfB$FulfillmentTimeDays) # ≈ 0.991

m <- lm(FulfillmentTimeDays ~ ItemsInOrder, data = dfB)


summary(m)

With the provided data, you should see results close to:

  • Slope ≈ 0.430 days per additional item

  • Intercept ≈ 4.232 days

  • R² ≈ 0.982

Interpretation: each additional item adds roughly 0.43 days on average. The fit is strong in this sample. Do not extrapolate beyond the observed range without a check.

Transition: before relying on these results, confirm basic assumptions and scan for obvious issues.

9.5 Assumptions and quick diagnostics

Hypothesis tests and linear models rest on simple conditions. A few quick checks go a long way.

t-test (Small vs. Large)

  • Independence: orders should be independent observations. Segment by shift/promo if needed.

  • Shape: with n ≈ 15 per group, the t-test is robust, but heavy skew/outliers can distort results. Use group histograms or boxplots.

  • Variances: Welch’s test (used above) does not assume equal variances. If you suspect very different spreads, keep using Welch.

Excel (practical checks)

  • Build small and large group histograms or boxplots (via charts).

  • Compute group variances with =VAR.S(...).

  • If you ran the regression, add predicted values =intercept + slope*Items and create a residuals column =Actual - Predicted. Plot residuals vs. predicted; look for no pattern.

R (quick commands)

boxplot(FulfillmentTimeDays ~ size_group, data = dfB)

by(dfB$FulfillmentTimeDays, dfB$size_group, sd) # group spreads


# Regression diagnostics


plot(m, which = 1) # Residuals vs Fitted


plot(m, which = 2) # Normal Q-Q

Regression

  • Linearity: residuals vs. fitted should look like noise, not a curve.

  • Constant variance: avoid funnel shapes; consider a variance-stabilizing approach or segmenting if needed.

  • Influence: in small samples, a single unusual order can sway the fit; inspect points with large residuals.

Transition: with checks in place, synthesize findings in a brief memo that a manager can act on.

9.6 Applied assignment: Pemi memo

Goal: use the chapter workflow to answer a specific operations question and communicate a clear recommendation.

Datasets

  • Chapter9_Dataset_A_FulfillmentTimes.csv

  • Chapter9_Dataset_B_OrderSize_vs_Fulfillment.csv

Tasks

  1. Excel

    • Dataset A: mean, median, standard deviation; histogram of fulfillment times.

    • Dataset B: correlation (items vs. time); two-sample t-test (Small vs. Large).

    • Optional: scatterplot with trendline, show equation and R².

  2. R

    • Replicate Excel results with mean(), median(), sd(), hist(), cor(), t.test(), and lm().

    • Confirm that Excel and R agree within rounding.

  3. Managerial memo (1–2 paragraphs)

    • Is the difference in mean time by size group meaningful?

    • About how much time does each additional item add?

    • One concrete action you recommend (e.g., staffing during peaks, batching rules, target setting).

Deliverables

  • One Excel file with clearly labeled sheets (A_Summary, B_ttest, B_Regression).

  • One R script (.R) or R Markdown (.Rmd) with commands and printed outputs.

  • A PDF or DOCX memo.

Key Takeaways

  • Mean and median summarize central tendency; the median is less sensitive to outliers.

  • Variance and standard deviation measure variability around the mean, indicating consistency in performance.

  • Correlation quantifies the strength of association between two variables.

  • A two-sample t-test compares group means and can show whether differences are statistically significant.

  • Linear regression estimates the relationship between predictors (e.g., order size) and outcomes (e.g., fulfillment time).

  • Diagnostic checks (shape, variance, residuals) ensure statistical results are reliable for decision-making.

  • Excel and R can be used together to calculate, visualize, and cross-verify these statistics in an operations context.

Chapter Nine References

Microsoft. (n.d.). Statistical functions (reference). Microsoft. https://support.microsoft.com/en-us/excel

R Core Team. (2023). R: A language and environment for statistical computing. R Foundation for Statistical Computing. https://www.r-project.org

Wickham, H., & Grolemund, G. (2017). R for data science: Import, tidy, transform, visualize, and model data. O’Reilly Media. https://r4ds.had.co.nz

License

Icon for the Creative Commons Attribution 4.0 International License

Business Operations Analytics Copyright © by Melissa Christensen is licensed under a Creative Commons Attribution 4.0 International License, except where otherwise noted.

Share This Book