Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Stat 341 Homework 10 due: April 3, 2009 worth: 30 pts 1. According to a 1990 FDA report, mercury levels in swordfish had mean µ = 0.976 and standard deviation σ = 0.510, measurements in parts per million (PPM). (a) If you eat a piece of one swordfish every week and you assume swordfish mercury levels follow a Normal(µ, σ 2 ) distribution, what proportion of weeks would you consume swordfish with more than 1PPM, the FDA recommended upper limit. Solution: Let’s use random variable X to stand for the the amount of swordfish mercury we assume if we eat a piece of one swordfish every week, then X ∼ Normal(µ, σ 2 ). The proportion of weeks we consume swordfish with more than 1PPM is P (X > 1). P (X > 1) = 0.4812 Rcode: > pnorm(1,0.976,0.510,lower.tail=F) [1] 0.4812332 Or we use transformation: X −µ 1 − 0.976 P (X > 1) = P = P (Z > 0.0470) = 1 − P (Z < 0.0470) > σ 0.510 and then refer to the normal table on the text book for the answer. (b) When the FDA performed its testing prior to 1990, it encountered one swordfish with mercury level of 3.730 PPM. What is the probability of observing a mercury level this high or higher in one fish? Solution: The random variable X in part (a) is also the mercury levels in swordfish. P (X > 3.730) = 3.332045 × 10−8 Rcode: > pnorm(3.730,0.976,0.510,lower.tail=F) [1] 3.332045e-08 (c) The FDA sampled 618 swordfish for this study. If all swordfish sampled are independent, what is the probability that only one fish would have more than 3 PPM? Solution: The probability for a single fish to have more than 3 PPM is p0 = P (X > 3) = 3.614390 × 10−5 . Let’s use random variable Y to represent the number of fish that have more than 3 PPM. Then Y is a binomial random variable with parameter n = 618 and p = p0 . P (Y = 1) = 0.02184430 Rcode: > dbinom(1,618,3.614390e-05) [1] 0.02184430 2. Consider the soft-drink vending machine discussed in class. Suppose the soft-drink vendor wants to advertise to customers that they dispense an average µ = 7.5 oz. into their 8 oz. cups. Nevertheless, they still want to reduce the probability of overflow, so they develop a new calibration technique that lets them adjust the variance σ 2 . How should they calibrate σ 2 such that only 1% of the cups overflow if the volume dispensed follows a normal distribution N (µ, σ 2 )? Solution: Let’s use random variable X to stand for the volume of soft-drink dispensed, then X ∼ N (µ, σ 2 ). 0.5 8 − 7.5 X −µ =P Z> = 0.01 > P (X > 8) = P σ σ σ So we know that 0.5 σ = z0.01 = 2.326348 (qnorm(0.99)), thus 2 σ = 0.5 2.326348 2 = 0.04619454 3. The soft-drink vending machine of the competitor uses lasers to stop the flow of soft-drink when the height in the cup reaches a certain target level. (They claim this leads to less spillage than regulating volume.) If the radius of the cup r is normally distributed with mean µ = 0.75 and standard deviation σ = 0.025, what is the mean volume dispensed from this machine if the laser is set to a height of 4 inches and the cup is assumed to be perfectly cylindrical? Solution: Let’s use random variable R to represent the radius of the cup and random variable V to represent the volume dispensed, then R ∼ N (µ, σ 2 ) and V = 4πR2 . 2 2 2 E[V ] = E[4πR ] = 4πE[R ] = 4π V ar(R)+(E[R]) = 4π 0.0252 + 0.752 = 7.0764 Page 2 4. The binomial distribution Binomial(n, p) can be approximated by the normal distribution N (np, np(1 − p)) when the number of trials n is large. Demonstrate (how is your choice, but a plot in R would work) that the approximation requires larger n to be valid for p = 0.1 than for p = 0.5. Solution: Let’s use plot to demonstrate it. The R code is as follows: BinomComp=function(n,p1=0.1,p2=0.5) { #This function compare the goodness of normal approximation to #binomial distribution with success probabilities p1 and p2 #Parameter n is the parameter of the binomial distribution #Parameter p1 is the success probability for the first binomial #distribution and has the default value 0.1 #Parameter p2 is the success probability for the second binomial #distribution and has the default value 0.5 par(mfrow=c(2,1)) # two plots, one above the other main0 <- "Normal Approximaton to B(" x <- 0:n # plot distribution for these values of x y1 <- dbinom(x, n, p1) # compute binomial pmf at the above x mu1 <- n*p1 # compute mean and sd of approximate normal sigma1=sqrt(mu1*(1-p1)) # plot binomial pmf plot(x, y1, type="l", col="black", ylim=c(0,1/sqrt(2*pi)/sigma1)) x <- seq(0, n, 0.05) # plot distribution z1 <- dnorm(x, mu1, sigma1) # compute values of normal pdf lines(x, z1, type="l", col="red") # add line to plot main1=paste(main0,n,",",p1,")",sep="") title(main=main1) # add title to plot # repeat work on second plot x <- 0:n y2 <- dbinom(x,n,p2) mu2 <- n*p2 sigma2 <- sqrt(mu2*(1-p2)) plot(x, y2, type="l", col="black", ylim=c(0,1/sqrt(2*pi)/sigma1)) x <- seq(0,n,0.05) z2 <- dnorm(x, mu2, sigma2) lines(x, z2, type="l", col="red") main2 <- paste(main0, n, ",", p2, ")", sep="") title(main=main2) } Page 3 Let’s use this function to do the plots: > BinomComp(10) > BinomComp(20) > BinomComp(30) The following are the graphs: 0.2 0.0 y1 0.4 Normal Approximaton to B(10,0.1) 0 2 4 6 8 10 x 0.2 0.0 y2 0.4 Normal Approximaton to B(10,0.5) 0 2 4 6 x Page 4 8 10 0.15 0.00 y1 0.30 Normal Approximaton to B(20,0.1) 0 5 10 15 20 x 0.15 0.00 y2 0.30 Normal Approximaton to B(20,0.5) 0 5 10 15 20 x 0.10 0.00 y1 0.20 Normal Approximaton to B(30,0.1) 0 5 10 15 20 25 30 x 0.10 0.00 y2 0.20 Normal Approximaton to B(30,0.5) 0 5 10 15 20 25 30 x From the plots above, we can see that the normal approximation is better for p = 0.5 than for p = 0.1 when n is the same. If we want the approximation for p = 0.1 to be as good as the approximation for p = 0.5, we should use a larger n. Page 5 5. One-hour carbon monoxide concentrations in air samples from a large city have an approximately exponential distribution with mean 3.6 ppm (parts per million). (a) Find the probability that the carbon monozide concentration exceeds 9 ppm during a randomly selected one-hour period. Solution: Let’s use random variable X to stand for the one-hour carbon monoxide concentration in air samples from the city, then X ∼ Exponential(3.6). P (X > 9) = 0.082085 Rcode: > pexp(9, rate=1/3.6, lower.tail=F) [1] 0.082085 (b) A traffic-control strategy reduced the mean to 2.5 ppm. Now find the probability that the concetration exceeds 9 ppm. Solution: In this case, X ∼ Exponential(2.5). P (X > 9) = 0.02732372 > pexp(9, rate=1/2.5, lower.tail=F) [1] 0.02732372 6. The length of time Y necessary to complete a key operation in the construction of houses has a gamma distribution with α = 3 and β = 2. The formula C = 100 + 40Y + 3Y 2 relates the cost C of completing this operation to the square of the time to completion. Find the mean and variance of C. Solution: E Y k = Z +∞ 0 xα−1 −x/β βk x e dx = Γ(α)β α Γ(α) k Z 0 +∞ k+α−1 β k Γ(α + k) x e−x/β dx = β Γ(α) So we know that E(Y ) = αβ = 6 E(Y 2 ) = α(α + 1)β 2 = 48 E(Y 3 ) = α(α + 1)(α + 2)β 3 = 480 E(Y 4 ) = α(α + 1)(α + 2)(α + 3)β 4 = 5760 E(C) = E(100 + 40Y + 3Y 2 ) = 100 + 40E(Y ) + 3E(Y 2 ) = 484 Page 6 E(C 2 ) = E(10000 + 8000Y + 2200Y 2 + 240Y 3 + 9Y 4 ) = 10000 + 8000E(Y ) + 2200E(Y 2 ) + 240E(Y 3 ) + 9E(Y 4 ) = 330640 V ar(C) = E(C 2 ) − (E(C))2 = 330640 − 4842 = 96384 7. Show that the normal distribution has inflection points at µ−σ and µ+σ. (An inflection point is a point where the function goes from being concave to convex or vice versa. You can find it by setting the second derivative to 0.) Solution: (x−µ)2 (x−µ)2 1 e− 2σ2 = c1 e− 2σ2 2πσ (x−µ)2 (x−µ)2 −2(x − µ) − − ′ 2σ 2 = c (x − µ)e f (x) = c1 e 2σ2 2 2σ 2 (x−µ)2 (x−µ)2 (x−µ)2 (x − µ)2 −2(x − µ)2 − − − ′′ 2 2 2 2σ 2σ 2σ 1− +e = c2 e f (x) = c2 e 2σ 2 σ2 (x−µ)2 2 Since c2 6= 0 and e− 2σ2 6= 0, solve 1 − (x−µ) = 0 we have σ2 f (x) = √ x=µ±σ 8. Suppose a random variable has probability density function Cy 4 e−y/100 y > 0 f (y) = 0 otherwise (a) What must be the constant C? Solution: We can recognize a Gamma distribution, so C= 1 = 4.166667 × 10−12 5 Γ(5)100 Or, by brute force, Z +∞ Z +∞ Z +∞ y 4 −y/100 y 4 −y/100 10 e d 1 = f (y)dy = Cy e dy = 10 C 100 100 0 0 0 Z +∞ t4 e−t dt = 1010 C Γ(5) = 2.4 × 1011 C (1) = 1010 C 0 Page 7 So we have C= 1 = 4.1667 × 10−12 11 2.4 × 10 (b) Name the distribution of Y and give its parameters. Solution: The distribution of Y is Gamma distribution with parameters α = 5 and β = 100. 9. The percentage of impurities per batch in a chemical product is a random variable Y with density function 12y 2 (1 − y) 0 ≤ y ≤ 1 f (y) = 0 otherwise A batch with more than 40% impurities cannot be sold. (a) Integrate the density directly to determine the probability that a randomly selected batch cannot be sold because of excessive impurities. Solution: P (Y > 0.4) = Z +∞ 0.4 f (y)dy = Z 1 0.4 1 12y 2 (1 − y)dy = (4y 3 − 3y 4 )0.4 = 0.8208 (b) Use R to verify your calculations in part a. Solution: In fact the random variable Y has a beta distribution with parameters α = 3 and β = 2. So we can use the following R code to calculate the probability: > pbeta(0.4,3,2,lower.tail=F) [1] 0.8208 Page 8