Please note : the data presented in all course material for the statistical module are
generated by computers to demonstrate the methodologies, and should not be confused with
actual clinical information
Introduction
Exercises
Exercise 3 contains exercises for statistics for comparing two groups, most commonly used in epidemiological studies, experiments, and clinical trials.
The theoretical basis for normal distribution, 95% confidence interval, and sample size are discussed in
Contents_1. Probability.
Discussions on comparing two groups can be found in Contents_3. Comparing Two Groups
The programs for calculating probabilities can be found in StatPgm 1. Probability of z and t, The programs for calculating sample size and comparing two groups can be found in StatPgm 3a. Compare Two Measurementsfor parametric and nonparametric measurements, StatPgm 3b. Compare Two Proportions for proportions, and StatPgm 3c. Compare Two Regressions for comparing two regressions.
The program StatPgm 7. Supportive Utilities is also available for assistance to convert raw data to means and Standard Deviation, or to percentages
The Microsft Office package of Word, Excel, and Powerpoint, or similar software, should be activated during the exercise. Excel is a useful tool to manipulate data, Powerpoint is useful to edit graphics, and the results should be copied to and edited in a Word file.
Comparing Two Measurements
Questions 1_1 : Sample Size : click to show contents
 We would like to compare the birth weight of boys and girls. We anticipate the Standard Deviation of birth weight to be 350g,
and we think a difference of 100g or more would be clinically meaningful. We would like out research to have a power of 80%,
and we will use p<0.05 as a decision criteria.
 Calculate the sample size, the number of boys and girls required to detect a difference of 100g or more
 Calculate the sample size, the number of boys and girls required to confirm that boys are 100g or more heavier than girls,
 Create a table of sample size requirements, using the Probability of Type I Error of α=0.05, Power of 80%, both one and
two tail model, and effect sizes (Difference / Standard Deviation) from 0.1 to 1 at 0.1 intervals
Answers 1_1 : click to show contents
 Sample size to detect difference in birth weight between boys and girls
 If we have no preconceived idea as to whether girls or boys bigger, and wish to detect a difference either way,
then the two tail model is required, with a sample size of 194 in each sex, a total of 388 newborns
 If we are interested only whether boys are bigger than girls, and not interested in whether girls are bigger than boys, then
the one tail model is required, and the Sample Size is 153 in each sex, a total of 306 newborns
 Sample size per group are
α power diff sd 1 tail 2 tail
0.05 0.8 0.1 1.0 1238 1571
0.05 0.8 0.2 1.0 310 394
0.05 0.8 0.3 1.0 139 176
0.05 0.8 0.4 1.0 78 100
0.05 0.8 0.5 1.0 51 64
0.05 0.8 0.6 1.0 36 45
0.05 0.8 0.7 1.0 26 33
0.05 0.8 0.8 1.0 20 26
0.05 0.8 0.9 1.0 16 21
0.05 0.8 1.0 1.0 14 17
Questions 1_2 : Compare Two Parametric Measurements : click to show contents
Group Outcome Group Outcome Group Outcome Group Outcome Group Outcome
Cont 3209 Tmt 3155 Tmt 4158 Cont 3272 Cont 3346
Tmt 2928 Tmt 3590 Cont 2888 Cont 3084 Tmt 3440
Cont 3732 Cont 4092 Tmt 2666 Cont 3172 Tmt 4127
Cont 3800 Cont 3904 Tmt 3764 Cont 4063 Cont 2860
Cont 3715 Cont 3271 Tmt 4028 Tmt 2841 Cont 3402
Cont 3527 Tmt 3667 Cont 3954 Tmt 4233 Tmt 3386
Cont 4282 Cont 3692 Tmt 3290 Tmt 2830 Tmt 3121
Cont 3779 Tmt 3276 Cont 3595 Cont 3196 Tmt 3506
Tmt 3435 Cont 3666 Tmt 2902 Tmt 4281 Tmt 2765
Tmt 3370 Tmt 3212 Tmt 2941 Tmt 3360 Cont 3944

 The table to the right contained data from a controlled trial of 50 pregnant women with abnormal Glucose Tolerance Test.
Those in the control group (Cont) received routine care, and those in the treatment group (Tmt) received a supervised diet.
The outcomes were birth weight in grams.
 Produce a data plot showing the data points in two groups, marking out the mean, 95% confidence interval of birth weight,
and 95% confidence interval of the mean, in the two groups.
 Calculate the difference in outcome between the two groups, and its 95% confidence interval, both the one tail and
