Suppose that \(X\sim\mathcal{N}(2, 10^2)\). We sample the variable \(X\) once (i.e., we obtain a sample from the distribution \(\mathcal{N}(2, 10^2)\)). In this problem, you will be computing the same quantity in four different ways. You should expect to get roughly the same answer every time.
Write R code to obtain \(P(2.1 < X < 3.1)\). Use pnorm
.
Write R code to obtain \(P(2.1 < X < 3.1)\). Use pnorm(..., ,mean = 0, sd = 1)
.
Write R code to obtain \(P(2.1 < X < 3.1)\). Use rnorm
. (And not pnorm
.)
Write R code to obtain \(P(2.1 < X < 3.1)\). Use rnorm(..., mean = 0, sd = 1)
Suppose 65% of Princeton students like Wawa better than World Coffee. We selected a random sample of 100 students, and asked them which they prefer. What is the probability that more than 78 students said “Wawa”?
Answer the question using pbinom
.
Answer the question using pnorm
. Use the normal approximation to the Binomial distribution (recall: the mean is \(n\times prob\) and the variance is \(n\times prob\times (1-prob)\)).
(Note: you shouldn’t expect an exact match between 2(a) and 2(b) because of the lack of continnuity correction. You can try obtaining an exact match by varying the value of the q
).
Suppose 100 Princeton students we asked whether Harvard or Stanford is the worse online institution of higher learning. 60 students said that Stanford is worse. Compute the p-value for the null hypothesis that Princeton students think that Harvard and Stanford are equally bad, on average. What can you conclude?
Answer Problem 2 using only rnorm(..., mean = 0, sd = 1)