Study. A county library system takes a random sample of 20 visits at each of its three branches (Campus, Downtown, Northside), 60 visits in all. For each visit it records the minutes spent in the branch (minutes), the number of items checked out (items), and whether the visitor used self-checkout (selfcheck). Branch is observed, not assigned.
Research Question A: Is branch associated with mean minutes per visit? (ANOVA, then Tukey) Research Question B: Is the number of items checked out associated with minutes per visit? (simple regression) Research Question C: Is branch associated with self-checkout use? (chi-square test)
For Research Question A, define in context and write the hypotheses in notation.
# Research Question A: minutes per visit by branch (20 random visits per branch)
> summary(aov(minutes ~ branch, data = visits))
Df Sum Sq Mean Sq F value Pr(>F)
branch 2 520 260 7.222 0.0016 **
Residuals 57 2052 36
> TukeyHSD(aov(minutes ~ branch, data = visits))
Tukey multiple comparisons of means
95% family-wise confidence level
$branch
diff lwr upr p adj
Downtown-Campus -5 -9.5658574 -0.4341426 0.0287
Northside-Campus 2 -2.5658574 6.5658574 0.5462
Northside-Downtown 7 2.4341426 11.5658574 0.0014
# Sample means (minutes): Campus 29, Downtown 24, Northside 31
# Research Question B: minutes per visit by items checked out (all 60 visits)
> summary(lm(minutes ~ items, data = visits))
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 20.0000 2.3542 8.495 9.1e-12 ***
items 1.8000 0.5000 3.600 0.00066 ***
Residual standard error: 6.02 on 58 degrees of freedom
Multiple R-squared: 0.1826, Adjusted R-squared: 0.1685
> confint(lm(minutes ~ items, data = visits))
2.5 % 97.5 %
(Intercept) 15.287510 24.71249
items 0.799141 2.80086
# Research Question C: self-checkout use by branch
Used DidNotUse Total
Campus 9 11 20
Downtown 14 6 20
Northside 8 12 20
> chisq.test(table(visits$branch, visits$selfcheck))
Pearson's Chi-squared test
X-squared = 4.1379, df = 2, p-value = 0.1263
# Expected counts: 10.33 (Used) and 9.67 (Did not use) in every branch