The purpose of the project is to give you an opportunity to work on a larger analysis than what we normally tackle in the homeworks, and for you to practice working in a group (each group will have three or four people). The main advantage to working in a group is that you can bounce ideas off one another, and hopefully uncover more interesting features of the data. The main problem, as most of you will discover, is co-ordinating time to meet together.
I expect the project to be approximately three times as much as normal homework. I think this is fair: you have three times as long, and you can share the work. Don't mistake the effort you put in with the length of the final project - here are a couple of quotes to get you thinking:
"I have made this letter longer than usual, because I lack the time to make it short."
Blaise Pascal
"If I am to speak ten minutes, I need a week for preparation; if fifteen minutes, three days; if half an hour, two days; if an hour, I am ready now."
Woodrow Wilson
In this project, you will perform a complete organisation, summary and visualisation of a data set. You will apply the skills you learned in class to data on baseball players from the baseball databank.
I provide two data sets: players.csv and batting.csv but you are welcome to supplement this with other datasets from the baseball databank. Wikipedia provides a good introduction to most of the variables in data. Because the data contains some dates, and we haven't covered dates in class yet, here is a short snippet to get you started:
options(stringsAsFactors = FALSE)
b <- read.csv("batting.csv")
p <- read.csv("players.csv")
parse_date <- function(x) as.Date(strptime(x, "%m/%d/%Y"))
date_vars <- c("birth","debut", "final", "death")
p[date_vars] <- lapply(p[date_vars], parse_date)
str(p)
Read ?merge to find out how to combine the two tables. The following example shows how you might use merge to work out the age of each player.
byear <- 1900 + as.POSIXlt(p$birth)$year born <- data.frame(id = p$id, byear) # Use all.x to ensure we don't lose data for players without birth year b2 <- merge(b, born, by = "id", all.x = T) b2$age <- b2$year - b2$byear + 1
The data available is rather large, so you will need to read about what is available, discuss questions you aim to answer, and identify the data necessary to answer them (try to not use more than four or five variables; also think of ways to reduce the number of rows you're dealing with). Here are some questions to think about:
21 Sep-25 Sep. Meet with me go over your initial questions and draft investigations. (Email me to set up a time).
Fri 2 Oct. Hand in 10-15 page report organised as described below, plus an appendix containing your R code. Please also send me a copy of the report as a PDF.
Overall grade breakdown:
The grading rubric that I'll use is available as a pdf, and is described in more detail below.
The purpose of the introduction is to introduce the data set, provide some context, and guide me as to what to expect from the rest of the report. You may find it easiest to write last, after the rest of the report. It should be about a page in length.
You should have approximately four or five main questions and associated findings, each which may be broken down further in more specific minor questions. Some of these questions will occur to you immediately upon looking at the data, and some will require considerable considerable exploration before they occur to you. To get to the four questions that you report on, I'd expect you to have had 20 or more questions. A lot of the time you will run into a dead end, or the answer to your question will turn out to be uninteresting or obvious. It is always disappointing not to report on something that you spend time working on, but it does make for a better report. You might want to briefly mention some of the dead ends you went down to demonstrate that you've done more than just the obvious.
A good way to present this material is to have one plot or table on a page, along with an accompanying description of what the plot tells you. Don't forget to use headings to break up the sections. You may need multiple plots and tables for each question.
Like your homeworks, I will assess the questions and findings based on the three criteria of curiosity, scepticism and organisation.
In all real data sets you will need to spend a lot of time cleaning up the data - fixing incorrect values, dealing with missing values etc. Don't forget to give a brief description of what you did - that could count as one of your 4-5 questions/findings.
The conclusion should summarise your findings. Rather than just repeating what you've already said, try and weave your findings together into a consistent story. You should also reflect a little on other questions that the exploration raised, and what you would do next. Do you need to collect more data? Or collect data in a different way?
I'll also mark the general presentation of the project. This is divided into three parts: text, tables and graphics. Graphs should follow the guidelines we have discussed in class - we haven't discussed tables in class, but here are some good guidelines from North Carolina State. Also make sure to look at the xtable package.
You are encouraged to explore more of the capabilities of latex to produce a unique and attractive document. The documentation for the memoir package is comprehensive and provides many ideas. It's also huge, so don't try and read the whole thing, just pick out bits that look interesting.
Last, but not least, your report should include an (electronic) appendix which allows the reader to reproduce your findings. For this project, this would be an appendix containing the R code used to produce your graphics and perform an analyses. This appendix will be graded according to the code rubric.