Editing Statistics and Statistical Programming (Fall 2020)/pset5

From CommunityData

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 14: Line 14:
===PC2. Explore and cleanup the data===  
===PC2. Explore and cleanup the data===  
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 or not) and the outcome (whether or not trick-or-treaters picked up fruit). Don't worry about any of the other measures for now.
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 or not) and the outcome (whether or not trick-or-treaters picked up fruit). Don't worry about any of the other measures for now.
===PC3. Summarize key variables===
===PC4. Summarize key variables===
Create a two-way contingency table summarizing these two variables. Make sure your table has easily understandable column and row names.
Create a two-way contingency table summarizing these two variables. Make sure your table has easily understandable column and row names.
===PC4. Test for differences between groups ===
===PC5. Test for differences between groups ===
Construct and perform a statistical hypothesis test to determine whether or not the two groups are dependent. State your hypotheses clearly. 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 ''OpenIntro'' §6 last week.
Construct and perform a statistical hypothesis test to determine whether or not the two groups are dependent. State your hypotheses clearly. 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 ''OpenIntro'' §6 last week.
===PC5. Replicate a figure===
===PC6. Replicate a figure===
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.
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.
===PC6. Export a table===
===PC7. Export a table===
We've used RMarkdown to handle reproducible data analysis and export thus far, but it's also often important to export tables directly into your word processor or typesetting software without cutting and pasting the contents of individual cells by hand. Write R code that exports the ''output'' of your table from PC4. There are a bunch of functions you can use to do this. I would likely use the <code>xtable</code> package to generate HTML and/or LaTeX output, but I think that the Base-R <code>write.table()</code> function for export into Excel could do the job just as well.
We've used RMarkdown to handle reproducible data analysis and export thus far, but it's also often important to export tables directly into your word processor or typesetting software without cutting and pasting the contents of individual cells by hand. Write R code that exports the ''output'' of your table from PC4. There are a bunch of functions you can use to do this. I would likely use the <code>xtable</code> package to generate HTML and/or LaTeX output, but I think that the Base-R <code>write.table()</code> function for export into Excel could do the job just as well.


Please note that all contributions to CommunityData are considered to be released under the Attribution-Share Alike 3.0 Unported (see CommunityData:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To protect the wiki against automated edit spam, we kindly ask you to solve the following CAPTCHA:

Cancel Editing help (opens in new window)