Need to write r code and proof

Assignment Help Humanities
Reference no: EM131058149

Problem 4: Antimicrobial resistance (AMR) is becoming a significant problem due to overuse of antimicrobial drugs. The level of AMR can be estimated by testing isolates obtained from samples (say from retail chicken). Suppose that Y isolates test positive for AMR in N samples. A Bayesian model for the population prevalence of resistance, P, is Y |P ∼ B(N, P), combined with a uniform prior distribution on P. This implies a beta posterior distribution for P. (See the notes from Lecture 14.) Suppose, however, that the test has known sensitivity and specificity values,

πse = P(positive test result|resistant)

and

πsp = P(negative test result|not resistant).

A perfect test would have πse = πsp = 1 but this is rarely the case in practice. Let TP denote a "true positive" test result event; that is, a resistant isolate that tests positive. Let NT P denote the number of TP events in the sample.

Let FP denote a "false positive" test result, a non-resistant isolate that tests positive, and let NF P denote the number of such events. Similarly, let TN and FN denote "true negative" and "false negative" test results, and let NT N and NF N denote the number of times these events occur in the sample. Note that Y = NT P + NF P and N - Y = NT N + NF N .

4a: (2 points) Determine the conditional probabilities of the events TP, FP, TN an FN given P.

4b: (4 points) What is the distribution of NT P given P and Y ? What is the distribution of NT N given P and Y ? Hence, what is the distribution of (NT P , NT N ) given P and Y ?

4c: (4 points) What is the distribution of P given (NT P , NT N ) and Y ? Note that NT P +NF N is the true number of resistance isolates in the sample.

4d:  Based on your answers to problems to 4a-c write an R function to generate values from the posterior distribution of P given Y using a Gibbs sampler.

Mygibbs=function(N,Y,sens,spec,L)
{
6

# L=chain length

your code
return(Pchain)
}

Submit your function on CMS as Mygibbs.r.

4e: Use your function to estimate the posterior distribution of P based on Y = 30 positive test results out of N = 100 if πse = 0.9 and πsp = 0.8. Report estimates of the mean, median, and 2.5 and 97.5 percentiles of the posterior distribution.

Reference no: EM131058149

Questions Cloud

Design a database for an airline : Your design should include an E-R diagram, a set of relational schemas, and a list of constraints, including primary-key and foreign-key constraints.
How does seniority play a role in how overtime is scheduled : If an overtime list is created, how should it be managed since there are certain workers qualified for some tasks but not others? Should there be several task specific lists created, or an overall shop list? If a listed is created for overtime, ma..
Mean length of jail time : Suppose that it is somehow known that the population standard deviation is 1.5. If you were conducting a hypothesis test to determine if the mean length of jail time has increased, what would the null and alternative hypotheses be? The distributio..
Find all instructors earning the highest salary : Find the IDs of all students who were taught by an instructor named Einstein; make sure there are no duplicates in the result.
Need to write r code and proof : Problem 4: Antimicrobial resistance (AMR) is becoming a significant problem due to overuse of antimicrobial drugs. The level of AMR can be estimated by testing isolates obtained from samples (say from retail chicken). Suppose that Y isolates test ..
Probability of observing a sample mean : Find the probability of observing a sample mean of 0.985 liters or less in a sample of 70 bottles, if the beverage dispensing unit functions properly.
Total current liabilities for the same period : Total current assets for a firm at the end of 2014 were $2,550,100. Total current liabilities for the same period were $1,980,312. Net working capital at the end of 2014 was:
Which of the constraints can the system check automatically : Which of these constraints can the system check automatically? Explain your answer.
What was total real return on investment : You bought one of Great White Shark Repellant Co.’s 11 percent coupon bonds one year ago for $810. These bonds make annual payments and mature 7 years from now. Suppose you decide to sell your bonds today, when the required return on the bonds is 13 ..

Reviews

Write a Review

Humanities Questions & Answers

  Primary elements of the jewish and christian traditions

What primary elements of the Jewish and Christian traditions unite the Hebrew and Christian Canons or Old and New Testaments?

  Write an essay about why junk food is bad

Write an essay about why junk food is bad.

  How should rich and poor act towards one another

How should rich and poor act towards one another? What "objections" are raised? How are they "answered"? "Love is a ligament." Explain.

  Why does the socialization process have different degrees

Why does the socialization process have different degrees of effect on different people?

  Prepare a paper to document your analysis has it assess the

prepare a paper to document your analysis has it assess the future challenges and opportunities for emergency

  Ernest hemingway short story

Start a discussion with an observation, comment, or question that relates to point of view, themes, of Ernest Hemingway short story.

  How does giuseppe verdi show his characters

In Rigoletto, how does Giuseppe Verdi show his characters' contrasting emotions?

  Evaluate targeted audience

Identify the Website and its URL. Evaluate each Website regarding the targeted audience and updating of information

  What do you think is society good or bad for the individual

What do you think? Is society good or bad for the individual? Are the duties and conventions of Confucianism a help or hindrance to people? Why?

  One or more scholarly sociological journals

Literature review (3 pages)Find three articles on the same topic in one or more scholarly sociological journals. The articles should use at least two different methods in answering the same broad substantive question.

  What have been the most significant economic changes to your

What have been the most significant economic changes to your life (under the broadest conception of economics) that have been due to technology? Explain.

  Describe a family member by addressing nutritional habits

Describe a family member or a friend by addressing the following bullets in your response (in essay form): Nutritional habits, Relationship and family history of disease/lifestyle choices and Height and Weight.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd