# Statistics and Statistical Programming (Spring 2019)/Problem Set: Week 7

## Programming Challenges

For the programming challenges this week, we'll focus on data from the following study:

Aronow PM, Karlan D, Pinson LE. (2018). The effect of images of Michelle Obama’s face on trick-or-treaters’ dietary choices: A randomized control trial. PLoS ONE 13(1): e0189693. https://doi.org/10.1371/journal.pone.0189693
PC1. Download the dataset. You may want to familiarize yourself with the experimental treatment and key details of the research design from the (short) article.
PC2. Import the data into R. You may need to install the `readstata13` package and identify an appropriate function with which to do so.
PC3. Get to know your dataset. Take a look at the codebook if necessary and make sure you have the two columns of the dataset that correspond to the experimental treatment (being presented with Michelle Obama's face) and the outcome (whether or not kids picked up fruit). Don't worry about any of the other measures for now.
PC4. Create a two-way contingency table summarizing these two variables. Make sure your table has easily understandable column and row names.
PC5. Conduct a test to determine whether or not the two groups are dependent. Report and interpret the results of your test and be prepared to discuss your findings. Please note that the paper uses a variety of techniques including linear regression and incorporates other variables, but you should use estimators and tests we read about in Chapter 6 last week. Do you have a sense, from your OpenIntro readings this week, why the results might be different when you use regression and incorporate the other variables?
PC6. Try to reproduce the top panel of Figure 1 using the same two columns of the dataset (by ignoring year and the other variables we are, in effect, working with the "pooled" sample). If you cannot reproduce that portion of the figure (or something like it), try to at least reproduce the values presented in it.
PC7. It's very important to be able to export tables directly into your word processor or typesetting software without cutting and pasting the contents of individual cells. Can you export the output of your table from PC4? There are a bunch of functions you can use to do this. I would likely use the `xtable` package to generate HTML and/or LaTeX output, but I think that `write.table()` and Excel could do the job just as well.

## Statistical Questions

from OpenIntro §6

SQ0. Any questions or clarifications from the OpenIntro text or lecture notes?
SQ1. Exercise 7.6 using some census data from the UK
SQ2. Exercise 7.30 which is about cats.
SQ3. Exercise 7.40 using date from rate my professor
SQ4. Exercise 7.42 which is about babies.

## Empirical Paper Questions

These questions are about the Lampe and Resnick paper which is a highly cited paper in my area of research. For this week, we'll focus on the correlation table (Table 3) and the regression table in Table 5. We'll come back to the logistic regression next week.

EQ1. Be ready to explain Table 3. In particular, be ready to talk about the bivariate relationships between "Final score" all of the other variables in the model. Be ready to talk about the correlation both in quantitative and in substantive terms.
EQ2. (optional) Do you think that the assumptions that underly the linear regression model reported in Table 5 hold? What information might you like to have seen provided to help you determine your answer?
EQ3. (optional) Be ready to explain what Table 5 means in both statistical and substantive terms. In particular, be ready to interpret the coefficients in substantive terms and be ready to explain what the t-statistics, ${\displaystyle R^{2}}$, and p-values mean. Be ready to provide a sentence for each that interprets each number in the table in substantive terms. This will mean understanding what every variable actually measures.