Sys.getlocale()
## [1] "LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C"
This Exploration must be produced with an RMarkdown document. Make sure to include your name. While you are encouraged to work in groups it is important that submitted work is your own.
Dogs have been domesticated for about 14,000 years. In that time, have they been able to develop an understanding of human gestures such as pointing or glancing? How about similar nonhuman cues? Researchers Udell, Giglio, and Wynne tested a small number of dogs in order to answer these questions.
In this exploration, we will first see whether dogs can understand human gestures as well as nonhuman gestures. To test this, the researchers positioned the dogs about 2.5 meters from the experimenter. Two cups were placed, one on each side of the experimenter. The experimenter would perform some sort of gesture (pointing, bowing, looking) toward one of the cups or there would be some other nonhuman gesture (a mechanical arm pointing, a doll pointing, or a stuffed animal looking) toward one of the cups. The researchers would then see whether the dog would go to the cup that was indicated. There were six dogs tested. We will look at one of the dogs in two of his sets of trials. This dog, a four-year-old mixed breed, was named Harley. Each trial involved one gesture and one pair of cups, with a total of 10 trials in a set.
We will start out by looking at one set of trials where the experimenter bowed toward one of the cups to see whether Harley would go to that cup.
STEP 1: State the research question.
- Based on the description of the study, state the research question.
STEP 2: Design a study and collect data.
Harley was tested 10 times and 9 of those times he chose the correct cup.
- What are the observational units?
- Identify the variable in the study. What are the possible outcomes of this variable? Is this variable quantitative or categorical?
The set of observational units on which we collect data is called the sample. The number of observational units in the sample is the sample size. A statistic is a number summarizing the results in the sample.
STEP 3: Explore the data.
With categorical data, we typically report the number of “successes” or the proportion of successes as the statistic.
- What is the number of observational units (sample size) in this study?
- Determine the observed statistic.
A good way to visualize the data is to use a simple bar
graph. Remember that bar graphs are used for categorical
variables. First, we need to save the values of proportions and
outcomes. Then we use the barplot function to create the
barplot.
proportions<-c(0.9,0.1)
outcomes<-c("correct", "wrong")
barplot(proportions,names.arg=outcomes,xlab="Outcomes",ylab="Proportions",col="blue",
main="Bar graph")
- If the research conjecture is that Harley can understand what the experimenter means when they bow toward an object, is the statistic in the direction suggested by the research conjecture?
- Could Harley have gotten 9 out of 10 correct even if he really didn’t understand the human gesture and so was randomly guessing between the two cups?
- Do you think it is likely Harley would have gotten 9 out of 10 correct if he was just guessing randomly each time?
STEP 4: Draw inferences beyond the data.
There are two possibilities for why Harley chose the correct cup 9 out of 10 times:
He is merely picking a cup at random and in these 10 trials happened to guess correctly in 9 of them. That is, he got more than half correct just by random chance alone.
He is doing something other than merely guessing and perhaps understands what the experimenters mean when they bow towards the cup.
The unknown long-run proportion (i.e., probability) that Harley will choose the correct cup is called a parameter.
For a random process, a parameter is a long-run numerical property of the process.
We don’t know the value of the parameter, but the two possibilities listed above suggest two different possibilities.
- What is the value of the parameter if Harley is picking a cup at random? Give a specific value.
- What is the possible range of values (greater than or less than some value) for the parameter if Harley is not just guessing and instead understands the experimenter?
We will show you how statisticians use simulation to make a statement about the strength of evidence for these two possible statements about the parameter’s value.
Statisticians often use chance models to generate data from random processes to help them investigate the process. In particular, they can see whether the observed statistic is consistent with the values of the statistic simulated by the chance model. If we determine that Harley’s results are not consistent with the results from the chance model, we will consider this to be evidence against the chance model and in favor of the research conjecture, that he understands the bowing gesture. In this case, we would say Harley’s results are statistically significant, meaning unlikely to have occurred by chance alone.
A result is statistically significant if it is unlikely to occur just by random chance. If our observed result appears to be consistent with the chance model, we say that the chance model is plausible or believable.
We can’t perform the actual study more times in order to assess the second possibility, but we can simulate the behavior of Harley’s choices if we were to assume the first possibility (that he is simply guessing every time).
- Explain how you could use a coin toss to represent Harley’s choices if he is guessing between the two cups each time. How many times do you have to flip the coin to represent one set of Harley’s attempts? What does heads represent?
- If Harley was guessing randomly each time, on average, how many out of the 10 times would you expect him to choose the correct cup?
- Use the code in the R chunk below to simulate one repetition of Harley guessing randomly by flipping a coin 10 times (why 10?) and letting heads represent selecting the correct cup (“success”) and tails represent selecting the incorrect cup (“failure”).
# n=10 is the number of tosses, 0.5 is the probability of a "Head"
Harley.sim <- do(1) * rflip(10, 0.5)
Harley.sim
Count the number of heads in your 10 flips. Enter this number into the Exploration 1.1 Data Collection Google Sheet posted on Canvas.
Once all the responses are collected I will post the dotplot on Canvas. You can then answer the two following questions. Skip them for now.
- Where does 9 heads fall in the distribution? Would you consider it an unusual outcome or a fairly typical outcome for the number of heads in 10 flips?
- Based on your answer to #13a do you think it is plausible (believable) that Harley was just guessing which cup to choose?
To really assess the typical values for the number of heads in 10
coin tosses (number of correct picks by Harley assuming he is guessing
at random), we need to simulate many more outcomes of the chance model.
We used this code above to flip a coin 10 times, the difference between
this code and the earlier code is that now we have included
set.seed(3784) command that produces the same outcomes each
time you run the code. This is important because now your results will
be the same every time you run the code.
# n=10 is the number of tosses, 0.5 is the probability of a "Head"
set.seed(1)
Harley.sim1 <- do(1) * rflip(10, 0.5) # 10
Harley.sim1
Notice that the probability of heads has been set to be 0.50, representing Harley guessing between the two cups. What was the resulting number of heads?
Now let’s change the Number of repetitions from 1 to 1000 using a
do(1000) command.
# n=10 is the number of tosses, 0.5 is the probability of a "Head",
# 1000 is the number of repetitions
set.seed(3784)# makes sure the results are the same every time
Harley.sim2 <- do(1000) * rflip(10, 0.5) # generates 1000 observations
head(Harley.sim2, 3) ##"printing" the first 3 rows of the data
The next step is to plot the 1000 dots. R output will now show the results for the number of heads in 1,000 different sets of 10 coin tosses. So each dot on a dotplot represents the number of times Harley chooses the correct cup out of 10 attempts assuming he is just guessing.
dotPlot(~heads, # tells R which variable to plot
data = Harley.sim2, #tells R which data set to use
width = 1,# tells R the width of a space between x values
pch=1, # tells R what style of dots to use
cex=0.25,# tells R what size of dots to use
xlab="Number of times Harley chooses the correct cup",
main="Distribution of number of times Harley chooses the correct cup")
Remember why we conducted this simulation: to assess whether Harley’s result (9 correct in 10 attempts) would be unlikely to occur by chance alone if he were just guessing between the pair of cups for each attempt.
- Locate the result of getting 9 heads in the dotplot created above. Would you consider this an unlikely result in the tail of the distribution of the number of heads?
- Based on the results of 1,000 simulated sets of 10 coin flips each, would you conclude that Harley would be very unlikely to have picked the correct cup 9 times in 10 attempts if he was randomly guessing between the two cups each time? Explain how your answer relates to the dotplot.
- Do the results of this study appear to be statistically significant?
- Do the results of this study suggest that Harley just guessing is a plausible explanation for Harley picking the correct cup 9 out of 10 times?
- To make sure that you understand the coin-flipping chance model, fill in Table 1.1.2 indicating what parts of the real study correspond to the physical (coin-flipping) simulation.
Parallels between real study and physical simulation
Coin flip =
Heads =
Tails =
Chance of heads =
One repetition = one set of how many (?) __ simulated attempts by Harley
We will call the process of simulating could-have-been statistics under a specific chance model the 3S strategy. After forming our research conjecture and collecting the sample data, we will use the 3S strategy to weigh the evidence against the chance model. This 3S strategy will serve as the foundation for addressing the question of statistical significance in Step 4 of the statistical investigation method.
: Compute the statistic from the observed sample data.
: Identify a “by-chance-alone” explanation for the data. Repeatedly simulate values of the statistic that could have happened when the chance model is true.
: Consider whether the value of the observed statistic from the research study is unlikely to occur if the chance model is true. If we decide the observed statistic is unlikely to occur by chance alone, then we can conclude that the observed data provide strong evidence against the plausibility of the chance model. If not, then we consider the chance model to be a plausible (believable) explanation for the observed data; in other words what we observed could plausibly have happened just by random chance.
Let’s review how we have already applied the 3S strategy to this study.
- Statistic: What is the statistic in this study?
- Simulate: Fill in the blanks to describe the simulation. We flipped a coin ____ times and kept track of how many times it came up heads. We then repeated this process _____ more times, each time keeping track of how many heads were obtained in each of the ______ flips.
- Strength of evidence: Fill in the blanks to summarize how we are assessing the strength of evidence for this study. Because we rarely obtained a value of ________ heads when flipping the coin _______ times, this means that it is ____________ (believable/unlikely) that Harley is just guessing, because if Harley was just guessing he ____________ (rarely/often) would get a value like _________ correct out of ______ attempts.
STEP 5: Formulate conclusions.
- Based on this analysis, are you convinced that Harley can understand human cues? Why or why not?
STEP 6: Look back and ahead.
- A single study will not provide all of the information needed to fully understand a broad, complex research question. Thinking back to the original research question, what additional studies would you suggest conducting next?
One important step in a statistical investigation is to consider other models and whether the results can be confirmed in other settings.
- In a different study, the researchers used a mechanical arm (roughly the size of a human arm) to point at one of the two cups. The researchers tested this to see whether dogs understood nonhuman gestures. In 10 trials, Harley chose the correct cup 6 times.
- Using the dotplot you obtained when you simulated 1,000 sets of 10 coin flips assuming Harley was just guessing, locate the result of getting 6 heads. Would you consider this an unlikely result in the tail of the distribution?
- Based on the results of 1,000 simulated sets of 10 coin flips each, would you conclude that Harley would be very unlikely to have picked the correct cup 6 times in 10 attempts if he was randomly guessing between the two cups each time? Explain how your answer relates to the dotplot.
- Is this study’s result statistically significant?
- Do the results of this study suggest that Harley just guessing is a plausible explanation for Harley picking the correct cup 6 out of 10 times?
- Does this study prove that Harley cannot understand the mechanical arm?
- Compare the analyses between the two studies. How does the unusualness of the observed statistic compare between the two studies? Does this make sense based on the value of the observed statistic in the two studies? Does this make sense based on how the two studies were designed? Explain. (Hint: Why might the results differ for human and mechanical arms? Why would this matter?)