# What test to use to see whether the number of patients in the two hospitals is the same?

The number of patients in a given age range attending the Accident and Emergency Services of two hospitals P and Q on independent days are as follows. The days for the two hospitals are independent of each other.

It is known that the underlying distribution of the number of patients at each hospital does not follow a normal distribution.

P 52 108 84 76 23 96 78

Q 108 74 32 48 59 43 76 102 35

I want to test whether the number of patients in this age group attending A and E departments in the two hospitals are the same.

I thought the apprpriate test may be Mann-Withney-Wilcoxon but it demands the sample sizes to be the same... Shall we test means here maybe?

• The test usually called the Mann-Whitney Test does not make any assumption about equality of sample sizes. Please tell us, then, what you mean by this test.
– whuber
Feb 21 at 18:34

P = c( 52, 108, 84, 76, 23, 96, 78)
Q = c(108,  74, 32, 48, 59, 43, 76, 102, 35)


Boxplots and stripcharts (P on bottom) both show very similar samples. It seems unlikely that any test will find P and Q to differ significantly.

boxplot(P,Q, horizontal=T, col="skyblue2")


stripchart(list(P,Q), ylim = c(.5,2.5), pch=19)


The Wilcoxon rank sum test cannot give an exact P-value because the two samples share a value (max =108) in common, but the approximate P-value given does not seem promising.

wilcox.test(P,Q)

Wilcoxon rank sum test
with continuity correction

data:  P and Q
W = 40, p-value = 0.3964
alternative hypothesis:
true location shift is not equal to 0

Warning message:
In wilcox.test.default(P, Q) :
cannot compute exact p-value with ties


From the plots, either sample seems far from normal. Sample sizes are too small for a Shapiro-Wilk test to have reasonable power, but neither sample is rejected as non-normal.

shapiro.test(P)$$p.val [1] 0.6240743 shapiro.test(Q)$$p.val
[1] 0.3699162


It seems worthwhile to look at a Welch two-sample t test, which also fails to find a significant difference.

t.test(P,Q)

Welch Two Sample t-test

data:  P and Q
t = 0.68638, df = 12.913, p-value = 0.5046
alternative hypothesis:
true difference in means is not equal to 0
95 percent confidence interval:
-20.95039  40.44245
sample estimates:
mean of x mean of y
73.85714  64.11111


The difference between the means is about $$10,$$ both standard deviations are about $$28,$$ and sample sizes are small.

ad(P)
[1] 28.41613
sd(Q)
[1] 27.86326


One might finish with a permutation test, but 'the handwriting is on the wall' that the data show no significant difference between hospitals. So, I won't show a permutation test.