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

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 5: Line 5:
== Programming Challenges ==
== Programming Challenges ==


:'''PC0.''' Check the [https://wiki.communitydata.cc/Statistics_and_Statistical_Programming_(Winter_2017)/List_of_student_git_repositories list of GitHub repositories page] here. A few of you (Maggie, Luyue, and Janny) named yours something like "week_02." Although there's no problem with this, it might cause confusion going forward when you add homework for future week (like this week) that are not longer week 2. So ''if you're Maggie, Janny, and Luyue,'' I recommend that you create and push a new repository/directory with a more generic name which you can use for all your future assignments. For everybody else, please copy your files and work for this (and all future) problem sets into the same repository you used last time.
:'''PC0.''' Check the [https://wiki.communitydata.cc/Statistics_and_Statistical_Programming_(Winter_2017)/List_of_student_git_repositories list of GitHub repositories page] here. A few of you (Maggie, Luyue, and Janny) named yours something like "week_02." Although there's no problem with this, it might cause confusion going forward when you add homework for future works. So if you're Maggie, Janny, and Luyue, I recommend that you create and push a new repository/directory with a more generic name which you can use for all your future assignments. For everybody else, please copy your files and work for this (and all future) problem sets into the same repository you used last time.
:'''PC1.''' In the [https://github.com/makoshark/uwcom521-assignments/ class assignments GitHub repository]  (uwcom521-assignments), I've uploaded a new dataset for each person in the class in the subdirectory <code>week_03</code>. Sync my repository, find your file, copy into your homework directory which is managed by Git. Commit your dataset file into your personal homework git repository.  
:'''PC1.''' In the [https://github.com/makoshark/uwcom521-assignments/ class assignments GitHub repository]  (uwcom521-assignments), I've uploaded a new dataset for each person in the class in the subdirectory <code>week_03</code>. Sync my repository, find your file, copy into your homework directory which is managed by Git. Commit your dataset file into your personal homework git repository.  
:'''PC2.''' Open the dataset in a spreadsheet (Google Docs, Excel, etc) to take a look at it. It's often a good idea to open it in NotePad as well so you can look at the structure of the "raw data." If you want to generate statistics or visualize things, that's a normal thing to do this at point. Manually inspecting the raw data is common and useful. I won't ask about this is class, but I do recommend it.
:'''PC2.''' Open the dataset in a spreadsheet (Google Docs, Excel, etc) to take a look at it. It's often a good idea to open it in NotePad as well so you can look at the structure of the "raw data." If you want to generate statistics or visualize things, that might be OK. Manually inspecting the raw data is often a useful step.
:'''PC3.''' Load the CSV file into R. Also make sure that you loaded the week 2 dataset file.
:'''PC3.''' Load the CSV file into R. Also make sure that you loaded the week 2 dataset file.
:'''PC4.''' Get to know your data! Do whatever is necessary to summarize the new dataset. Now many columns and rows are there? What are the appropriate summary statistics to report for each variable? What are the ranges, minimums, maximums, means, medians, standard deviations of the variables of variables? Draw histograms for all of the variables to get a sense of what it looks like. Save code to do all of these things.
:'''PC3.''' Get to know your data! Do whatever is necessary to summarize the dataset. Now many columns and rows are there? What are the range of variables? What are the appropriate summary statistics to report for each variable? What are the ranges, minimum, maximums, medians, medians, standard deviations of the variables of variables? Draw histograms.
:'''PC5.''' Compare the <code>week2.dataset</code> vector with the first column (<code>x</code>) of the data frame. I mentioned in the video lecture that they are similar? Do you agree? How similar? Write R code to demonstrate or support this answer convincingly.
:'''PC4.''' Compare the <code>week2.dataset</code> vector with the first column (<code>x</code>) of the data frame. I mentioned in the video lecture that they are similar? Do you agree? How similar? Write R code to demonstrate or support this answer convincingly?
:'''PC6.''' Visualize the data using <code>ggplot2</code> and the <code>geom_point()</code> function. Graphing the <code>x</code> on the x-axis and <code>y</code> on the y-axis seem pretty reasonable! If only it were always so easy! Graph i, j, and k on other dimensions (e.g., color, shape, and size seems reasonable). Did you run into any trouble? How would you work around this?
:'''PC5.''' Visualize the data using <code>ggplot2</code>. Graphing x on the x-axis and y on the y-axis seem pretty reasonable! If only it were always so easy!
:'''PC7.''' A very common step when you import and prepare for data analysis is going to be cleaning and coding data. Some of that is needed here. As is very common, <code>i</code>, <code>j</code> are really dichotomous "true/false" variables but they are coded as 0 and 1 in this dataset. Recode these columns as <code>logical</code>. The variable <code>k</code> is really a categorical variable. Recode this as a factor and change the numbers into textual "meaning" to make it easier. Here's the relevant piece of the codebook (i.e., mapping): 0=none, 1=some, 2=lots, 3=all. The goals is to end up with a factor where those text strings are the levels of the factor. I haven't shown you how to do exactly this but you can solve this with things I have shown you. Or you can try to find a recipe online.
:'''PC6.'''
:'''PC8.''' Take column <code>i</code> and set it equal to NA when if it is FALSE (originally 0). Then set all the values that are NA back to FALSE. Sorry for the busy work! ;)
:'''PC7.'''
:'''PC9.''' Now that you have recoded your data in PC7, generate new summaries for those three variables. Also, go back and regenerate the visualizations. How have these changed? How are these different from the summary detail you presented above?
:'''PC8.'''
:'''PC10.''' As always, save your work for all of the questions above as an R script. Commit that R script to your homework git repository and sync/push it to GitHub. Verify that it is online on the GitHub website at the URL linked to from the [[Statistics and Statistical Programming (Winter 2017)/List of student git repositories]] page.
:'''PC9.'''


== Statistical Questions ==
== Statistical Questions ==
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)