---
title: "Lab 4: Data Collection"
author: "Insert Name"
output:
  pdf_document
urlcolor: blue
---

```{r setup, include=FALSE}
# Do not modify this chunk.
knitr::opts_chunk$set(echo = TRUE)
library(tidyverse)
```


# Due: beginning of Lab February 25 or 26

# Instructions
Work through the problems below, and submit this document as a knitted .pdf file with answers to the Problem Set 1 assignment on [Gradescope](https://www.gradescope.com/courses/227442/). 

**In some problems, an incomplete R chunk has been provided. To evaluate the chunk, follow the given instructions, and then change `eval=FALSE` to `eval=TRUE`.

**For each problem, put your solution between the bars of red stars.**


--


## Problem 1

The following data set is from the paper ["Choices, Values, and Frames" by D. Kahneman and A. Tversky (1984)](https://web.missouri.edu/~segerti/capstone/choicesvalues.pdf).  It explores whether people are rational decision makers. 236 college students were randomly assigned to one of the following two decisions sets.  The first set of 86, we will call them group 1,  were assigned to the following decision set:

Choose between:

* A. a 25% chance to win \$240, and a 75% chance to lose \$760
   
* B. a 25% chance to win \$250, and a 75% chance to lose \$750
  
The remaining 150, we will call them group 2, were assigned to the following decision set:

Decision 1 Choose between:

* C. a sure gain of $240

* D. 25% chance for \$1000 gain, and a 75% chance for \$0 gain

Decision 2 Choose Between:

* E. a sure loss of \$750

* F. 75% chance to lose \$1000, and a 25% chance to lose \$0

Answer the following questions based on this study.


  a. What type of study is this
  
*************************************************

*************************************************

  b. In the survey, the researchers had one set of participants choose between A or B and another set of participants choose between C or D and E or F.  Why would the researchers divide the participants in this way?

*************************************************

*************************************************

Change `eval=TRUE` and run the following code to create a data frame with the decision sets and choices made by the students.
```{r, eval=FALSE}

df_set1 <- data.frame(
  Student=151:236,
  Frame=rep(c("neutral"),
            times=86),
  Choice=rep(c("B"),
             times=86)
)

df_set2 <- data.frame(
  Student=rep(1:150,
           times=2),
  Frame=rep(c("gain","loss"),
            times=c(150,150)),
  Choice=rep(c("C","D","E","F","E","F"),
             times=c(126,24,16,110,4,20))
)

df_cvf <- rbind(df_set1, df_set2)

rm(df_set1)
rm(df_set2)

```


  c. What is an observation in this data set?
 
*************************************************
 
*************************************************
 
  d. For the students in group 1, what proportion of the students made choice B?

*************************************************

*************************************************

  e. Now calculate the proportion of students in group 2 that chose both "D" and "E" using only `dplyr` verbs. *Hint*: instead of trying to create a table that has the desired proportion, create a table that has the number of students that made this choice combination, and then calculate the proportion.  This can be though of as two steps (with more than one verb per step).  First create a table based on the appropriate criteria that shows how many times a student appears in the table, and then determine how many students appear the appropriate number of times.
  
*************************************************

*************************************************

  f. Now calculate the proportion of students in group 2 that chose both "C" and "F".

*************************************************

*************************************************

  g. Interestingly, choice A is mathematically equivalent to the combination of choices "C" and "F" and choice B is mathematically equivalent to the combination of choices "D" and "E" (you will learn how to calculate this during week 7 when expected value is covered).  Do these results imply that humans are always rational or that their decision making can be susceptible to framing?
  
*************************************************

*************************************************



## Problem 2

Chia Pets -- those terra-cotta figurines that sprout fuzzy green hair -- made the chia plant a household name. But chia has gained an entirely new reputation as a diet supplement.  In one 2009 study, a team of researchers recruited 38 men and divided them evenly into two groups: treatment or control. They also recruited 38 women, and they randomly placed half of these participants into the treatment group and the other half into the control group. One group was given 25 grams of chia seeds twice a day, and the other was given a placebo. The subjects volunteered to be a part of the study. After 12 weeks, the scientists found no significant difference between the groups in appetite or weight loss. (Nieman:2009)

  a. What type of study is this? 
  
*************************************************

*************************************************

  b. What are the experimental and control treatments in this study?

*************************************************

*************************************************

  c. Has blocking been used in this study? If so, what is the blocking variable?
  
*************************************************

*************************************************

  d. Has blinding been used in this study?

*************************************************

*************************************************

  e. Comment on whether or not we can make a causal statement, and indicate whether or not we can generalize the conclusion to the population at large.

*************************************************

*************************************************


## Problem 3

Identify the flaw in reasoning in the following scenarios. Explain what the individuals in the study should have done differently if they wanted to make such strong conclusions.

  a. Students at an elementary school are given a questionnaire that they are required to return after their parents have completed it. One of the questions asked is, "Do you find that your work schedule makes it difficult for you to spend time with your kids after school?" Of the parents who replied, 85\% said "no". Based on these results, the school officials conclude that a great majority of the parents have no difficulty spending time with their kids after school.

*************************************************

*************************************************

  b. A survey is conducted on a simple random sample of 1,000 women who recently gave birth, asking them about whether or not they smoked during pregnancy. A follow-up survey asking if the children have respiratory problems is conducted 3 years later, however, only 567 of these women are reached at the same address. The researcher reports that these 567 women are representative of all mothers.

*************************************************

*************************************************

  c. An orthopedist administers a questionnaire to 30 of his patients who do not have any joint problems and finds that 20 of them regularly go running. He concludes that running decreases the risk of joint problems.
 
*************************************************

*************************************************


## Problem 4

A large college class has 160 students. All 160 students attend the lectures together, but the students are divided into 4 groups, each of 40 students, for lab sections administered by different teaching assistants. The professor wants to conduct a survey about how satisfied the students are with the course, and he believes that the lab section a student is in might affect the student's overall satisfaction with the course.

  a. What type of study is this?
  
*************************************************

*************************************************

  b. Suggest a sampling strategy for carrying out this study.

*************************************************

*************************************************


## Problem 5

In a study of the relationship between socio-economic class and unethical behavior, 129 University of California undergraduates at Berkeley were asked to identify themselves as having low or high social-class by comparing themselves to others with the most (least) money, most (least) education, and most (least) respected jobs. They were also presented  with a jar of individually wrapped candies and informed that they were for children in a nearby laboratory, but that they could take some if they wanted. Participants completed unrelated tasks and then reported the number of candies they had taken. It was found that those in the upper-class rank condition took more candy than did those in the lower-rank condition.

  a. Identify the population of interest.
  
*************************************************

*************************************************
  
  b. Identify the the variabels and specify their types.

*************************************************

*************************************************

  c. Identify the sample in the study.

*************************************************

*************************************************

  d. Identify the research question.

*************************************************

*************************************************

  e. Comment on whether the results of the study can be generalized to the population and if the findings of the study can be used to establish causal relationships.

*************************************************

*************************************************
