---
title: "PSY_392_HW3"
output: html_document
---
Please read everything carefully!!!

*** Due Friday, September 27th at 5:00 PM via email to Garrett (goday@purdue.edu)

*** Submit this R markdown file but change the name of the file to lastName_FirstName_PSY392_HW3

*** Submitting an incorrect file type or a poorly labeled HW (e.g., HW3) will result in a 2 point deduction



Question 1 - Explain the types of decisions that one can make with respect to the true state of the world. Why is this important to statistics?
```{r}
# add your response as a comment in this code chunk
```

Quesiton 2 - Provide a real world example where making a miss would be the worst case scenario.
```{r}
# add your response as a comment in this code chunk
```

Quesiton 3 - Provide a real world example where making a false alarm would be the worst case scenario.
```{r}
# add your response as a comment in this code chunk
```

Getting to know the Binomial distribution in R!
R comes with common distributions built in.

To use to binomial distribution use the function to calculate the probability of exact events:
dibinom(x, size, prob)
x is the number of successful outcomes
size is the number of trials
prob is the probability of a succesful outcome
```{r}
# What is the probability of flipping exactly 5 heads in 10 tosses?
dbinom(5, size = 10, prob = .5) 
# The first number is the number of successful outcomes (5 heads)
# Size is the number of times we flip the coin (10)
# prob is the probability of a coin landing heads (.5)
```

Reproducing the mind reading table from lecture
```{r}
dbinom(0, size = 10, prob = .5) 
dbinom(1, size = 10, prob = .5) 
dbinom(2, size = 10, prob = .5) 
dbinom(3, size = 10, prob = .5) 
dbinom(4, size = 10, prob = .5) 
dbinom(5, size = 10, prob = .5) 
dbinom(6, size = 10, prob = .5) 
dbinom(7, size = 10, prob = .5) 
dbinom(8, size = 10, prob = .5) 
dbinom(9, size = 10, prob = .5) 
dbinom(10, size = 10, prob = .5) 
```

To find the probability of at least 5 correct guess, you would add up P(5) + P(6) + P(7) + P(8) P(9) + P(10)
```{r}
dbinom(5, size = 10, prob = .5) +
dbinom(6, size = 10, prob = .5) +
dbinom(7, size = 10, prob = .5) +
dbinom(8, size = 10, prob = .5) +
dbinom(9, size = 10, prob = .5) +
dbinom(10, size = 10, prob = .5) 

# a less bulky way to do this is to use the pbinom function which computes cumulative probability
pbinom(4, size = 10, prob = .5) # this is the probability of four heads or less

# we know probabilities sum to 1, so we can take the compliment of this to compute the probability of 5 or more correct guesses
1-pbinom(4, size = 10, prob = .5) # is the same result as summing P(5) to P(10)
```

To use to binomial distribution use the function to calculate cumulative probability use:
pbinom(x, size, prob)
x is the number of successful outcomes
size is the number of trials
prob is the probability of a succesful outcome

Question 4 
Using the either binomial function described above...
... What is the probability that a student gets 70% or better on a 10 problem multiple choice test by guessing?
Each question on the test has four options.
Be sure to interpret the probability (is this a good test?)

You can check your work with this online calculator, but you are expected to provide R code that solves the problem.
https://introstatsonline.com/chapters/calculators/binomialProb.html

```{r}
# add your response as a comment in this code chunk
# *** provide code for computing the probability ***
# provide your interpretation as a comment
```

Question 5 - Hypothesis testing
The online calculators may help you:
https://introstatsonline.com/chapters/calculators/inverse_t_dist.shtml
https://introstatsonline.com/chapters/calculators/t_dist.shtml

Suppose the height of King Penguins last year was 90 cm. 
A penguin researcher in Antartica was able to measure 20 King Penguins this year and found the average height of the sample was 96 cm. 
Assume the sample standard deviation is 4 cm. Is this sample of penguins taller than the penguins from last year?
```{r}
# add your response as a comment in this code chunk
# be sure to include all of the steps for hypothesis testing
```

