SlideShare ist ein Scribd-Unternehmen logo
1 von 59
Conditional Probability And the odds ratio and risk ratio as conditional probability
Today’s lecture ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Probability example ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Note: mutually exclusive, exhaustive probabilities sum to 1.
U sing a probability tree Rule of thumb: in probability, “and” means multiply, “or” means add  Mendel example:  What’s the chance of having a heterozygote child (Dd) if both parents are heterozygote (Dd)? P( ♀ D=.5) P( ♀ d=.5) Mother’s allele P( ♂ D=.5) P( ♂ d=.5) P( ♂ D=.5) P( ♂ d=.5) Father’s allele ______________ 1.0 P(DD)=.5*.5=.25 P(Dd)=.5*.5=.25 P(dD)=.5*.5=.25 P(dd)=.5*.5=.25 Child’s outcome
Independence ,[object Object],[object Object],[object Object],What father’s gamete looks like is not dependent on the mother’s –doesn’t depend which branch you start on!  Formally, P(DD)=.25=P(D♂)*P(D♀) Conditional Probability:  Read as “the probability that the father passes a D allele  given that  the mother passes a d allele.” Joint Probability:   The probability of two events happening simultaneously. Marginal probability:   This is the probability that an event happens at all, ignoring all other outcomes.
On the tree P( ♂ D/  ♀ D )=.5 P( ♂ d=.5) P( ♂ D=.5) P( ♂ d=.5) Father’s allele P( ♀ D=.5) P( ♀ d=.5) Mother’s allele ______________ 1.0 P(DD)=.5*.5=.25 P(Dd)=.5*.5=.25 P(dD)=.5*.5=.25 P(dd)=.5*.5=.25 Child’s outcome Conditional probability Marginal probability: mother Joint probability Marginal probability: father
Conditional, marginal, joint ,[object Object],[object Object],[object Object],[object Object],[object Object]
Test of independence ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Independent    mutually exclusive ,[object Object],[object Object],[object Object],[object Object]
Practice problem ,[object Object]
Answer ______________ 1.0 P (+, test +)=.0297 P(+, test -)=.003 P(-, test +)=.00097 P(-, test -) = .96903  P(test +)=.0297+.00097=.03067 P(+&test+)  P(+)*P(test+) .0297   .03*.03067 (=.00092)    Dependent! Marginal probability of carrying the virus. Joint probability of being + and testing + Marginal probability of testing positive Conditional probability: the probability of testing + given that a person is + P(+)=.03 P(-)=.97 P(test +)=.99 P(test - )= .01 P(test +) = .001 P(test -) = .999
Law of total probability One of these has to be true (mutually exclusive, collectively exhaustive).  They sum to 1.0.
Law of total probability ,[object Object],[object Object],B 2 B 3 B 1 A
Example 2 ,[object Object]
Example: Mammography P(BC/test+)=.0027/(.0027+.10967)=2.4% ______________ 1.0 P(test +)=.90 P(BC+)=.003 P(BC-)=.997 P(test -) = .10 P(test +) = .11 P (+, test +)=.0027 P(+, test -)=.0003 P(-, test +)=.10967 P(-, test -) = .88733 P(test -) = .89 Marginal probabilities of breast cancer….(prevalence among all 54-year olds) sensitivity specificity
Bayes’ rule
Bayes’ Rule: derivation ,[object Object],[object Object],The idea: if we are given that the event B occurred, the relevant sample space is reduced to B {P(B)=1 because we know B is true} and conditional probability becomes a probability measure on B.
Bayes’ Rule: derivation ,[object Object],and, since also:
Bayes’ Rule: OR From the “Law of Total Probability”
Bayes’ Rule: ,[object Object],[object Object],[object Object]
In-Class Exercise ,[object Object]
Answer: using probability tree A positive test places one on either of the two “test +” branches.  But only the top branch also fulfills the event “true infection.”  Therefore, the probability of being infected is the probability of being on the top branch given that you are on one of the two circled branches above.           ______________ 1.0 P(test +)=.99 P(+)=.03 P(-)=.97 P(test - = .01) P(test +) = .001 P (+, test +)=.0297 P(+, test -)=.003 P(-, test +)=.00097 P(-, test -) = .96903 P(test -) = .999
Answer: using Bayes’ rule          
Practice problem ,[object Object],[object Object],[object Object]
Answer to (a) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Answer to (b) ,[object Object],[object Object],[object Object],[object Object],[object Object],P(high risk/accident)=.08/.16=50% P(accident/LR)=.1 ______________ 1.0 P( no acc/HR)=.6 P(accident/HR)=.4 P(high risk)=.20 P(accident, high risk)=.08 P(no accident, high risk)=.12) P(accident, low risk)=.08 P(low risk)=.80 P( no accident/LR)=.9 P(no accident, low risk)=.72
Fun example/bad investment ,[object Object]
Conditional Probability for Epidemiology: The odds ratio and risk ratio as conditional probability
The Risk Ratio and the Odds Ratio as conditional probability ,[object Object],[object Object]
Odds and Risk (probability) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Odds vs. Risk=probability Note:  An odds is always higher than its corresponding probability, unless the probability is 100%. 1:1 3:1 1:9 1:99 1/100 (1%) 1/10 (10%) ¾ (75%) ½ (50%) Then the odds are… If the risk is…
Cohort Studies (risk ratio) Target population Disease Disease-free Disease Disease-free TIME Exposed Not Exposed Disease-free cohort
The Risk Ratio   Exposure (E) No Exposure (~E)   Disease (D) a b No Disease (~D) c d   a+c b+d risk to the exposed risk to the unexposed
Hypothetical Data 400 400 1100 2600   Normal BP Congestive Heart Failure No CHF 1500 3000 High Systolic BP
Case-Control Studies (odds ratio) ,[object Object],[object Object],Target population Exposed in past Not exposed Exposed Not Exposed No Disease (Controls)
Case-control study example: ,[object Object]
Hypothetical results:   Smoker (E) Non-smoker (~E)   Stroke (D) 15 35 No Stroke (~D) 8 42   50 50
What’s the risk ratio here? Tricky: There is no risk ratio, because we cannot calculate the risk of disease!! 50 50   Smoker (E) Non-smoker (~E)   Stroke (D) 15 35 No Stroke (~D) 8 42  
The odds ratio… ,[object Object],[object Object]
The Odds Ratio (OR) Luckily, you can flip the conditional probabilities using Bayes’ Rule: 50 50 These data give: P(E/D) and P(E/~D).   Smoker (E) Smoker (~E)   Stroke (D) 15 35 No Stroke (~D) 8 42   Unfortunately, our sampling scheme precludes calculation of the marginals: P(E) and P(D), but turns out we don’t need these if we use an odds ratio because the marginals cancel out!
The Odds Ratio (OR)   Exposure (E) No Exposure (~E)   Disease (D) a  b No Disease (~D) c d   Odds of exposure in the cases Odds of exposure in the controls
The Odds Ratio (OR) But, this expression is mathematically equivalent to: Backward from what we want… The direction of interest! Odds of disease in the exposed Odds of disease in the unexposed Odds of exposure in the cases Odds of exposure in the controls
= Proof via Bayes’ Rule Odds of exposure in the controls Odds of exposure in the cases Bayes’ Rule Odds of disease in the unexposed Odds of disease in the exposed What we want!
The odds ratio here: ,[object Object],  Smoker (E) Non-smoker (~E)   Stroke (D) 15 35 No Stroke (~D) 8 42   50 50
Interpretation of the odds ratio: ,[object Object],[object Object]
The rare disease assumption 1 1 When a disease is rare:  P(~D) = 1 - P(D)    1
The odds ratio vs. the risk ratio 1.0 (null) Rare Outcome Common Outcome 1.0 (null) Odds  ratio Risk ratio Risk ratio Odds  ratio Odds  ratio Risk ratio Risk ratio Odds  ratio
Odds ratios in cross-sectional and cohort studies… ,[object Object],[object Object],[object Object],[object Object],[object Object]
Example, wrinkle study… ,[object Object],[object Object],[object Object],[object Object],Raduan et al.  J Eur Acad Dermatol Venereol . 2008 Jul 3.
Interpreting ORs when the outcome is common… ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Interpreting ORs when the outcome is common… Formula from: Zhang J. What's the Relative Risk? A Method of Correcting the Odds Ratio in Cohort Studies of Common Outcomes  JAMA.  1998;280:1690-1691.  Where: OR = odds ratio from logistic regression (e.g., 3.92) P 0  = P(D/~E) = probability/prevalence of the outcome in the unexposed/reference group (e.g. ~45%) If data are from a cross-sectional or cohort study, then you can convert ORs (from logistic regression) back to RRs with a simple formula:
For wrinkle study… Zhang J. What's the Relative Risk? A Method of Correcting the Odds Ratio in Cohort Studies of Common Outcomes  JAMA.  1998;280:1690-1691.  So, the risk (prevalence) of wrinkles is increased by 69%, not 292%.
Sleep and hypertension study… ,[object Object],[object Object],[object Object],[object Object],[object Object],-Sainani KL, Schmajuk G, Liu V. A Caution on Interpreting Odds Ratios.  SLEEP, Vol. 32, No. 8, 2009  . -Vgontzas AN, Liao D, Bixler EO, Chrousos GP, Vela-Bueno A. Insomnia with objective short sleep duration is associated with a high risk for hypertension. Sleep 2009;32:491-7.
Practice problem: ,[object Object],[object Object],69 22 Don’t own a cell phone 209 143 Own a cell phone No Neck Pain Neck pain
Answer ,[object Object],[object Object],69 22 Don’t own a cell phone 209 143 Own a cell phone No Neck Pain Neck pain
Practice problem: ,[object Object],Calculate the odds ratio and risk ratio for the association between cell phone usage and brain tumor (rare outcome). 88 3 Don’t own a cell phone 347 5 Own a cell phone No brain tumor Brain tumor
Answer ,[object Object],[object Object],88 3 Don’t own a cell phone 347 5 Own a cell phone No brain tumor Brain tumor
Thought problem…  ,[object Object]
Some Monty Hall links… ,[object Object],[object Object],[object Object]