two tail models
 Interpret the results in terms of
 Whether the hypothesis that diet makes a difference can be supported by this data
 Whether the hypothesis that diet reduces birth weight in these women can be support3ed by this data
 Produce a Forest plot to demonstrate the 95% confidence intervals (one and two tail) of the difference
Answers 1_2 : click to show contents
 From the controlled trial of dieting in pregnant women with abnormal glucose tolerance
 Horizontal line=mean, vertical line=95% confidence interval of birth weight, box = 95% interval of mean
 n  Mean(g)  Standard Deviation(g) 
Cont  24  3560  389 
Tmt  26  3395  477 
Difference (mean_{Cont}  mean_{Tmt}) = 165g, Standard Error of Difference (SE) = 124g
95%CI = >42g (one tail), 84g to +414g (two tail)
The two tail 95% confidence interval (84g to 414g) overlaps the null value (0), so the difference in not
statistically significant
The one tail 95% confidence interval (>42g) overlaps the null value (0), so the difference in not
statistically significant
Neither of the research hypothesis, that diet makes a difference, or that those on the diet have smaller babies
than those not on the diet, are supported by this set of data and results.
 Upper line is one tail model and lower line the two tail model
Questions 1_3 : Nonparametric Measurements : click to show contents
Grp Resp Grp Resp Grp Resp Grp Resp Grp Resp
Mw 2:D Dr 3:N Dr 3:N Dr 4:A Dr 3:N
Mw 3:N Mw 4:A Mw 4:A Dr 5:SA Dr 5:SA
Mw 1:SD Mw 2:D Mw 4:A Dr 3:N Dr 5:SA
Dr 4:A Dr 5:SA Mw 1:SD Mw 2:D Dr 2:D
Dr 1:SD Mw 2:D Dr 2:D Mw 4:A Dr 5:SA
Dr 2:D Dr 2:D Dr 4:A Mw 2:D Dr 3:N
Mw 3:N Mw 3:N Dr 4:A Mw 3:N Mw 2:D
Mw 2:D Mw 4:A Mw 2:D Mw 3:N Dr 3:N
Dr 4:A Mw 2:D Mw 4:A Dr 3:N Mw 3:N
Mw 2:D Dr 3:N Mw 3:N Mw 1:SD Mw 2:D

 A survey was conducted to evaluate attitudes towards independent midwifery practice. The statement "Midwives should always be
supervised by doctors in the care of women in labour, even when everything is normal" is presented to two groups, doctors (Dr)
and Midwives (Mw), their response (Resp) consists of one of the following : 1:SD=Strongly Disagree, 2:D=Disagree, 3:N=Neutral
or no opinion, 4:A=Agree, 5:SA=Strongly Agree. The results of the survey are presented in the table to the right.
 Create a table to show the numbers and percentage in each response for each group
 Calculate the statistical significance of the difference in attitudes between doctors and midwives, using the
MannWhitney U Test.
 Draw conclusions on whether doctors and midwives differ in their attitudes towards independent midwifery practice.
Answers 1_3 : click to show contents
 Dr  Mw  Row Total 
