Homework 1

You must be able to access R and R Studio.  Either through the server (https://rstudio.campus.pomona.edu) or on your own computer.  See: http://research.pomona.edu/johardin/math58bs17/ for many resources.
require(dplyr)
require(ggplot2)

Click on the Knit icon at the top of R Studio to run the R code and create a Word document simultaneously.

  1. (PP 1.5+, page 46 in your text)
  1. Do the data from Inv 1.5 provide convincing evidence that the probability of leaning right is larger than 0.5? (State the hypotheses, report the p-value describing how you determined it and clarifying what it is in terms of the probability of P(X…), and interpret the strength of evidence against the null hypothesis).
  2. Do the data from Inv 1.5 provide convincing evidence that the probability of leaning right differs from 0.5?
  3. What two values are used in (b) for the cut-offs, and how far is each from the expected value of X?
  4. Reconsider part (a): how would your results have differed if you had chosen left instead of right? Would your choice have impacted the results from the rest of the investigation (where consideration was for 0.74 instead of 0.5)? Explain.
  5. Reconsider part (b): how would your results have differed if you had the same proportional data but half of the observations (that is, data were 40 right kissers out of 62). Repeat the analysis in (b).
  1. Using the Infant data (from Inv 1.1), create two additional bargraphs. (The qplot command is in the ggplot2 package. Try googling “qplot bargraph” and look at images.)
Infants <- read.delim("http://www.rossmanchance.com/iscam3/data/InfantData.txt")
load(url("http://www.rossmanchance.com/iscam3/ISCAM.RData"))
qplot(choice, data=Infants, geom="bar")

  1. Make a bargraph which is horizontal instead of vertical. (try “+ coord_flip()” )
  2. Change the label to read “baby count” instead of “count”. (try “+ xlab(”my x-axis label“)”)
  1. Summarize the infant data in a few different ways. Use the commands summary and table. Also, as per below, find both the proportion and percent in each group.
Infants %>%
  group_by(choice) %>%
  summarize(npergroup = n()) %>%
  mutate(proppergroup = npergroup / sum(npergroup))
## # A tibble: 2 × 3
##     choice npergroup proppergroup
##     <fctr>     <int>        <dbl>
## 1   helper        14        0.875
## 2 hinderer         2        0.125




General notes on homework assignments (also see syllabus for policies and suggestions): - please be neat and organized, this will help me, the grader, and you (in the future) to follow your work.

Homework assignments will be graded out of 5 points, which are based on a combination of accuracy and effort. Below are rough guidelines for grading.

Score & Description
5 points: All problems completed with detailed solutions provided and 75% or more of the problems are fully correct.

4 points: All problems completed with detailed solutions and 50-75% correct; OR close to all problems completed and 75%-100% correct

3 points: Close to all problems completed with less than 75% correct

2 points: More than half but fewer than all problems completed and > 75% correct

1 point: More than half but fewer than all problems completed and < 75% correct; OR less than half of problems completed

0 points: No work submitted, OR half or less than half of the problems submitted and without any detail/work shown to explain the solutions.