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

  Foster exam on writing sentences and paragraphs

I need to do Penn Foster exam on writing sentences and paragraphs could someone help?It is an assigment and they evaluete two paragraphs with sufficient details/support, unified, coherent development,clear topic sentence,sentence structure,grammar..

  Research responsibility of a critical thinker in a society

Research the responsibility of a critical thinker in a contemporary society. choose Obesity topic that deals with a contemporary social concern.

  Post your response under this thread for week 5 discussion

post your response under this thread for week 5 discussion questions by sat of course week.1. what is the importance of

  Explain your personal contribution to your community

Explain your personal contribution to your community. Describe what you did, why you wanted to do it, the problems you faced, how you overcame them.

  Hey there i have to answer this question in an essay should

hey there i have to answer this question in an essay. should students textbooks be replaced by notebook computers? i

  What community resources and programs will you draw on

What community resources and programs will you draw on for this offender? Is his home plan appropriate to ensure a successful re-entry? Identify any changes that you would require before approving it.

  Hopkins and jocelyn potteras our final 1984 nbspgeorge

hopkins and jocelyn potteras our final 1984 nbspgeorge orwell assignment we are doing a literary analysis of the story.

  Important or meaningful to the religion

Sermon on the Mount - selection from the Gospel of Matthew is a guide for what it is to be a Christian. Discuss two points of the text that you consider to be the most important or meaningful to the religion

  This is a grammar question regarding the verb conserve

this is a grammar question regarding the verb conserve. websters dictionary says it is a transitive verb and i have

  What is the expected total cost of the units produced

Variable cost per unit is budgeted to be $4.00 and fixed cost per unit is budgeted to be $3.00 in a period when $4,000 units are produced. If production is actually 6,500 units.

  Surf beach state college

Surf Beach State College (SBSC) has a business school with three products, undergraduate degrees, graduate degrees, and executive education. SBSC has three service departments.

  Discuss how no homeland security, emergency management

Prepare a paper to document your analysis has it assess the future challenges and opportunities for emergency management. Use Technology and threats that we will change over time

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