Weitere ähnliche Inhalte

Ähnlich wie Lecture3

Probability basics and bayes' theorem
Probability basics and bayes' theoremProbability basics and bayes' theorem
Probability basics and bayes' theoremBalaji P
 
1615 probability-notation for joint probabilities
1615 probability-notation for joint probabilities1615 probability-notation for joint probabilities
1615 probability-notation for joint probabilitiesDr Fereidoun Dejahang
 
Complements and Conditional Probability, and Bayes' Theorem
 Complements and Conditional Probability, and Bayes' Theorem Complements and Conditional Probability, and Bayes' Theorem
Complements and Conditional Probability, and Bayes' TheoremLong Beach City College
 
probability_statistics_presentation.pptx
probability_statistics_presentation.pptxprobability_statistics_presentation.pptx
probability_statistics_presentation.pptxvietnam5hayday
 
basic probability Lecture 9.pptx
basic probability Lecture 9.pptxbasic probability Lecture 9.pptx
basic probability Lecture 9.pptxSabirinINahassan
 
Chapter 05
Chapter 05Chapter 05
Chapter 05bmcfad01
 
Health probabilities & estimation of parameters
Health probabilities & estimation of parameters Health probabilities & estimation of parameters
Health probabilities & estimation of parameters KwambokaLeonidah
 
