Definition of Statistics: The science dealing with the collection, analysis, interpretation, and presentation of numerical data to convert raw data into useful information for managerial decision making.
Business Applications: Used across corporate functional areas including marketing consumer surveys, operations quality tracking, teleworking productivity, and retail spend analysis.
Two Major Branches:
Core Terminology:
Nonmetric / Qualitative Data:
Metric / Quantitative Data:
department <- factor(c("Educator", "Manufacturing", "Lawyer", "Educator"))
is.factor(department)
## [1] TRUE
is.ordered(department)
## [1] FALSE
satisfaction <- factor(
c("Somewhat Helpful", "Very Helpful", "Not Helpful", "Extremely Helpful"),
levels = c(
"Not Helpful",
"Somewhat Helpful",
"Moderately Helpful",
"Very Helpful",
"Extremely Helpful"
),
ordered = TRUE
)
satisfaction[2] > satisfaction[1]
## [1] TRUE
sales_volume <- c(629, 504, 246, 172, 120)
summary(sales_volume)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 120.0 172.0 246.0 334.2 504.0 629.0
Ungrouped vs. Grouped Data: Ungrouped data are raw, unsummarized observations; grouped data are organized into classes and frequencies.
Steps in Constructing a Frequency Distribution:
Frequency Metrics:
unemp <- c(
2.3, 7.0, 6.3, 11.3, 9.6, 2.8, 7.1, 5.6, 10.6, 9.1,
3.6, 5.4, 5.9, 9.7, 8.3, 2.4, 5.5, 7.1, 8.8, 7.6,
2.9, 7.1, 4.7, 7.8, 6.8, 3.0, 8.0, 3.9, 7.5, 7.2,
4.6, 3.6, 8.4, 8.1, 7.7, 4.4, 4.1, 7.5, 10.3, 7.6,
3.4, 4.8, 7.5, 11.2, 7.2, 4.6, 4.7, 7.6, 11.4, 6.8,
6.9, 11.0, 5.9, 10.4, 6.3, 6.0, 12.0, 6.4, 9.5, 6.0
)
unemp_range <- max(unemp) - min(unemp)
n_classes <- 6
approx_width <- unemp_range / n_classes
class_width <- ceiling(approx_width)
print(sprintf("Range = %.1f | Approx Width (6 classes) = %.2f | Rounded Width = %d",
unemp_range, approx_width, class_width))
## [1] "Range = 9.7 | Approx Width (6 classes) = 1.62 | Rounded Width = 2"
bins <- seq(1, 13, by = class_width)
classes <- cut(unemp, breaks = bins, right = FALSE)
freq_table <- data.frame(table(Class = classes))
freq_table$Midpoint <- (bins[-length(bins)] + bins[-1]) / 2
freq_table$Rel_Freq <- round(freq_table$Freq / sum(freq_table$Freq), 4)
freq_table$Cum_Freq <- cumsum(freq_table$Freq)
print(freq_table)
## Class Freq Midpoint Rel_Freq Cum_Freq
## 1 [1,3) 4 2 0.0667 4
## 2 [3,5) 12 4 0.2000 16
## 3 [5,7) 13 6 0.2167 29
## 4 [7,9) 19 8 0.3167 48
## 5 [9,11) 7 10 0.1167 55
## 6 [11,13) 5 12 0.0833 60
hist(unemp, breaks = seq(1, 13, by = 2), right = FALSE,
col = "steelblue", xlab = "Unemployment Rate (%)",
main = "Histogram of Canadian Unemployment Rates")
h <- hist(unemp, breaks = seq(1, 13, by = 2), plot = FALSE, right = FALSE)
plot(h$mids, h$counts, type = "o", pch = 16, col = "darkblue",
xlab = "Class Midpoints", ylab = "Frequency",
main = "Frequency Polygon")
cum_counts <- c(0, cumsum(h$counts))
plot(bins, cum_counts, type = "o", pch = 16, col = "darkred",
xlab = "Class Endpoints", ylab = "Cumulative Frequency",
main = "Ogive")
stripchart(unemp, method = "stack", pch = 19, col = "forestgreen",
xlab = "Unemployment Rate (%)", main = "Dot Plot")
stem(unemp, scale = 1)
##
## The decimal point is at the |
##
## 2 | 3489
## 3 | 04669
## 4 | 1466778
## 5 | 45699
## 6 | 00334889
## 7 | 01112255566678
## 8 | 01348
## 9 | 1567
## 10 | 346
## 11 | 0234
## 12 | 0
Pie Chart: Circular depiction dividing \(360^\circ\) proportionally to show the percentage breakdown of subcategories to the whole (\(Degrees = Proportion \times 360^\circ\)).
Bar Graph (or Column Chart): Displays categorical variables along one axis and rectangular bars along the other axis representing magnitude, frequency, or percentage. Superior to pie charts when discriminating between categories with similar magnitudes.
Pareto Chart: Vertical bar chart used in Total Quality Management (TQM) displaying causes of defects ranked in descending order from left to right, often overlaid with a cumulative percentage line. Separates the “vital few” defects from the “trivial many”.
channels <- c("Supermarket", "Fountain", "Convenience/Gas", "Vending", "Mass Merch", "Drugstore")
market_share <- c(44, 24, 16, 11, 3, 2)
pie_degrees <- (market_share / sum(market_share)) * 360
print(data.frame(Channel = channels, Share_Pct = market_share, Degrees = pie_degrees))
## Channel Share_Pct Degrees
## 1 Supermarket 44 158.4
## 2 Fountain 24 86.4
## 3 Convenience/Gas 16 57.6
## 4 Vending 11 39.6
## 5 Mass Merch 3 10.8
## 6 Drugstore 2 7.2
pie(market_share, labels = paste(channels, market_share, "%"),
main = "Soft Drink Sales Channels")
barplot(market_share, names.arg = channels, col = "cornflowerblue",
las = 2, ylab = "Percentage of Sales", cex.names = 0.8,
main = "Bar Chart of Sales Locations")
defect_counts <- c(Poor_Wiring = 40, Short_Coil = 30, Defect_Plug = 25, Bearings = 5)
sorted_counts <- sort(defect_counts, decreasing = TRUE)
cum_counts_pareto <- cumsum(sorted_counts)
cum_pct <- cum_counts_pareto / sum(sorted_counts) * 100
print(data.frame(Defect = names(sorted_counts), Count = as.numeric(sorted_counts), Cum_Pct = cum_pct))
## Defect Count Cum_Pct
## Poor_Wiring Poor_Wiring 40 40
## Short_Coil Short_Coil 30 70
## Defect_Plug Defect_Plug 25 95
## Bearings Bearings 5 100
bp <- barplot(sorted_counts, ylim = c(0, sum(sorted_counts) * 1.15),
col = "darkorange", ylab = "Defect Count", main = "Pareto Chart")
lines(bp, cum_counts_pareto, type = "b", pch = 19, col = "red")
axis(side = 4, at = seq(0, 100, by = 25) * sum(sorted_counts) / 100, labels = paste0(seq(0, 100, by = 25), "%"))
advertising <- c(4.2, 1.6, 6.3, 2.7, 10.4, 7.1, 5.5, 8.3)
sales_revenue <- c(155.7, 87.3, 135.6, 99.0, 168.2, 136.9, 101.4, 158.2)
plot(advertising, sales_revenue,
pch = 19, col = "navy",
xlab = "Advertising ($ Millions)",
ylab = "Sales Revenue ($ Millions)",
main = "Scatter Plot: Advertising vs. Sales")
abline(lm(sales_revenue ~ advertising), col = "red", lwd = 2, lty = 2)