Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

R Program Problem: please answer and explain question 5 (a-e) step by step in de

ID: 3221794 • Letter: R

Question

R Program Problem: please answer and explain question 5 (a-e) step by step in detail using the program R, I am not very sure how to use program R, so please explain in detail

5. This problem will ask you to use appropriate functions of R to answer probability questions similar to the ones we have be doing in class. (Hmmm...I wonder if these objects should be saved and named exactly as indicated?? (a) The amount of ketchup dispensed from a machine at a local convenience store is normally distributed with a mean of 1.10 ounces and a standard deviation of 0.085 ounce. Use the pnorm function to determine the probability that the machine dispenses more than 1 ounce for a giving serving? Assign that value to the object x5a (b) The scores on the SAT are normally distributed. The mean SAT score during a certain year was 995 th with a standard deviation of 175. Use the qnorm function to determine the cutoff score for the 88 percentile. Assign that value to the object x5b (c) Use the dbinom function to compute the probability of a (fair) coin landing heads ezactly 92 times in 153 flips of the coin. Assign that value to the object x5c (d) A student is taking a 30-question multiple-choice quiz, each with 5 answer choices (only one of which is correct). Use the pbinom function to determine the probability that the student answers no more than 9 questions correct if that student randomly guesses the answer to every question on the quiz. Assign that value to the object x5d (e) A six-sided die is biased so that the probability of rolling a 4 on the single roll of the die is only 10%. Use the following while loop to determine the minimum number to times the die would need to be rolled so that the probability of rolling a total of fifty or more 4's is at least 90%. Assign that minimum number of rolls to the object 'x5e'. (HINT: What variable is counting the number of rolls?) #We can start with n 50 rolls since we are looking for at least 50 successes. n-50 while (1-pbinom (49, n, .10) 90) tn n+1

Explanation / Answer

(a) The pnorm function in r is similar to CDF of normal distribution. So, P(X>1) = 1- P(X<=1) = 1 - pnorm(1,mean=1.1,sd=0.085). In r we write,

x5a = 1-pnorm(1,mean=1.1,sd=0.085) or x5a <- 1-pnorm(1,mean=1.1,sd=0.085)

(b)qnorm function is the inverse of pnorm,i,e, it gives the number corresponding to the cummulative distribution probaility (gives x in case of P(X<=x)=0.88). Thus, to find the cuttoff score for 88th percentile the r statement is:

x5b = qnorm(p=0.88,mean=995,sd=175) or x5b <- qnorm(p=0.88,mean=995,sd=175)

(c) If X follows binomial distribution and obtaining a head is marked as success, then X~B(n=153,p=0.5) and we need to calculate P(X=92), which is calulated by dbinom ir r as follows:

x5c = dbinom(92,153,0.5) or x5c <- dbinom(92,153,0.5)

(d)Here, X~B(n=30,p=1/5). We need to calculate P(X<=9), i.e. the cdf of binomial distribtuion. In r, we write

x5d = pbinom(9,30,0.2) or x5d <- pbinom(9,30,0.2)

(e)Loops in r are used when we need to repaeat a setof statements multiple times. Here, since we need to determine the minimum number of trials needed so that we get 50 or more 4's atleat 90% times. Hence, we use the above while loop.

Here, X~B(n,p=0.1) since we need to determine 'n' as mentioned above.

We start with n=50 since we need atleast 50 successes (getting a 4 on a biased die) and the probability to be calculated is

P(X>=50) = 1 - P(X<50) = 1 - P(X<=49) = 1- pnorm(49,n,0.1) in r, which in turn should be < 0.9 as we need to calucalte the minimum number of trial where the propability is 0.9.

Thus in r we write,

> x5e = 50
> while(1-pbinom(49,x5e,0.1)<0.9) {x5e=x5e+1}
> x5e