knitr::opts_chunk$set(echo = TRUE)

RAW SCORE: 38/60

Question 1

Suppose that X is a random variable and Y = aX+b The three expectation rules are: rule 1: $E(c) = c$ rule 2: $E(cX) = cE(X)$ * rule 3: $E(g_1(X)+...+g_n(X)) = E(g_1(X) +...+E(g_n(X))$

Prove the following are true using the three expectation rules above and discussed in class (quote the rules when proving):

(a) Prove: $E(Y) = aE(X) +b$

$E(aX+b)$ using rule 3 we get $E(aX) + E(b)$

Using rule 2 for $E(aX)$ and rule 1 for $E(b)$ we get

$aE(X) + b$

(b) Prove $V(Y) = a^2V(X)$

$V(aX+b)$ using Rule 3 we get $V(aX) + V(b)$

Using Rule 2 on $V(aX)$ and rule 1 on $V(b)$

$a^2V(X)$

(c) Suppose $Y + 2X - 3$ and $H = 4Y+1$ and $X~~N(0,\sigma = \sqrt5)$ find numerical values for

(i) E(Y): $E(2x-3)$ -> $E(2X) - 3$ -> $2E(X) - 3$ (ii) V(Y): $V(2x-3)$ -> $V(2X)$ -> $4V(X)$ -> $4*5 = 20$
(iii) V(H): $V(4Y+1)$ -> $V(4Y)$ -> $16V(Y)$ -> $16 * 20 = 320$

Question 2

A statistician at a prestigious university was looking at past records of students in order that she could better prepare a science teached who wished to recruit students to more advanced course. The researcher made the following plot (see figure 1) using the code below the data.

library(s20x)
data("course.df")
head(course.df)
library(ggplot2)

g = ggplot(course.df, aes(x = Degree, y = Exam, fill = Degree)) + 
  geom_boxplot() + geom_point() #A
g

(a) Exam is a quantitative variable T/F?

T because Exam is countable and numerical

(b) Gender is a qualitative variable T/F?

T because Gender is not countable nor numerical

(c) What Degree shows the smallest median Exam grade? see figure 1 on the previous page

Bsc because it shows the lowest Exam value at 42

(d) What Degree has the smallest Exam Interquartile range? see figure 1 on the previous page

Bsc because we can clearly see the the IQR is shorter than the others

(e) What function should be where the ellipsis is placed in Line A (Hint: geom..)?

geom_point() should be used to add the vertical points

Question 3

If Y~Bern(p) then:

$\quad\quad P(y)=p^y(1-p)^{1-y}, y \in {0,1}$

(a) Show that $M_y(t)=q + pe^t$ where $M_y(t)=E(e^{yt})$

$M_y(t) = E(e^{yt}) = \sum e^{yt}p(t) = e^{(0)t}p(0) + e^{1t}p(1) = q + pe^t$

(b) Using $\mu_y = E(Y) = \sum y_ip(y_i)$ (Not the MGF) find $\mu_y$

$\mu_y = E(Y) = \sum yp(y) = 0p(0) + 1p(1) = p$

(c) Using $\sigma^2 = E((Y-\mu)^2) = \sum (y_i - \mu)^2 p(y_i)$ (Not the MGF) find $\sigma^2_y$

$\sigma^2_y = E((Y-\mu)^2) = \sum (Y-p)^2p(y) = (0-p)^2p(0) + (1-p)^2p(1) =p^2q + q^2p = pq(p+q) = pq$

(d) Use the moment generating function $M_y(t)$ to find $\mu_y$

$\frac{d[M_y(t)]}{dt}\Big|_{t=0} = \frac{d(q)}{dt} +\frac{d(pe^t)}{dt} = p$

(e) Use the moment generating function My(t) to find $\sigma^2_y$

$\frac{d^2M_y(t)}{dt^2}\Big|_{t=0} = pq$

Question 5

From MS Ch.4 Ex 4.18, page 169. You may use any of information supplied in this exam including R output below to answer the questions. All probabilities and other answers are to be rounded to 4 decimal places.

Suppose the number Y of cracks per concrete specimen for a particular type of cement mix has approximately a Poisson probability distribution. Furthermore, assume that the average number of cracks per specimen is 2.5.

a. Find the mean and standard deviation of Y, the number of cracks per concrete specimen.

As stated in the problem, the mean is $\mu_y = 2.5$ and since in a Poisson distribution the $\mu_y = \sigma^2_y$ we can easily say that $\sigma_y = \sqrt{\sigma^2_y} = \sqrt{2.5} = 1.5811$

b. Find the probability that a randomly selected concrete specimen has exactly five cracks.

# This will give us the correct value when Y is exactly 5
# We use the density function
dpois(5, 2.5)

c. Find the probability that a randomly selected concrete specimen has two or more cracks

1-ppois(1,2.5)

d. P(within $2\sigma$ of $\mu$)

# The left bound is zero so we can take a lower tail from the right bound
dpois(6,2.5)

And the answer to Y/N is YES it does agree with empirical rule.

e. Find P(2<= Y < 6)

ppois(5,2.5) - ppois(2,2.5)

Question 6

Testing Problem: Suppose a durg test is 99% sensitive and 97% specific. That is, the test will produve 99% true positive results for drug users and 97% true negative results for non-drug users. Suppose that 0.2% of people are users of the drug. We need to find the solution to the question: If a randomly selected individual tests positive (+), what is the probability he or she is a User (U)?

Baye's Rule $p(A_i|B) = \frac{p(A_i)p(B|A_i)}{p(B)}$

(a) Write down Bayes' rule needed to answer the above question in terms of $+, U, \bar{U}$

$P(U|+) = \frac{p(U)p(+|U)}{p(U)p(+|U)+p(\bar{U})p(+|\bar{U})}$

(b) In the case of the above testing problem write down the expression for p(+) in terms of a summation

p(+) = 1 - p(-)

(c) Identify the prior in the testing problem by writing down its algebraic expression. Examples $p(\bar{U}), p(U), p(-), P(+)$ etc

$p(U)$

(d) If a randomly selected individual tests positive (+), what is the probability he or she is a user (U) (Six decimal places - do NOT use a percentage)?

$p(u|+) = \frac{(.002)(.99)}{(.002)(.99) + (.998)(.03)} = .0620$

(e) If a randomly selected individual tests (+), what is the probability he or she is not a user ($\bar{U}$) (Six decimal places - do NOT use a percentage)?

$p(\bar{U}|+) = \frac{(.998)(.01)}{(.998)(.01) + (.002)(.99)} = .847199$



agracy2246/MATH4753grac0009 documentation built on April 26, 2020, 9:39 a.m.