Feat: Cours sur les tests bayésiens
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Bertrand Benjamin 2021-03-16 10:45:35 +01:00
parent cec47c0073
commit 71b42ec995
5 changed files with 384 additions and 2 deletions

View File

@ -0,0 +1,73 @@
\documentclass[a4paper,10pt]{article}
\usepackage{myXsim}
\author{Benjamin Bertrand}
\title{Probabilités conditionnelles - Cours}
\date{Mars 2021}
\pagestyle{empty}
\begin{document}
\maketitle
\setcounter{section}{1}
\section{Tests Bayésiens}
Un test bayésien permet d'affiner la vraisemblablité d'hypothèses. La vraisemblablité sont modélisées par des probabilités.
On part d'un \textbf{a priori} (notre évaluation de la vraisemblablité des hypothèses avant le test). Puis nous faisons le test ce qui permet d'ajuster la vraisemblablité des hypothèses. Nous obtenons un \textbf{a posteriori}.
\begin{center}
\includegraphics[scale=1]{./fig/test_baysien}
\end{center}
\subsection*{Test médical}
Étudions l'intérêt d'un test médical. Pour faire simple, on considèrera que l'on est soit \textbf{malade} soit pas malade et que le test donne deux résultats possibles \textbf{positif} ou négatif. On notera alors
\[
A = \left\{ \mbox{Malade} \right\} \qquad \qquad B = \left\{ \mbox{Test positif} \right\}
\]
\paragraph{Paramètres du test:}
\begin{itemize}
\item \textbf{Sensibilité}: la probabilité que le test soit positif sachant que l'on est malade
\[
P_A(B) = 0.9
\]
\item \textbf{Spécificité}: la probabilité que le test soit négatif sachant que l'on est pas malade
\[
P_{\overline{A}}(\overline{B}) = 0.99
\]
\end{itemize}
\paragraph{A priori:} on estime que 1\% de la population est malade. On appelle cela la \textbf{la prévalence} d'un maladie. On peut noter
\[
P(A) = 1\% = 0.01
\]
J'ai donc une chance sur 100 d'avoir cette maladie.
\paragraph{Mise en situation:} On fait un test qui est positif. Comment réévaluer la probabilité d'être malade? C'est à dire connaître
\[
P_B(A) = ?
\]
Imaginons une population de 1000 individus. En respectant les proportions, on peut construire le tableau des effectifs:
\begin{center}
\begin{tabular}{|*{4}{p{3cm}|}}
\hline
& Test positif ($B$) & Test négatif ($\overline{B}$) & Total \\
\hline
Malade ($A$) & & & \\
\hline
Pas malade ($\overline{A}$) & & & \\
\hline
Total & & & 1000 \\
\hline
\end{tabular}
\end{center}
\afaire{Compléter le tableau et calculer la probabilité cherchée}
\end{document}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