Introduction to probability.pdf
Introduction to probability.pdfIntroduction to probability.pdf
Introduction to probability.pdfYonasTsagaye
 
2.statistical DEcision makig.pptx
2.statistical DEcision makig.pptx2.statistical DEcision makig.pptx
2.statistical DEcision makig.pptxImpanaR2
 
Probability concepts for Data Analytics
Probability concepts for Data AnalyticsProbability concepts for Data Analytics
Probability concepts for Data AnalyticsSSaudia
 
1 Probability Please read sections 3.1 – 3.3 in your .docx
 1 Probability   Please read sections 3.1 – 3.3 in your .docx 1 Probability   Please read sections 3.1 – 3.3 in your .docx
1 Probability Please read sections 3.1 – 3.3 in your .docxaryan532920
 
2014 lab slides_mo_a
2014 lab slides_mo_a2014 lab slides_mo_a
2014 lab slides_mo_aA M
 
Bayes Classification
Bayes ClassificationBayes Classification
Bayes Classificationsathish sak
 

Ähnlich wie Lecture3 (20)

Probability basics and bayes' theorem
Probability basics and bayes' theoremProbability basics and bayes' theorem
Probability basics and bayes' theorem
 
1615 probability-notation for joint probabilities
1615 probability-notation for joint probabilities1615 probability-notation for joint probabilities
1615 probability-notation for joint probabilities
 
34301
3430134301
34301
 
Complements and Conditional Probability, and Bayes' Theorem
 Complements and Conditional Probability, and Bayes' Theorem Complements and Conditional Probability, and Bayes' Theorem
Complements and Conditional Probability, and Bayes' Theorem
 
probability_statistics_presentation.pptx
probability_statistics_presentation.pptxprobability_statistics_presentation.pptx
probability_statistics_presentation.pptx
 
