1) [1 pts] Setting up

First, I will get the working directory.

getwd()
## [1] "/Users/owner/Downloads"

Now, for my convenience, I will move the file into a more specific location in my Desktop where I can find it more easily.

setwd("/Users/owner/Desktop/PSYC 2020 Lab 7 Assignment")

The working directory has been changed.

1a. [0.5 pts] Rename the template and fill out the author and date lines.

I have renamed the template, placed my name as the author, and dated the assignment to the today as we learned it in lab just now.

1b. [0.5 pts] Knit the empty template once to make sure it knits without errors before you start.

I have knit the empty template and it knits without errors.

2) [2.5 pts] From z to probability with pnorm()

2a. [0.5 pts] What is the probability of a z-score at or below −1.5?

Finding probability using pnorm():

pnorm(-1.5)
## [1] 0.0668072

The probability of a z-score at or below -1.5 is 0.0668072, or about 0.07.

2b. [0.5 pts] What is the probability of a z-score at or above 2.1?

Finding probability again, but for a different value of 2.1, using pnorm():

pnorm(2.1, lower.tail = FALSE)
## [1] 0.01786442

The probability of a z-score at or above 2.1 is 0.01786442 or about 0.02.

2c. [0.5 pts] What is the probability of a z-score between −1 and 1?

Finding probability for a z-score between -1 and 1 using pnorm() and operations, setting a range:

pnorm(1) - pnorm(-1)
## [1] 0.6826895

The probability of a z-score between -1 and 1 is 0.6826895, or about 0.68.

2d. [0.5 pts] What is the probability of a z-score at least as extreme as 2.5 in either direction (|z| ≥ 2.5)?

For this part, I am recognising the range as well as the need for acknowledging the lower.tail:

pnorm(-2.5) + pnorm(2.5, lower.tail = FALSE)
## [1] 0.01241933

The probability of a z-score at least as extreme as 2.5 in either direction (|z| ≥ 2.5) is 0.01241933, or about 0.01.

2e. [0.5 pts] Explain what the lower.tail argument does and when you would set it to FALSE.

Your answer: ## The ‘lower.tail’ argument determines whether or not pnorm() calculates the probability below a certain s-score, or if it’s actually above it. ## When set to ‘FALSE’, the ‘lower.tail’ helps find the probability above the z-score.

3) [2 pts] From probability to z with qnorm()

3a. [0.5 pts] What z-score has 10% of the distribution below it?

Finding using qnorm():

qnorm(0.10)
## [1] -1.281552

The z-score -1.281552 has 10% of the distribution below it.

3b. [0.5 pts] What z-score has 5% of the distribution above it?

I will use the opposing value, .95, this time since the question asks for above instead of below.

qnorm(0.95)
## [1] 1.644854

The z-score 1.64485 has 5% of the distribution above it.

3c. [0.5 pts] What two z-scores cut off the middle 99% of the distribution (0.5% in each tail)?

For 0.5% in each tail, I will use 0.005 and 0.995.

qnorm(c(0.005, 0.995))
## [1] -2.575829  2.575829

The two z-scores that cut off the middle 99% of the distribution are -2.575829 and 2.575829.

4) [1 pt] Standard error

4a. [0.5 pts] SAT: μ = 1200, σ = 110. What is the standard error of the mean for samples of n = 25?

I will find the standard error by dividing the standard deviation(σ) by sqrt(25):

110 / sqrt(25)
## [1] 22

This results in a standard error of the mean for samples of n = 25 being 22.

4b. [0.5 pts] ACT: μ = 29, variance = 64. What is the standard error of the mean for samples of n = 36?

I will use a similar method to find this solution, but I will focus on the variance as well:

sqrt(64) / sqrt(36)
## [1] 1.333333

The standard error of the mean for samples of n = 36 is 1.333333.

5) [4 pts] Comprehensive question: how likely is our sample mean?

A school wonders whether its students score differently from the SAT population (μ = 1200, σ = 110). A random sample of n = 25 of its students has a mean SAT score of 1240.

5a. [0.5 pts] Calculate the standard error of the sampling distribution of the mean.

This is me calculating the standard error:

se <- 110 / sqrt(25)
se
## [1] 22

The standard error is 22.

5b. [0.5 pts] Calculate the z-statistic of this sample mean.

This is me calculating the z-score:

z <- (1240 - 1200) / se
z
## [1] 1.818182

The z-statistic is 1.818182.

5c. [0.75 pts] Use pnorm() to find the probability of getting a sample mean of 1240 or higher if the population mean really is 1200.

Finding the upper-tail probability:

pnorm(z, lower.tail = FALSE)
## [1] 0.03451817

The probability for this problem is 0.03451817.

5d. [0.5 pts] Check 5c without computing z first: pnorm(1240, mean = ___, sd = ___, lower.tail = FALSE). Do the two answers match?

Finding the probability more directly using pnorm():

pnorm(1240, mean = 1200, sd = se, lower.tail = FALSE)
## [1] 0.03451817

The probability that results from this is 0.03451817 which is the same as and matches 5c.

5e. [0.5 pts] Interpret the probability from 5c: is a sample mean of 1240 likely or unlikely if μ = 1200?

Your answer: ## A sample mean of 1240 or higher is small (0.03451817) if the population mean (μ) is 1200, meaning that this sample mean is relatively unlikely.

5f. [0.75 pts] Suppose the school had sampled n = 100 students and still found a mean of 1240. Recompute the standard error, z, and the probability from 5c. What changed, and why?

Interpreting the probability based on standard error, z-statistic, and pnorm():

se_100 <- 110 / sqrt(100)
z_100 <- (1240 - 1200) / se_100
p_100 <- pnorm(z_100, lower.tail = FALSE)

se_100
## [1] 11
z_100
## [1] 3.636364
p_100
## [1] 0.000138257

Your answer: ## The standard error decreased to 11, the z-score increased to 3.636364, and the probability decreased to 3.636364. This all happened as the sample size increased. The same difference from the population mean is abnormal with a larger sample size.