@ -0,0 +1,305 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="210mm"
height="297mm"
viewBox="0 0 210 297"
version="1.1"
id="svg8"
inkscape:version="1.0.2 (e86c870879, 2021-01-15)"
sodipodi:docname="test_baysien.svg">
<defs
id="defs2">
<marker
style="overflow:visible;"
id="Arrow1Lend"
refX="0.0"
refY="0.0"
orient="auto"
inkscape:stockid="Arrow1Lend"
inkscape:isstock="true">
<path
transform="scale(0.8) rotate(180) translate(12.5,0)"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1;fill:#000000;fill-opacity:1"
d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
id="path979" />
</marker>
<rect
x="39.900009"
y="49.821077"
width="27.87704"
height="24.134419"
id="rect923" />
<marker
style="overflow:visible"
id="Arrow1Lend-6"
refX="0"
refY="0"
orient="auto"
inkscape:stockid="Arrow1Lend"
inkscape:isstock="true">
<path
transform="matrix(-0.8,0,0,-0.8,-10,0)"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1"
d="M 0,0 5,-5 -12.5,0 5,5 Z"
id="path979-2" />
</marker>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1.4"
inkscape:cx="153.1464"
inkscape:cy="278.23514"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
inkscape:document-rotation="0"
showgrid="false"
inkscape:object-paths="true"
inkscape:snap-intersection-paths="true"
inkscape:snap-bbox="true"
inkscape:window-width="1340"
inkscape:window-height="1076"
inkscape:window-x="1080"
inkscape:window-y="376"
inkscape:window-maximized="0" />
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Calque 1"
inkscape:groupmode="layer"
id="layer1">
<g
id="g1419"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96">
<g
id="g883">
<g
id="g879">
<rect
style="fill:#000000;fill-opacity:0.234171;stroke:#000000;stroke-width:0.417872;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect833"
width="8.3132381"
height="34.067429"
x="22.23222"
y="43.372341" />
</g>
</g>
<rect
style="fill:#000000;fill-opacity:0.234171;stroke:#000000;stroke-width:0.417872;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect837"
width="8.3132372"
height="12.185174"
x="22.23222"
y="65.254593" />
<text
xml:space="preserve"
style="font-size:4.23333px;line-height:1.25;font-family:sans-serif;text-align:center;letter-spacing:0px;text-anchor:middle;stroke-width:0.264583"
x="26.389872"
y="55.583401"
id="text841"><tspan
sodipodi:role="line"
id="tspan839"
x="26.389872"
y="55.583401"
style="stroke-width:0.264583">A</tspan></text>
<g
id="g872"
transform="translate(0.3939051)">
<text
xml:space="preserve"
style="font-size:4.23333px;line-height:1.25;font-family:sans-serif;text-align:center;letter-spacing:0px;text-anchor:middle;stroke-width:0.264583"
x="26.006714"
y="73.993782"
id="text841-3"><tspan
sodipodi:role="line"
id="tspan839-6"
x="26.006714"
y="73.993782"
style="stroke-width:0.264583">A</tspan></text>
<path
style="fill:none;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 24.570321,70.208155 h 2.758438"
id="path867" />
</g>
<text
xml:space="preserve"
style="font-size:4.23333px;line-height:1.25;font-family:sans-serif;text-align:center;letter-spacing:0px;text-anchor:middle;stroke-width:0.264583"
x="26.57074"
y="82.621117"
id="text876"><tspan
sodipodi:role="line"
id="tspan874"
x="26.57074"
y="82.621117"
style="stroke-width:0.264583">A priori</tspan></text>
<g
id="g895"
transform="translate(56.576346)">
<g
id="g893">
<rect
style="fill:#000000;fill-opacity:0.234171;stroke:#000000;stroke-width:0.417872;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect891"
width="8.3132381"
height="34.067429"
x="22.23222"
y="43.372341" />
</g>
</g>
<rect
style="fill:#000000;fill-opacity:0.234171;stroke:#000000;stroke-width:0.417872;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect897"
width="8.3132401"
height="22.903248"
x="78.808563"
y="54.536518" />
<text
xml:space="preserve"
style="font-size:4.23333px;line-height:1.25;font-family:sans-serif;text-align:center;letter-spacing:0px;text-anchor:middle;stroke-width:0.264583"
x="82.966217"
y="50.354069"
id="text901"><tspan
sodipodi:role="line"
id="tspan899"
x="82.966217"
y="50.354069"
style="stroke-width:0.264583">A</tspan></text>
<g
id="g919"
transform="translate(0,-4.4344654)">
<g
id="g909"
transform="translate(56.970251)">
<text
xml:space="preserve"
style="font-size:4.23333px;line-height:1.25;font-family:sans-serif;text-align:center;letter-spacing:0px;text-anchor:middle;stroke-width:0.264583"
x="26.006714"
y="73.993782"
id="text905"><tspan
sodipodi:role="line"
id="tspan903"
x="26.006714"
y="73.993782"
style="stroke-width:0.264583">A</tspan></text>
<path
style="fill:none;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 24.570321,70.208155 h 2.758438"
id="path907" />
</g>
</g>
<text
xml:space="preserve"
style="font-size:4.23333px;line-height:1.25;font-family:sans-serif;text-align:center;letter-spacing:0px;text-anchor:middle;stroke-width:0.264583"
x="83.147087"
y="82.621117"
id="text913"><tspan
sodipodi:role="line"
id="tspan911"
x="83.147087"
y="82.621117"
style="stroke-width:0.264583">A posteriori</tspan></text>
<g
id="g972"
transform="translate(1.2071857)">
<g
id="g889"
transform="translate(13.502299)">
<g
id="g887">
<rect
style="fill:#000000;fill-opacity:0.234171;stroke:#000000;stroke-width:0.417872;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect885"
width="35.470623"
height="34.067432"
x="22.23222"
y="43.372341" />
</g>
</g>
<text
xml:space="preserve"
id="text921"
style="font-size:4.23333px;line-height:1.25;font-family:sans-serif;text-align:center;letter-spacing:0px;white-space:pre;shape-inside:url(#rect923)"
transform="translate(-0.3969422,5.2971823)"><tspan
x="49.67065"
y="53.565817"><tspan>Test
</tspan></tspan><tspan
x="45.502432"
y="58.857481"><tspan>Baysien</tspan></tspan></text>
</g>
<text
xml:space="preserve"
style="font-size:2.82222px;line-height:1.25;font-family:sans-serif;text-align:center;letter-spacing:0px;text-anchor:middle;stroke-width:0.264583"
x="19.368959"
y="77.328163"
id="text929"><tspan
sodipodi:role="line"
id="tspan927"
x="19.368959"
y="77.328163"
style="font-size:2.82222px;stroke-width:0.264583">0%</tspan></text>
<text
xml:space="preserve"
style="font-size:2.82222px;line-height:1.25;font-family:sans-serif;text-align:center;letter-spacing:0px;text-anchor:middle;stroke-width:0.264583"
x="17.573378"
y="45.393833"
id="text933"><tspan
sodipodi:role="line"
id="tspan931"
x="17.573378"
y="45.393833"
style="font-size:2.82222px;stroke-width:0.264583">100%</tspan></text>
<text
xml:space="preserve"
style="font-size:2.82222px;line-height:1.25;font-family:sans-serif;text-align:center;letter-spacing:0px;text-anchor:middle;stroke-width:0.264583"
x="89.76564"
y="77.328163"
id="text929-7"><tspan
sodipodi:role="line"
id="tspan927-5"
x="89.76564"
y="77.328163"
style="font-size:2.82222px;stroke-width:0.264583">0%</tspan></text>
<text
xml:space="preserve"
style="font-size:2.82222px;line-height:1.25;font-family:sans-serif;text-align:center;letter-spacing:0px;text-anchor:middle;stroke-width:0.264583"
x="91.437202"
y="45.393833"
id="text933-3"><tspan
sodipodi:role="line"
id="tspan931-5"
x="91.437202"
y="45.393833"
style="font-size:2.82222px;stroke-width:0.264583">100%</tspan></text>
<path
style="fill:none;stroke:#000000;stroke-width:0.265;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#Arrow1Lend)"
d="m 30.545458,60.406057 h 6.396246"
id="path974" />
<path
style="fill:none;stroke:#000000;stroke-width:0.265;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#Arrow1Lend-6)"
d="m 72.412327,60.11168 h 6.396246"
id="path974-9" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -2,7 +2,7 @@ Inférence Bayésienne
#################### ####################
:date: 2021-03-15 :date: 2021-03-15
:modified: 2021-03-15 :modified: 2021-03-16
:authors: Benjamin Bertrand :authors: Benjamin Bertrand
:tags: Probabilité, Bayes :tags: Probabilité, Bayes
:category: Complementaire :category: Complementaire
@ -36,7 +36,11 @@ En groupe, justification des valeurs avancées dans le document. Explications po
Conclusion sur l'utilité d'un test comme outils pour affiner un a priori. Conclusion sur l'utilité d'un test comme outils pour affiner un a priori.
Bilan: Reprise d'un exemple traité et vocabulaire associé aux tests Bilan: Reprise d'un exemple traité et vocabulaire associé aux tests. On reprendra le schéma des tests pour représenter la mise à jour de la vraisemblance.
.. image:: ./2B_vocabulaire.pdf
:height: 200px
:alt: Vocabulaire autour des tests
Étape 3: Application aux tests ADN Étape 3: Application aux tests ADN
================================== ==================================