basic probability Lecture 9.pptx
basic probability Lecture 9.pptxbasic probability Lecture 9.pptx
basic probability Lecture 9.pptx
 
Chapter 05
Chapter 05Chapter 05
Chapter 05
 
Laws of probability
Laws of probabilityLaws of probability
Laws of probability
 
Probability concept and Probability distribution
Probability concept and Probability distributionProbability concept and Probability distribution
Probability concept and Probability distribution
 
03 Probability.pdf
03 Probability.pdf03 Probability.pdf
03 Probability.pdf
 
Probability.pptx
Probability.pptxProbability.pptx
Probability.pptx
 
Health probabilities & estimation of parameters
Health probabilities & estimation of parameters Health probabilities & estimation of parameters
Health probabilities & estimation of parameters
 
Basic concepts of probability
Basic concepts of probabilityBasic concepts of probability
Basic concepts of probability
 
Introduction to probability.pdf
Introduction to probability.pdfIntroduction to probability.pdf
Introduction to probability.pdf
 
Probability Concepts
Probability ConceptsProbability Concepts
Probability Concepts
 
2.statistical DEcision makig.pptx
2.statistical DEcision makig.pptx2.statistical DEcision makig.pptx
2.statistical DEcision makig.pptx
 
Probability concepts for Data Analytics
Probability concepts for Data AnalyticsProbability concepts for Data Analytics
Probability concepts for Data Analytics
 
1 Probability Please read sections 3.1 – 3.3 in your .docx
 1 Probability   Please read sections 3.1 – 3.3 in your .docx 1 Probability   Please read sections 3.1 – 3.3 in your .docx
1 Probability Please read sections 3.1 – 3.3 in your .docx
 
2014 lab slides_mo_a
2014 lab slides_mo_a2014 lab slides_mo_a
2014 lab slides_mo_a
 
Bayes Classification
Bayes ClassificationBayes Classification
Bayes Classification
 

Kürzlich hochgeladen

Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 

Kürzlich hochgeladen (20)

Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 