1:SD  1(4.3%)  3(11.1%)  4(8.0%) 
2:D  4(17.4%)  11(40.7%)  15(30.0%) 
3:N  8(34.8%)  7(25.9%)  15(30.0%) 
4:A  5(21.7%)  6(22.2%)  11(22.0%) 
5:SA  5(21.7%)  0(0.0%)  5(10.0%) 
Col Total  23(100.0%)  27(100.0%)  50(100.0% 
 In a survey of attitudes towards independent midwifery practice
 MannWhitney U = 2.4513 p=0.0071
 As Probability of Type I Error p=0.007, this is highly significant
 As U has a positive value, the first group (Dr) have higher scores (more agreeable)
 The data supports the hypothesis that Doctors have significantly different attitudes towards independent midwifery practice
than midwives. Doctors are more likely to agree that midwives requires supervision, even when everything is normal.
Comparing Two Proportions
Questions 2_1 : Sample Size : click to show contents
 40% of women in labour required pain relieve medication. A new breathing exercise is advocated as an alternative, but we
have no experience whether it would increase or reduce the need for medication. We have decided to carry out a controlled
trial, where pregnant women are randomly allocated to two groups. Women in the control group receive routine care. Women
in the treatment group receive in addition training in the new breathing exercise. The outcome to be measured is the proportion
of women that requires pain relieve medication during labour, and a 15% change in medication during labour would be considered a
significant and clinically meaningful change. We would like out research to have a power of 80%,
and we will use p<0.05 as a decision criteria.
 Calculate the sample size, the number of mothers in each group, required to detect a increase from 40% to 55%
 Calculate the sample size, the number of mothers in each group, required to detect a decrease 40% to 25%
 Explain which sample size we should use and why.
Answers 2_1 : click to show contents
 Sample size to detect a change of 15% from 40% in a controlled trial
 The one tail model is used throughout, as the statistical results is whether there is a significant departure
from the 40% in the controlled group.
 To detect an increase in the use of medication from 40% to 55%, the sample size required is 136 per group, a total of
272 cases
 To detect a decrease from 40% to 25%, a sample size is 120 per group, a total of 240 cases
 If we are uncertain whether breathing exercise will result in an increase of decrease in medication, we would choose
the safer option of the larger sample size of 136 per group, 272 cases.
Questions 2_2 : Risk Difference : click to show contents
Group Outcome Group Outcome Group Outcome Group Outcome Group Outcome
Tmt  Tmt  Tmt  Tmt + Cont 
Tmt  Tmt  Tmt  Cont + Tmt 
Tmt  Cont + Cont  Cont  Cont 
Tmt  Cont + Tmt  Cont + Tmt 
Cont  Tmt  Tmt  Tmt  Tmt 
Tmt  Cont  Cont + Tmt  Tmt 
Cont  Tmt  Tmt + Cont + Tmt +
Cont + Cont  Cont  Tmt  Cont +
Tmt  Tmt  Tmt  Tmt + Cont +
Cont  Tmt  Cont + Tmt + Cont +

 A controlled trial of two regimes of care during labour is conducted.
Women admitted in labour are randomly allocated to one of
two groups. In the control group (Cont) the mother receives routine care and supervision. In the treatment group (Tmt),
the mother is accompanied by a dedicated midwife who provides explanation, encouragement and information regularly during labour.
The outcome is measured by whether the mother requests pain relieve during labour(+) or does not request pain relieve during
labour (). The data is as shown in the table to the right.
 Create a contingency table, where the columns are the groups, the rows outcome, and each cell the number of cases for that
combination of group and outcome
 Calculate the risk of pain relieve in the two groups, the risk difference between the two groups and its 95% confidence
interval, both one and two tail
 Draw conclusion whether the additional care and support reduces the need for pain relieve medication
 Estimate the Number Needed to Treat, the number of women that needs to receive additional care in order to reduce a single
case of pain relieve
 Produce a Forest Plot to demonstrate the risk difference and its 95% confidence interval, both one and two tail.
Answers 2_2 : click to show contents
 For controlled trial of midwifery care
 Cont  Tmt  Row Total 
+(request pain relieve)  5(17.2%)  11(52.4%)  16(32.0%) 
(not request pain relieve)  24(82.8%)  10(47.6%)  34(68.0%) 
Col Total  29(100.0%)  21(100.0%)  50(100.0%) 
 Risk_{Cont} = 0.17.2%, Risk_{Tmt} = 0.52.4%
Risk Difference_{Cont  Tmt} = 35.1% Standard Error (SE) = 13.0%
95% Confidence Interval of Difference (1 tail) = <13.8%
95% Confidence Interval of Difference (2 tail) = 60.5% to 9.7%
Number Needed to Treat (NNT) = 2
 The 95% confidence interval (both 1 and two tail) does not overlap the null (0) value, so the risk difference is
statistically significant. The data and results support the hypothesis that providing intensive support and care
during labour reduces the need for pain relieve.
Questions 2_3 : Risk Ratio : click to show contents
GTT BWT GTT BWT GTT BWT GTT BWT
Norm Norm Norm Norm Norm Norm Abn Norm
Norm Norm Norm Abn Abn Norm Norm Abn
Abn Abn Abn Norm Norm Abn Norm Norm
Abn Norm Abn Norm Norm Abn Abn Norm
Abn Norm Abn Norm Abn Norm Abn Norm
Abn Norm Abn Norm Abn Norm Abn Norm
Abn Norm Norm Norm Norm Norm Abn Norm
Abn Norm Norm Norm Abn Norm Norm Abn
Norm Norm Abn Norm Norm Norm Abn Norm
Abn Norm Abn Norm Abn Abn Norm Norm
Norm Abn Norm Norm Norm Norm Abn Norm
Norm Norm Abn Norm Abn Norm Abn Norm
Norm Abn Norm Norm

 In an epidemiological study, pregnant women were classified as having normal (Norm) or abnormal (Abn) Glucose Tolerance Test (GTT),
and their baby's birth weight (BWT) are classified as normal (Norm) if it is <4Kg or abnormal (Abn) if it is >=4Kg.
The data collected are as shown in the table to the right
 Create a contingency table where the columns representing abnormal or normal Glucose Tolerance Test (GTT), the rows
representing abnormal or normal birth weight (BWT), and the cells the number of cases in each combination
 Calculate the risk of having a baby with abnormal birth weight in the two GTT groups
 Calculate the Risk Ratio of having a baby with abnormal birth weight between the two GTT groups, and its 95% confidence interval
 Draw conclusion from the results of analysis as to whether the hypothesis abnormal GTT increases the risk of abnormal BWT can
be supported by the data and results of analysis
 Produce a Forest plot to demonstrate the 95% confidence interval of Risk Ratio, both one and two tail.
Answers 2_3 : click to show contents
 In the epidemiological study relating GTT to BWT
 Abn GTT  Norm GTT  Row Total 
Abn BWT  7(33.3%)  2(6.9%)  9(18.0%) 
Norm BWT  14(66.7%)  27(93.1%)  41(82.0%) 
Col Total  21(100.0%)  29(100.0%)  50(100.0%) 
 Risk of Abn BWT : Risk_{Abn GTT}=0.3333(33.3%), Risk_{Norm GTT} = 0.069 (6.9%)
Log(Risk Ratio) = 1.5755, Standard Error (SELog(Risk Ratio)) = 0.7488
Risk Ratio = 4.8333, 95% Confidence Interval of Risk Ratio = >1.4103 (1 tail), 1.1139 to 20.9727 (2 tail)
 Neither of the 95% confidence interval of Risk Ratio overlaps the null (1) value. The Risk Ratio is therefore
statistically significant.
 The data and results of analysis support the hypothesis that abnormal GTT during pregnancy is associated with abnormal
birth weight of the baby
Questions 2_4 : Odds Ratio : click to show contents
 A research project was initiated because maternal exposure to NSAID (aspirin, prostaglandin antagonists, and other commonly
used non steroid antiinflammatory drugs) is suspected to cause fetal growth restriction. As both exposure to the drugs and
fetal growth restriction are uncommon, a retrospective controlled study model is used.
From the medical record, 50 growth restricted babies were identified. Their mothers were questioned, and 20 of the
mothers recalled having taken NSAID drugs during pregnancy
For each of the mothers, another mother, matched in epidemiological background but having a normal baby was identified,
and questioned. Out of the 50 mothers with normal babies questioned, 3 recalled having taken NAISD during pregnancy
 Create a contingency table, where the columns identify mothers who had growth restricted or normal babies, and the rows
identify mothers having taken or not taken NSAID drugs during pregnancy
 Calculate the Odds Ratio and its 95% confidence interval
 Draw conclusions whether the data and the results support the hypothesis that exposure to NSAID drugs during pregnancy is
associated with having a growth restricted newborn
 Produce a Forest plot to demonstrate the 95% confidence interval of Odds Ratio, both one and two tail.
Answers 2_4 : click to show contents
 From the retrospective study linking growth restriction to NSAID
 Baby Growth Restricted  Baby Normal  Row Total 
NSAID taken  20(40.0%)  3(6.0%)  23(23.0%) 
NSAID not taken  30(60.0%)  47(94.0%)  77(77.0%) 
Col Total  50(100.0%)  50(100.0%)  100(100.0%) 
 Odds of taking NSAID : Odd_{Growth restricted babies} = 0.6667, Odd_{Normal babies} = 0.0638
Log(Odds Ratio) = 2.3461, Standard Error (SELog(Odds Ratio)) = 0.6618
Odds Ratio = 10.4444, 95% Confidence Interval of Odds Ratio (1 tail) = >3.5168,
95% Confidence Interval of Odds Ratio (2 tail) = 2.8549 to 38.2107
 As the hypothesis to be tested is that exposure to NSAID is associated with growth restriction, only the one tail model
needs to be used. As the 95% confidence interval is >3.52, not overlapping the null value of 1, the results are
statistically significant.
 The data and results of analysis supports the hypothesis that exposure to NSAID drugs during pregnancy is associated with
growth restriction of the newborn.
Comparing Two Regressions : Covariance Analysis
Questions 3_1 : Covariance Analysis : click to show contents
Sex Gest BWT Sex Gest BWT Sex Gest BWT
Girl 40 3661 Girl 39 3039 Girl 37 2847
Boy 36 3169 Girl 38 3292 Boy 37 2964
Boy 36 2973 Girl 42 4069 Boy 40 3742
Boy 39 3549 Boy 42 3980 Girl 38 2945
Boy 38 3452 Boy 36 2932 Girl 41 3516
Girl 40 3917 Boy 42 4197 Girl 38 3587
Girl 37 2886 Boy 40 3301 Boy 41 3582
Girl 39 3011 Girl 41 3593 Girl 40 3596
Boy 41 3819 Girl 39 3538 Girl 39 3180
Boy 39 3742 Girl 37 2895 Girl 40 3824
Boy 40 3822 Boy 38 3442 Boy 40 3850
Girl 42 3917 Girl 38 3365 Boy 41 3772
Girl 41 3839 Boy 39 3488 Girl 40 3498
Girl 40 3810 Girl 37 3074 Boy 40 3645
Girl 38 3125 Girl 40 3570 Boy 42 3613
Boy 37 3353 Boy 41 3686 Girl 40 3612
Boy 41 3972 Girl 40 3381

 We wish to compare the birth weight of boys and girls, corrected for the influence of gestational age. The data is as shown
in the table to the right.
Sex is represented by Boy or Girl, gestation (Gest) is in weeks, and birth weight (BWT) is in grams
 Calculate the mean and Standard Deviation of birth weight for boys and girls, the difference between the sexes, and the 95%
confidence interval of the difference, without considering the effects of gestation
 Calculate the constant (a) and regression coefficient (b) between gestation and birth weight (BWt=a + b x Gest) for each sex
 Calculate the difference in the regression coefficient, its 95% confidence interval, and statistical significance
 Calculate the difference in birth weight between boys and girls, and its 95% confidence interval, after correcting for
the influence of gestation
 Draw conclusions on whether the data and results support the hypothesis that boys and girls have different birth weights
 Comment on potential flaws in this model
 Plot the data points and regression line for each sex, the combined regression line.
Answers 3_1 : click to show contents
 For comparing birth weight between boys and girls, corrected for influence of gestation
 Boys  Girls 
n  23  27 
mean_{Gest}  39.4  39.3 
SD_{Gest}  2.0  1.5 
mean_{BWT}  3567  3429 
SD_{BWT}  337  359 
 Difference (BWT_{boys}BWT_{girsls}) = 138g, SE_{diff}=99,
95% confidence interval = >28g (one tail), and 61g to 337g (two tail)
 Regression formula for boys BWT (g) = 2211 + 146.7 (Gest in weeks)
Regression formula for girls BWT (g) = 4461 + 200.8 (Gest in weeks)
 Difference in slope (b_{boys}b_{girls}) = 54.1, SE_{diff}=32.6
95% confidence interval (two tail)= 119.8 to 22.5
 After correction for a calculated common slope, Difference_{boys  girls, corrected} = 122g, SE = 55
95% confidence interval = >29g (one tail), and 11g to 233g (two tail)
 Before adjusting by gestation, the difference in mean birth weight is 138g, Standard Error = 99g, and 95% confidence interval
>28g (one tail), and 61g to 337g (two tail). Both confidence intervals overlap the null (0) value, so that no statistically
significant difference between the birth weight of boys and girls can be demonstrated.
After adjusting by gestation, the difference remains similar at 122g, but the Standard Error has decreased to 55g.
This results in the 95% confidence interval to be >29g (one tail) and 11g to 233g (two tail). Both of these do not
overlap the null (0) value, so the difference can be considered statistically significant
The conclusion is therefore that the data and results supports the hypothesis that the birth weight of boys and girls
are different after taking gestation into consideration. Boys are 122g heavier than girls.
 The conclusions are based on three assumptions
 That birth weight is a normally distributed measurement. This is generally accepted for birth weight near term,
but not proven
 That the relationship between gestation and birth weight is linear (a straight line and not curved). This is disputed, as
some publications show that the relationship is curved, with growth slowing after 39 weeks
 That the regression coefficients between gestation and birth weight are the same for boys and girls. This is usually tested
using statistical significance of the difference between the two slopes. If a significant difference exists, then a common
slope cannot be validly used to adjust the birth weight. In this set of data, there is no significant difference
between the slopes, so that the adjusted difference in birth weight can be validly estimated.
