Need R code for b Thanks !
In this first question, we explore the utility of Bayes' theorem by examining the effectiveness of a recent egg recall. Over a 3-month period in 2010, 550 million eggs were recalled due to possible salmonella contamination out of a total 17.5 billion eggs produced in the US during that period. A risk assessment performed by the USDA several years back found that the baseline probability of salmonella contamination in eggs is about 1/100,000. Let's take this to be the probability of salmonella contamination given that an egg was not recalled. Finally, it's difficult to find definitive numbers, but let's assume that the probability that an egg was contaminated with salmonella given that it was recalled was 1/1000 1.
a. An important question is whether the recall was effective at addressing the problem of contamination. What is the probability that an egg was recalled given that it was contaminated with salmonella? Use Bayes' theorem to calculate this value with the help of your favorite calculator Does it appear that the recall was effective? Write a few sentences interpreting the probability value that you calculated
b. Use R to simulate the answer to this question. That is, first generate an event B (an egg is recalled), for which the unconditional probability of "success" matches above. Then, generate an event A (an egg is contaminated), for which the probability of "success" varies depending on whether B was successful or not. Finally, select only trials where A is successful and compute how frequently B is successful. Run this simulation for 10,000,000 eggs and report the result. Does your simulated answer match the result of (a)? If the numbers do not match precisely, briefly describe why they differ. (NB: You may find a different approach that works, but I have found that this i easiest to accomplish with two separate for loops- one to generate the events, and one to pick out the ones that match your criteria. Also, it will likely take some time for your program to run with 10,000,000 eggs. You'll probably want to start with a smaller number [like 100,000] until you get your function up and running.
Need R code for b Thanks ! In this first question, we explore the utility of...
6. [R Programming| In order to complete this question, we will need to use a fundamen- tal theorem in probabilty theory known as the (Weak) Law of Large Numbers (WLLN) The WLLN will be covered in greater detail in Chapter 8, however we will use this key result throughout the course to approximate probabilities that are otherwise difficult to calculate theoretically. A simplified version of the theorem goes as follows. Assume we are interested in com- puting the probability of...
10. Write a one-page summary of the attached paper? INTRODUCTION Many problems can develop in activated sludge operation that adversely affect effluent quality with origins in the engineering, hydraulic and microbiological components of the process. The real "heart" of the activated sludge system is the development and maintenance of a mixed microbial culture (activated sludge) that treats wastewater and which can be managed. One definition of a wastewater treatment plant operator is a "bug farmer", one who controls the aeration...