Experiment.

Mathematics 241
Experiment
November 1
Goals for the day:
1. Words:
2. R:
randomization, blocking
t.test
3. Big idea: good experimental design allows us to attribute variation to treatment
Preparation
We are going to simulate an actual experiment by abstracting out some of its central features. The actual situation
is this: an oral surgeon is considering implementing a new pain treatment regimen for patients in his practice. The
reponse variable is the patients reported pain at 24 hours past the treatment. For the purposes of this simulation,
pain will be reported on a scale of 0-20. There are 40 patients.
Step 1
Choose 20 red cards and 20 black cards from the deck. Make sure that you have exactly 40 cards and
return the unused cards to the box. Each card will be a patient. The numbers on the red cards represent the numbers
from 1-10 with face cards representing 0 (no pain). Add 10 to the numbers on black cards to get a pain number (i.e,
a face card is 10 and a 5 is 15).
The 40 cards represent the variation in pain of patients who receive the standard treatment.
A completely randomized design
The oral surgeon randomly assigns the patients to two different treatment groups – 20 to each. One group receives
the standard pain treatment regimen, and the other receives the new one.
Step 2
Shuffle your 40 cards (patients) throughly and divide them equally into two piles of 20 without looking
at the numbers. Declare one of the piles to be the treatment pile and the other the control (standard treatment)
pile.
Explain how the surgeon might do this randomization if she knows that the next 40 patients are going to be the
experimental subjects.
Explain how the surgeon might do this experiment so that it is double blind.
Page 2
Step 3
We will simulate a treatment that actually is somewhat effective in that it usually works better than the
standard treatment.
For each card in the treatment pile, roll the die. The die will be used to modify the number on the card according
to the following table. (Do not reduce the pain below 0.)
Die roll
Adjustment
1
subtract 1
2
subtract 2
3
subtract 3
4
subtract 4
5
subtract 5
6
subtract 5
Record the pain numbers of each of the patients here:
Treatment
Control
Step 4 Draw boxplots of the treatment and control group on the same scale. A number line is provided below.
(Helpful hint:) With 20 observations, the median is the mean of observations 10 and 11, the first quartile is the
mean of observations 5 and 6, and the third quartile is the mean of observations 15 and 16.
Treatment
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Control
Does it appear that there is conclusive evidence that the treatment reduces pain? (Of course we know it does! But
if we only have the data, would we conclude that?)
How many treatment subjects had pain greater than the median control patient?
How many control subjects had more pain than any treatment subject?
Page 3
Blocking
There is considerable variation in how much pain the subjects feel, even if all receive the treatment. That makes
it hard to distinguish the variation due to the treatment from the variation due to the subjects being different. It
would be nice if our treatment subjects were more homogeneous.
In fact there are two different groups of subjects. One group of 20 subjects had a more complicated kind of procedure
that the other 20. This procedure is likely to result in more pain. Your black cards represent those subjects while
the red cards indicate the subjects who have the simpler procedure (and less pain in general).
We now perform the experiment with the type of procedure being a block. The experimental design will be a
randomized block design.
Step 5
Seperate your cards by color. (Hopefully you still have 20 red and 20 black cards.) For each color, shuffle
the cards and divide them randomly into two piles of 10 each. Designate one red pile as a treatment pile and one
red pile as a control. Similarly designate one of the black piles as a treatment.
Step 6
Again apply the treatment to the treatment piles by rolling a die and using the treatment table.
Record the pain numbers of each of the patients here:
Treatment, Simple procedure (red)
Control, Simple procedure (red)
Treatment, Complex procedure (black)
Control, Simple procedure (black)
Step 7 Draw boxplots of the treatment and control group for each block on the same scale. A number line is
provided below.
(Helpful hint:) With 10 observations, the median is the mean of observations 5 and 6, the first quartile is the third
observation, and the third quartile is the eighth observation.
Treatment (simple)
Control (simple)
0
1
2
3
4
5
6
7
8
9 10 11 12 13 14 15 16 17 18 19 20
Treatment (complex)
Control (complex)
Would you say that this experiment gives more or less evidence that the treatment reduces pain?
Page 4
The following simulates both of your experiments. The code is available at /home/stob/doe2.R. See if you can figure
out how it works.
>
>
>
>
>
>
>
>
red=c(0,0,0,1,1,2,3,3,4,4,5,6,6,7,7,8,8,9,9,10)
black=c(0,0,1,2,2,3,3,4,4,5,5,6,6,7,8,8,9,9,10,10)+10
effect=sample(c(-1,-2,-3,-4,-5,-5),20,replace=T)
all=c(red,black)
randomize=sample(all,40,replace=T)
control=randomize[1:20]
treatment=pmax(randomize[21:40]+effect,0)
boxplot(control,treatment,horizontal=T,names=c('Control','Treatment'),las=1)
Treatment
Control
0
>
>
>
>
>
>
>
5
10
15
20
randomizeminor=sample(red,20,replace=T)
randomizemajor=sample(black,20,replace=T)
minorcontrol=randomizeminor[1:10]
minortreatment=pmax(randomizeminor[11:20]+effect[1:10],0)
majorcontrol=randomizemajor[1:10]
majortreatment=pmin( pmax(randomizemajor[11:20]+effect[11:20],0),15)
boxplot(minorcontrol,minortreatment,majorcontrol,majortreatment,names=c('Cont. Minor', 'Treat. Minor',
Treat. Major
Cont. Major
Treat. Minor
Cont. Minor
0
5
10
15