187k views
4 votes
Question: Part A) Suppose ∼(10,4). What Is P(≤9)? Save Your Answer As P2.CDF And Round Your Answer To Two Decimal Places. Hint: Use The Pnorm() Function. Be Careful About The Parameters! Part B) Given The Same As In Part A, What Is The Value Such That P(≤)=0.75? Save Your Answer As P2.InvCDF And Round Your Answer To Two Decimal Places. Hint: Part A) Suppose ∼(10,4). What is P(≤9)? Save your answer as p2.CDF and round your answer to two decimal places. Hint: Use the pnorm() function. Be careful about the parameters! Part B) Given the same as in Part A, what is the value such that P(≤)=0.75? Save your answer as p2.invCDF and round your answer to two decimal places. Hint: Use the qnorm() function. Be careful with the parameters! Part D) Suppose 1,…,8∼iid(14,4). What is P(¯≥14.5)? Save your answer as p2.d and round your answer to two decimal places. Part E) There are two distribution functions that we haven't used yet: dnorm() and rnorm(). So let's use them! Generate 500 samples from a standard normal distribution (Hint: Use rnorm() to sample these values) and plot a histogram of their values. Make sure your histogram is displaying densities, not frequencies. Then use the lines() function to plot the PDF of the standard normal (Hint: Use dnorm() to get the PDF) ontop of the histogram

User Jabongg
by
7.9k points

1 Answer

1 vote

Answer:

Part A) To find P(≤9) for a normal distribution with a mean of 10 and a standard deviation of 4, you can use the `pnorm()` function in R. Here's how you can calculate it and save it as `p2.CDF`:

```R

mean <- 10

sd <- 4

x <- 9

p2.CDF <- pnorm(x, mean, sd)

p2.CDF <- round(p2.CDF, 2)

```

Part B) To find the value such that P(≤) = 0.75 for the same normal distribution, you can use the `qnorm()` function. Here's how you can calculate it and save it as `p2.invCDF`:

```R

p_value <- 0.75

p2.invCDF <- qnorm(p_value, mean, sd)

p2.invCDF <- round(p2.invCDF, 2)

```

Part D) To find P(¯≥14.5) for 1,...,8∼iid(14,4), you can use the `pnorm()` function. First, calculate the mean and standard deviation of the sample mean:

```R

sample_mean <- 14

sample_sd <- 4 / sqrt(8) # Standard error of the mean

```

Now, calculate P(¯≥14.5):

```R

x_bar <- 14.5

p2.d <- 1 - pnorm(x_bar, sample_mean, sample_sd)

p2.d <- round(p2.d, 2)

```

Part E) To generate 500 samples from a standard normal distribution and plot a histogram with the PDF overlaid, you can use the `rnorm()`, `hist()`, and `dnorm()` functions. Here's how you can do it:

```R

# Generate 500 samples from a standard normal distribution

samples <- rnorm(500)

# Create a histogram with density plot

hist(samples, prob = TRUE, main = "Histogram of Standard Normal Distribution")

curve(dnorm(x, mean = 0, sd = 1), add = TRUE, col = "blue")

```

This code will generate a histogram of the 500 samples with the standard normal PDF overlaid in blue.

Explanation:

User Apurva Mayank
by
8.2k points