Lecture3

  • 1. Conditional Probability And the odds ratio and risk ratio as conditional probability
  • 2.
  • 3.
  • 4. U sing a probability tree Rule of thumb: in probability, “and” means multiply, “or” means add Mendel example: What’s the chance of having a heterozygote child (Dd) if both parents are heterozygote (Dd)? P( ♀ D=.5) P( ♀ d=.5) Mother’s allele P( ♂ D=.5) P( ♂ d=.5) P( ♂ D=.5) P( ♂ d=.5) Father’s allele ______________ 1.0 P(DD)=.5*.5=.25 P(Dd)=.5*.5=.25 P(dD)=.5*.5=.25 P(dd)=.5*.5=.25 Child’s outcome
  • 5.
  • 6. On the tree P( ♂ D/ ♀ D )=.5 P( ♂ d=.5) P( ♂ D=.5) P( ♂ d=.5) Father’s allele P( ♀ D=.5) P( ♀ d=.5) Mother’s allele ______________ 1.0 P(DD)=.5*.5=.25 P(Dd)=.5*.5=.25 P(dD)=.5*.5=.25 P(dd)=.5*.5=.25 Child’s outcome Conditional probability Marginal probability: mother Joint probability Marginal probability: father
  • 7.
  • 8.
  • 9.
  • 10.
  • 11. Answer ______________ 1.0 P (+, test +)=.0297 P(+, test -)=.003 P(-, test +)=.00097 P(-, test -) = .96903  P(test +)=.0297+.00097=.03067 P(+&test+)  P(+)*P(test+) .0297  .03*.03067 (=.00092)  Dependent! Marginal probability of carrying the virus. Joint probability of being + and testing + Marginal probability of testing positive Conditional probability: the probability of testing + given that a person is + P(+)=.03 P(-)=.97 P(test +)=.99 P(test - )= .01 P(test +) = .001 P(test -) = .999
  • 12. Law of total probability One of these has to be true (mutually exclusive, collectively exhaustive). They sum to 1.0.
  • 13.
  • 14.
  • 15. Example: Mammography P(BC/test+)=.0027/(.0027+.10967)=2.4% ______________ 1.0 P(test +)=.90 P(BC+)=.003 P(BC-)=.997 P(test -) = .10 P(test +) = .11 P (+, test +)=.0027 P(+, test -)=.0003 P(-, test +)=.10967 P(-, test -) = .88733 P(test -) = .89 Marginal probabilities of breast cancer….(prevalence among all 54-year olds) sensitivity specificity
  • 17.
  • 18.
  • 19. Bayes’ Rule: OR From the “Law of Total Probability”
  • 20.
  • 21.
  • 22. Answer: using probability tree A positive test places one on either of the two “test +” branches. But only the top branch also fulfills the event “true infection.” Therefore, the probability of being infected is the probability of being on the top branch given that you are on one of the two circled branches above.           ______________ 1.0 P(test +)=.99 P(+)=.03 P(-)=.97 P(test - = .01) P(test +) = .001 P (+, test +)=.0297 P(+, test -)=.003 P(-, test +)=.00097 P(-, test -) = .96903 P(test -) = .999
  • 23. Answer: using Bayes’ rule          
  • 24.
  • 25.
  • 26.
  • 27.
  • 28. Conditional Probability for Epidemiology: The odds ratio and risk ratio as conditional probability
  • 29.
  • 30.
  • 31. Odds vs. Risk=probability Note: An odds is always higher than its corresponding probability, unless the probability is 100%. 1:1 3:1 1:9 1:99 1/100 (1%) 1/10 (10%) ¾ (75%) ½ (50%) Then the odds are… If the risk is…
  • 32. Cohort Studies (risk ratio) Target population Disease Disease-free Disease Disease-free TIME Exposed Not Exposed Disease-free cohort
  • 33. The Risk Ratio   Exposure (E) No Exposure (~E)   Disease (D) a b No Disease (~D) c d   a+c b+d risk to the exposed risk to the unexposed
  • 34. Hypothetical Data 400 400 1100 2600   Normal BP Congestive Heart Failure No CHF 1500 3000 High Systolic BP
  • 35.
  • 36.
  • 37. Hypothetical results:   Smoker (E) Non-smoker (~E)   Stroke (D) 15 35 No Stroke (~D) 8 42   50 50
  • 38. What’s the risk ratio here? Tricky: There is no risk ratio, because we cannot calculate the risk of disease!! 50 50   Smoker (E) Non-smoker (~E)   Stroke (D) 15 35 No Stroke (~D) 8 42  
  • 39.
  • 40. The Odds Ratio (OR) Luckily, you can flip the conditional probabilities using Bayes’ Rule: 50 50 These data give: P(E/D) and P(E/~D).   Smoker (E) Smoker (~E)   Stroke (D) 15 35 No Stroke (~D) 8 42   Unfortunately, our sampling scheme precludes calculation of the marginals: P(E) and P(D), but turns out we don’t need these if we use an odds ratio because the marginals cancel out!
  • 41. The Odds Ratio (OR)   Exposure (E) No Exposure (~E)   Disease (D) a b No Disease (~D) c d   Odds of exposure in the cases Odds of exposure in the controls
  • 42. The Odds Ratio (OR) But, this expression is mathematically equivalent to: Backward from what we want… The direction of interest! Odds of disease in the exposed Odds of disease in the unexposed Odds of exposure in the cases Odds of exposure in the controls
  • 43. = Proof via Bayes’ Rule Odds of exposure in the controls Odds of exposure in the cases Bayes’ Rule Odds of disease in the unexposed Odds of disease in the exposed What we want!
  • 44.
  • 45.
  • 46. The rare disease assumption 1 1 When a disease is rare: P(~D) = 1 - P(D)  1
  • 47. The odds ratio vs. the risk ratio 1.0 (null) Rare Outcome Common Outcome 1.0 (null) Odds ratio Risk ratio Risk ratio Odds ratio Odds ratio Risk ratio Risk ratio Odds ratio
  • 48.
  • 49.
  • 50.
  • 51. Interpreting ORs when the outcome is common… Formula from: Zhang J. What's the Relative Risk? A Method of Correcting the Odds Ratio in Cohort Studies of Common Outcomes JAMA.  1998;280:1690-1691. Where: OR = odds ratio from logistic regression (e.g., 3.92) P 0 = P(D/~E) = probability/prevalence of the outcome in the unexposed/reference group (e.g. ~45%) If data are from a cross-sectional or cohort study, then you can convert ORs (from logistic regression) back to RRs with a simple formula:
  • 52. For wrinkle study… Zhang J. What's the Relative Risk? A Method of Correcting the Odds Ratio in Cohort Studies of Common Outcomes JAMA.  1998;280:1690-1691. So, the risk (prevalence) of wrinkles is increased by 69%, not 292%.
  • 53.
  • 54.
  • 55.
  • 56.
  • 57.
  • 58.
  • 59.