If the read.csv doesn’t work for you, use the R dataset:
a. The order in which the capsules were drawn determined the order with which people with different birthdates were called for military service. The top lottery number reached was 195, meaning that no one with a lottery number of 196 or greater were called up for military service. Use your deductive reasoning skills to determine which variable gives you this lottery number. Plot this variable against birth month. A boxplot might be a good option, but maybe something else is better. Be creative. I gave you sample code for visualization and descriptive statistics in Lecture 7, including boxplot code among others. You will use this visual to inspect the claim made in the NYT article that the draft was not random.
b. Based on the graphics you produced above, are there birth months that appear to be drafted at higher or lower rates than others?
c. You know birthdays with a lottery number above 195 were drafted. Calculate the proportion of birthdates selected for the draft. There’s an indicator variable in the dataset that may help you calculate this proportion. Hint: You will calculate this proportion. The table(df$var) command may be helpful here
d. Perform a two-sample hypothesis test (using the prop.test command we will review in Lecture 15) to evaluate whether the proportion of men with December birthdays was different than the population proportion (you calculated this in part c) at the 2% significance level.
You will need to calculate p̂.
table(df$var2, df$var1) command may be helpful here.
As might the tapply(X=df$var1), INDEX=list(df$var2), FUN=length) command.
e. At what significance level could have you rejected the null hypothesis?
f. Do you think the 1970 draft lottery was fair? Provide supporting evidence for your opinion, including results from any statistical tests and graphical plots that support your claim.
(*) To compile report: Go to the “File” menu and select “Compile Notebook.” Hit the “Compile” button and then select HTML, PDF, or Word (whichever works). If this isn’t working for you, double check the following:
1) There are no errors in your code; if you’re seeing red when you run the full script, you’ll need to comment
out the error (place an “#” before the line) or simply erase it from your script;
2) You do not have a data window open and a View() command is not in your script;
3) There are no special characters in your code (e.g., ≤, ≥, µ);
4) You do not have an HTML, PDF, or Word file with the same name as your R script in your working directory (delete it and try again if this is the case); the name of your compiled report will match the name of your R script file, so if you try to create a report with the same name as an existing one you may get an error;
5) Try “Knit document” from the “File” menu instead of “Compile Notebook”.
These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.## R Exercise
df.drafted <- draft[draft$drafted==1, ]
df.not.drafted <- draft[draft$drafted==0, ]
apply(df.drafted, 2, max)
draft_order maximum value is 195 for the drafted data, it shows
draft_order is the lottery number.
boxplot(draft_order ~ month,
data = draft,
xlab = "Month",
ylab = "Lottery Numbers")
abline(h = 195)
Horizontal line is marked at 195, which shows the maximum lottery number
for the drafted tickets, it can be seen that higher birth months tend to be
By purchasing this solution you'll be able to access the following files:
Solution.Rmd and Solution.pdf.