RMHI/ARMP The story of LFB and Foxy Assignment
For this assignment, we're going to go back to meet up with LFB and Foxy and hear their story. As you'll recall, a few weeks ago they, Doggie, and Flopsy went on a mission to Otherland to steal some of their data. The mission was successful but LFB and Foxy went missing! In your assignment we get to see what happened to them.
LFB and Foxy are acting as lookout as Doggie and Flopsy enter the building. Standing on one side of the building, LFB is squinting through the darkness trying to see when she hears a rustle. Then another one, then another one, coming ever closer. Not wanting to raise the alarm prematurely, LFB holds still, but when she hears another rustle only meters from where she is, she whistles, giving the signal.
Foxy dashes around the building as quickly as she can, just in time to see the bushes near LFB part. She catches a hasty glimpse as three very large shapes -- bears? dogs? something else? -- jump out at LFB. Startled, LFB whistles as loud as she can, but it is abruptly cut off by one of the animals covering her mouth.
Forgetting her normal shyness, Foxy shouts "stop!" as loud as she can and charges at the twocreatures. She growls at them, surprising herself, and they turn. She trembles: one of them is thelargest bear she has ever seen, but it's too late to go back now. She growls again, and then the bear rushes at her and hits her and she is knocked unconscious.
After a short and frightening journey through the dark, LFB and Foxy are put into a small, bright room. LFB is relieved to see Foxy start to stir after a moment she hasnt been hit that hard and the two of them cuddle together in fear. The room they are in looks like a library, but it has very large chairs and books. LFB has to jump just to get down from the high sofa and reach the doorhandle. It is locked.
After about a half an hour of worry, the door opens and seven people come in. The first is an enormous bear, larger than anybody LFB has ever seen; she suspects that is the main person who subdued them. He is followed by an owl, a small unicorn with a rainbow mane, a hippo, and a cute penguin carrying a snake. The entire group is trailed by what looks, to their astonishment, to be a sentient guitar (that's right, a musical instrument that can walk and talk).This is a very strangeplace, thinks LFB.
Q1.The seven strangers introduce themselves. The tibbledo, which has been loaded for you in the R Markdown document, contains the information about them that LFB and Foxy have gleaned. Eachrow is one of the seven individuals, and the five columns are as follows:
- name: the name of that person
- species: the species of that person
- height: the height of that person in centimeters
- scariness: how scary that person seems (1 = not scary at all, 10 = extremely scary)
- loudness: how loud that person seems (1 = not loud at all, 10 = extremely loud)
Takedoand use the functionsselect(),filter(),andmutate()to create a new tibble that contains two new variables. One, calledpersonality, is the mean of that animals scariness and loudness. The other, calledmorescary,is TRUE if that animals scariness is greater than its loudness. Then remove thescarinessandloudnesscolumns, as well as all animals less than 5cm tall. Assign this to a tibble calleddo_newand make sure that the tibble is visible when you knit your document.do_newshould look like this:
LFB and Foxy are both feeling a little calmer now that it appears nobody is going to try to kill them on sight. Still, the Others seem rather suspicious (not that that is surprising, really).
What are your names?" the giant bear, Super Size, asks.
"LFB," says LFB, trembling.
"What kind of name is LFB?" asks Kevin, the guitar.
LFB bites her tongue and narrowly avoids asking what kind of guitar is named Kevin, and just says "It stands for Lovable Fluffy Bunny. My mum named me."
The unicorn shakes her tail and says "It's a lovely name. I like it," and glares at Kevin.
How about hers? the snake hisses, pointing at Foxy.
Shecan answer for herself, Foxy says, bristling a bit. My name is Foxy. Because I am a fox.
Okay, okay, says Hugo the hippo. Thats fine. Are you okay? We didnt mean to hurt you when we captured you, we just didnt want to let you get away.
Mollified, Foxy nods. Head hurts a bit but Im okay.
"What are you doing here?" the giant owl interrupts.
Trading back and forth, LFB and Foxy tell everyone the whole story -- how they fear they are running out of food, and they wanted to see if the Others were stealing it (at this point LFB trembled a little bit more, and Foxy gave her a reassuring hug) or were having similar problems. As they get into the story, they can't help but noticing that most of their listeners seem stunned. The penguin whispers to the unicorn and the giant bear several times during the explanation. When they stop, there is a long silence.
"How do we know you're telling the truth?" the snake, Sissily, finally asks.
"I... don't know," LFB says. We are, I swear."
After a pause, Little Blue raises her wing. "I have an idea," she says. "We can give them the HONOUR scale that I recently developed it measures how honourable somebody is. That will tellus whether we should trust them.
Oh dear, says Foxy. I always overthink these things and mess them up.
I can take it, LFB volunteers. I mean, I dont know how it works, but I know that were telling the truth and were both honourable.
Is this scale even normed appropriately though? asks Kevin, glaring as well as a guitar can glare.He is obviously still very suspicious. How do we know what good is on it?
Little Blue looks crestfallen. Good point. I havent had time to norm it yet. It has a good collection of questions with strong internal validity, and I know how to interpret them, but I havent yet run it on lots of different people so I dont have a good sense of what the population behaviour on it would look like.
Everyone is crestfallen, but then Sissily ventures timidly, Maybe we dont need that? What do you mean? asks Super Size.
I mean, all we really need to do is compare LFB to somebody we know is honourable. If LFBs scores are around the same, we can conclude that she is probably honourable as well.
Thats a great idea, says Hugo. How about Rainbow?
All of the Others agree enthusiastically; apparently everybody there considers Rainbow a virtuous and truthful person.I hope this works, LFB thinks nervously.I know Im honourable, but am I as honourable as the most honourable of the Others? What if I mess this up? What if their test isntvery good after all?
But there is no choice she cant think of anything else that would persuade them better, so she nods and tries to look confident. She cant help but notice that Rainbow, too, looks nervous, but the colourful unicorn nods as well, and the two of them go to separate rooms to take the test.
It turns out that the HONOUR scale consists of 60 questions, each of which yields a score between 0 and 50 (higher = more honourable). All of the questions reflect different things so people are interested not only in comparing their performance overall, but also specific questions.
The tibbledh, which has been loaded for you in the R Markdown document, contains the coding ofthe answers to the questions LFB and Rainbow were asked. Each row corresponds to one question. The four columns are as follows:
question: the question number
- lfb: LFB's answer to that question (min 0, max 50, higher=more honourable)
- rainbow: Rainbows answer to that question (min 0, max 50, higher=more honourable)
- diff: The difference between LFBs and Rainbows answer on that question (LFB-Rainbow)
Q2.Use a pivot command to convertdhto a tibble calleddh_newthat looks like the one below and is the same asdh2, which has already been loaded for you. Make sure that the top rows of the tibble arevisible when you knit your Markdown document.
Q3.Lets look at our data! Make a figure that shows the 1D distribution ofdiff, lfb,andrainbowusing whichever geom seems appropriate to you. There should be three facets/panels in the single figure corresponding to each of the measures (one fordiff,one forlfb, and one forrainbow), with the x axis corresponding to the score of each measure. Make sure the different measures have a different fill colour (using a palette of your choosing, as long as its not the default) and are outlined in black. Title and label the axes appropriately (there is no need for a subtitle). Remove the legend if it is redundant, use a nice theme, and make sure that the scale of the x axis is different on each panel based on the range of scores (i.e., the scale shouldnt be fixed in the same way for all panels).
Q4.Perform a statistical test to determine whetherlfb,diff, andrainboware each normally distributed.For each variable, report the statistical test, the statistical reference and interpret whether thatmeans the variable is normal or not. [Suggested word count: 75]
Q5.Use the appropriate statistical test to evaluate whether Rainbow and LFBs answers on the HONOUR test are significantly different from each other. Report the results. In your answer, dontworry about including descriptive statistics but do report which statistical test you used, theappropriate stats reference, the interpretation of this finding, and a measure of effect size and what it means. [Suggested word count: 100]
Q6.Everyone is sitting around thinking about the results of the test when Hugo tentatively says, Imuneasy about something. How do we know the HONOUR scale actually captures who is honourable? What if it is measuring something else? How would we know?
Little Blue answers, Good question. Hmm. Well, I can definitely tell you that Ive given it to the same people at different times, or with different people giving the test, and gotten similar scores.
(a) Is Hugos question more about operationalization or measurement? Explain why with referenceto the entities involved. (b) Does Little Blues answer address Hugos concern? If your answer is yes, explain why, making a clear link between the two, and give an example of something else that would address his concern equally well (note that the something can be hypothetical, it need not actually exist). If your answer is no, explain why not with clear reference to what Little Blue is talking about and what Hugo means, and give an example of something that would do a better job at easing Hugos worries (note that the something can be hypothetical, it need not actually exist).[Suggested word count: 150]
The Others confer a bit and realise that regardless of the results of the HONOUR scale, over the course of working and talking with LFB and Foxy they have realized that the two are at least reasonably trustworthy. Following a long, whispered conference amongst each other, Rainbow the unicorn steps forward and unties them.
Sorry for our suspicion. Weve been having food problems ourselves," she confides quietly. "We haven't known what to do about it, and are pretty worried."
"Maybe we could help?" LFB offers. "I mean, I don't know much, but perhaps if we compareproblems we'll be able to figure out what's going on. We can tell you what we know about our situation too."
Foxy nods and shares the survey data we saw in previous weeks. The Others share their food data that you went over in the tutorials, and everyone agrees that there is a problem.
"The thing is," Super Size observes (everyone is now very companionable and speaking frankly), "Ifear that this is having a lot of bad indirect effects on everything else. People are more irritable and fighting more, theyre sick more often, and things like that.
"Do you have any data about that?" LFB asks, curious.
There is a long silence, and then Sissily volunteers: Well, we could look at health records. What do you mean? asks Kevin. I thought those were private.
They are, Rainbow agrees. But we have deidentified data that we can look at in the aggregate. For instance, ten years ago the government set a wellness standard which I know they achieved
then and we could see if were still achieving it now. We could see if the number of people having food-related health problems is below that standard.
To be precise, we can consider three categories of health problems:
- Low: if the health problem arose because of not enough food (e.g., starvation)
- Nutrition: if the health problem arose because of enough food but a poor diet (e.g., malnutrition)
- Nonfood: if the health problem arose because of something unrelated to food
When the government set the standard ten years ago, the aim was for 10% of issues to be related to not enough food, 10% to be due to malnutrition, and the other 80% to be due to something else.This standard was achieved then. The question is: is it being achieved now, or are there moreproblems now due to either not enough food or poor nutrition?
Everyone is enthusiastic about exploring this more, and the next day after they find some data, have a long sleep, and share a companionable dinner with their new friends they all gather around. The data is in the tibble calleddp, which has already been loaded for you. It contains the following columns:
- id: a code indicating a single person at a single doctor visit
- problem: the problem being dealt with at that doctor visit (low, nutrition, or nonfood)
- improved:TRUE if the patient got better, FALSE if they didnt
Q7.Use the appropriate statistical test to evaluate whether the distribution of health problems is significantly different from the standard set by the government. Report on the results. In your answer, include descriptive statistics, a report on which statistical test you used, the appropriate stats reference, and the interpretation of this result. Do not worry about calculating or reporting effect size. [Suggested word count: 130]
Q8.Suppose that out of 150 doctor visits, 134 of them were for reasons unrelated to food and 16 were for food-related reasons. Considering only these two possible categories of outcomes (food-related and non-food-related), calculate the probability of seeing 134 or more non-food visits assuming that the underlying true proportion of non-food-related problems in the population is 0.8. Thereare two separate ways to calculate this, with two different functions; a full credit answer willcalculate it in both ways. Report the probability in the blank space provided on the answer sheet. Explain what each of your calculations is doing (as if you were teaching someone else about them). [Suggested word count: 125]
Not to be a pain, says Foxy after a while, but even though its nice to have this data, it doesnt tell us anything aboutwhywere seeing these patterns.
Its very hard to infer causation from most data, says Kevin chidingly.
Foxy is too polite of a person to roll her eyes, but LFB can tell she wants to. I know, she saysinstead. We cant infer it for sure but if we could look at patterns of change over time, and seewhich kinds of measures change and which dont, that can indicate something.
Rainbow nods in support. Yeah. Like, if peoples health was getting worse over the same time the amount of food went down, it at leastsuggeststhat those things might be related.
What if there was some other variable causing both? asks Hugo. Like maybe peoples health is getting worseandthere is less food because people are getting poorer and so cant afford it.
Or maybe theres some disease causing health to drop, which makes people not feel well enough toharvest crops, and that is why the food is going down, chimes in Super Size.
We cant tell for sure, LFB repeats again. But these hypotheses all imply different patterns and relationships, and at least we can look to see what patterns thereare.
Everyone nods again, but the mood is down. The task seems impossibly hard.This time Kevin breaks the silence. Little Blue, do you have data looking at health over time?
Little Blue thinks, and then nods finally. Its not as big of a dataset as some of the others, but myself and a bunch of my friends have been using an app that track different measures about our life. We have data from the last three years. We could look at that.
She brings it out and everybody clusters around and looks at it. "There is a sentient string inOtherland?" LFB asks incredulously.
Kevin looks up, miffed. "That's my best friend, Kevin Clark," he says. "What, do you think a string can't be intelligent? Or a guitar?"
"No, no, just curious," LFB backpedals hastily. "All good."
Rainbow whispers to her, "We don't understand it either. Just go with it."
Super Size clears his enormous throat. "Ahem. So now you have a sense of our dataset. That's reasonably representative of Otherland, I would say."
Sissily nods. "Yes. Mostly birds, bears, and bunnies, with a bunch of other things too."This is super fascinating, Foxy interrupts, but lets have a close look!
The data is in the tibble calleddd, which has been loaded for you. It has the following columns:
- name: the name of each person
- species: the species of the person
- size: the size of the person (small, medium, large, enormous)
- time: when the data was collected. There are three time points separated by a year each (t1, t2, andt3). Each person contributes three rows to the dataset, one for each time point. The most recent time period, t3, occurred a few months ago.
- health: that persons overall health rating on a scale of 0-100 where higher equals better
- income: that persons income during that time period (higher equals better)
Q9.The tibbledd_sum2, which has been loaded for you, was created using thegroup_by()andsummarise()functions to calculate the mean, median, and standard deviation forhealthfor each size at each time point. Using the same functions, make your own tibble called calleddd_sumthat looks exactly likedd_sum2. Ensure thatdd_sumappears in your knitted document.
Q10.Create a bar plot with the following specifications. There should be four panels/facets, each corresponding to one size of animal. Each panel should contain three bars, one for each time point(on the x axis) with the y axis showing health. Each bar should be outlined in black and have errorbars corresponding to standard deviation. The colour of each bar should be semi-transparent and be different for each time. Individual data points should follow the same colour scheme as the corresponding bar and both bar and individual data points should be visible. Title and label the axes appropriately (there is no need for a subtitle). Remove the legend if it is redundant. What does this figure suggest about how health is changing over time for people of different sizes? (We know what you observe may not be significant; this question is just about describing the trends, whichother tests can tell us if they are significant or not). [Suggested word count: 25]
Q11.Make a figure of your own using any of the datasets, with the goal of learning something new about the data that hasn't been shown by the previous plots. Requirements: (a) it needs to involve a geomother than one of the ones you used before; (b) it needs an informative title and axis label; (c) itshould involve more than one facet; (d) it should be clear, with aesthetic choices that add to its clarity rather than detract from it; (e) you should explain what the graph suggests about the data. In your explanation be sure to describe the variables on each axis as well as what the pattern is and what it suggests about what is going on for our friends. Feel free to go beyond these requirements if you like (e.g., you can use more than one geom, subtitles, etc) but it is not necessary to get full marks. [Suggested word count: 160]
Q12.Suppose our friends manage to measure some variable that whose true population distribution is shown in the diagram below on the left. Because of a wealthy benefactor, they are able to run 5000 experiments; in each of these, they sample independently from the true population distribution. Ineach of these experiments, they measure the mean of their sample.
Consider the six panels U through Z. (a) Suppose that each experiment has a sample size of 200. Give the letter corresponding to the panel that most accurately captures what you would expect the sampling distribution of the mean to look like. (b) Suppose instead that each experiment has a sample size of 1. Give the letter corresponding to the panel that most accurately captures what you would expect the sampling distribution of the mean to look like. (c) Explain each of your answersin (a) and (b), making reference to the central limit theorem and the definition of standard error.[Suggested word count: 175]
Q13.Foxy ran a t-test that yielded a particulartstatistic and p-value. (a) Suppose Foxy ran the same teston different data, this time with twice the sample size, and got the sametstatistic. All else being equal, would thep-value be higher, lower, or the same as it was the first time? (b) Suppose Foxy ran the same test on different data, with the same sample size, and got the sametstatistic except that it was negative instead of positive. All else being equal, would thep-value be higher, lower, or the same as it was the first time? For both (a) and (b), explain your answer, each time making reference to thetdistribution, degrees of freedom, and the p-value.
[Suggested word count: 190]
Q14.Ive been confused about this for a while but I think Ive got it! Super Size suddenly says with satisfaction. A p-value of 0.4 means that the probability of the null being true given your data is40%, and the probability of the alternative being true is 60%. We try to minimize Type I error bysetting alpha equal toponly whenpis less than 0.05. He looks around anxiously. Is that right?
Can you answer Super Size? In your answer, state clearly whether he is correct or not and explain why. (Be sure to address all of the parts of his statement) In your answer, describe clearly how the p-value relates to the null and alternative hypotheses, as well as alpha. [Suggested word count: 170]
Q15."I don't like statistical tests," Kevin says grumpily. "I think we should just always have very large samples; that way we can ensure that Type 1 and Type 2 error are zero, no matter what phenomena we are studying and no matter what the true effect size is.
Imagine for now that we live in a world with lots of resources and it is possible to always have veryhigh sample size (though not infinite, nor would we be sampling the entire population). Would this indeed permit both kinds of error to be zero or extremely close to zero? Why or why not? A full credit answer will discuss the relationship between alpha, beta, effect size, and sample size; there is no need to include any equations or calculations, but your answer should give an intuitive sense of how these four factors are related and why. [Suggested word count: 200]
Q16.This one is a freebie - any answer is fine as long as you answer it. What would you like to see happen in the Bunnyland story? (This can be anything, from a huge plot point to a tiny character development to a neat scene or anything in between). Use however many words you like; this doesnt contribute to your word count!