Statistics and Statistical Programming (Winter 2017)/Problem Set: Week 2

From CommunityData
This page or section is currently a work in progress and its contents will change, perhaps significantly, before it is finalized. Once it has finalized, this notice will be removed.


Programming Challenges

PC1. Follow and then "Clone or download", my GitHub repository for the class assignments.
PC2. Once you have it, find the RData file in the subdirectory week_02 with your name associated with it. Load that file into R. It should load up one variable. Find that variable!
PC3. Once you've found the variable, compute and present a series of statistics on it that you should already be familiar with. Use functions to compute the mean, median, variance, standard deviation, and interquartile range?
PC4. Although these basic functions all exist, many things you will want to do in the future won't have functions. Write R code to compute these three statistics by hand: mean, median, and mode. It's OK if getting the answer involves some eyeballing or counting this by hand. But do get the answer and be ready to walk us through how you did it.
PC5. Create a number of visualizations of your dataset: at the very least, create a boxplot and histogram.
PC6. Some of you will have negative numbers. Whoops! Those were not supposed to be there. Recode all negative numbers as missing (i.e. NA) in your dataset. Now create compute a new mean and standard deviation. How does it change? (Hint: the basic mean function will give you an error. You have use a named argument na.rm=TRUE to work around this.)
PC7. Log transform your dataset. Create new histograms, boxplots, and means, median, and standard deviations.
PC8. Commit the code that does all of these into a folder called "week_02" in your git repository. Publish this on Github and email me with the link to your published Github folder.

Statistical Questions

Exercises from OpenIntro §2

Q0. Any questions or clarifications from the OpenIntro text or lecture notes?
Q1. Exercise 2.12 on kids missing school
Q2. Exercise 2.20 on "assortative mating"
Q3. Exercise 2.26 on twins (and conditional probability)
Q4. Exercise 2.32 on the birthday problem (This is a super famous problem! Don't look it up!)
Q5. Exercise 2.38 with the example of baggage fees
Q6. Exercise 2.44 on income and gender

Empirical Paper