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

  Plan to improve correctional facilities

Women imprisonment should be facilitate with certain correctional facilities. In this paper, we have discussed about the plan for improving correctional facilities for the women prisoner in America.

  Situation analysis of food security in new zealand

This paper aims to present, discuss and analyse factors that are causing low food security, the management, current and proposed solutions in New Zealand (NZ).

  Social services on human traffic

The research study is limited to the understanding of  how social service agencies could approach or respond to the needs of the victim/ survivor of sex trafficking.

  Social deviance: the issue of risky sexual behaviour

The issue of deviant behaviour has been discussed by various sociologists from a number of perspectives.

  Race and racism

This paper is a brief description of the study, discrimination pertains to the prejudice perception and treatment of a person or demographical issues belonging to a category.

  Depth of challenges people face

Your own knowledge about the Depth of Challenges People face

  Project plan written report

Sufficient information to enable the organisation's Board of Executives to understand the rationale for the program and the activities required to design, implement and evaluate the program including any additional data that would need to be colle..

  Evaluation structure logical and achievable.

Health care organisational processes management, service administration, service provision and delivery

  Write an essay on locke''s theory of meaning

Write an essay on Locke's theory of meaning

  Leadership reflections paper

Write a paper on Leadership Reflections Paper Summarizes and reflects upon leadership ideas gleaned from the four required readings

  What role has feminism played

what role has feminism played in our appreciation of their work today.

  What subject matter choices were available to women artists

Prior to the beginning of the twentieth century, what subject matter choices were available to women artists? What cultural and historical influences placed limitations on their choices?

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