31
Nov 2008 Stats bayésiennes - Ph. Aegerter 1 Statistiques Bayésiennes Intérêt croissant : – Aide décision : contexte = diagnostic – puis RC : contexte = estimation, test, modèles Publications récentes – Ashby D. Bayesian statistics in medicine: a 25 year review.Stat Med. 2006 Nov 15;25(21):3589-631. Review. – Meyer N, Vinzio S, Goichot B. La statistique bayésienne : une approche des statistiques adaptée à la clinique. Rev Med Interne. 2008 août. – a primer on Bayesian Statistics in Health Economics and Outcomes Research. O’Hagan A, Luce BR. http://www.shef.ac.uk/content/1/c6/02/55/92/primer. pdf

Nov 2008Stats bayésiennes - Ph. Aegerter 1 Statistiques Bayésiennes Intérêt croissant : –Aide décision : contexte = diagnostic –puis RC : contexte = estimation,

Embed Size (px)

Citation preview

Page 1: Nov 2008Stats bayésiennes - Ph. Aegerter 1 Statistiques Bayésiennes Intérêt croissant : –Aide décision : contexte = diagnostic –puis RC : contexte = estimation,

Nov 2008 Stats bayésiennes - Ph. Aegerter 1

Statistiques Bayésiennes Intérêt croissant :

– Aide décision : contexte = diagnostic– puis RC : contexte = estimation, test, modèles

Publications récentes– Ashby D. Bayesian statistics in medicine: a 25 year

review.Stat Med. 2006 Nov 15;25(21):3589-631. Review.

– Meyer N, Vinzio S, Goichot B. La statistique bayésienne : une approche des statistiques adaptée à la clinique. Rev Med Interne. 2008 août.

– a primer on Bayesian Statistics in Health Economics and Outcomes Research. O’Hagan A, Luce BR. http://www.shef.ac.uk/content/1/c6/02/55/92/primer.pdf

Page 2: Nov 2008Stats bayésiennes - Ph. Aegerter 1 Statistiques Bayésiennes Intérêt croissant : –Aide décision : contexte = diagnostic –puis RC : contexte = estimation,

Nov 2008 Stats bayésiennes - Ph. Aegerter 2

Théorème de Bayes Théorème de l’inversion des probabilités

p(A/B) = p(AetB) / p(B)p(B/A) = p(AetB) / p(A)-> p(B/A) = p(A/B) . p(B) / p(A)

p(A) = p(A/B).p(B) + p(A/B-).p(B-)

Page 3: Nov 2008Stats bayésiennes - Ph. Aegerter 1 Statistiques Bayésiennes Intérêt croissant : –Aide décision : contexte = diagnostic –puis RC : contexte = estimation,

Nov 2008 Stats bayésiennes - Ph. Aegerter 3

Diag : Matrice de décision Cas idéal Cas réel

M+ M-S+ VP FPS- FN VN

n

M+ M-S+ nm 0S- 0 nn

n

Page 4: Nov 2008Stats bayésiennes - Ph. Aegerter 1 Statistiques Bayésiennes Intérêt croissant : –Aide décision : contexte = diagnostic –puis RC : contexte = estimation,

Nov 2008 Stats bayésiennes - Ph. Aegerter 4

Sensibilité Sensibilité = VP / (VP + FN) = VP / M+

= aptitude à détecter tous les cas M+ estime p(S+/M+) limite: Se = 1 signe constant

fièvre dans typhoïde

Page 5: Nov 2008Stats bayésiennes - Ph. Aegerter 1 Statistiques Bayésiennes Intérêt croissant : –Aide décision : contexte = diagnostic –puis RC : contexte = estimation,

Nov 2008 Stats bayésiennes - Ph. Aegerter 5

Spécificité Spécificité = VN / (VN + FP) = VN /

=aptitude à ne détecter que les cas de M+ estime p(S-/M-) limite : Sp = 1 signe pathognomonique

Köplick dans rougeole

Page 6: Nov 2008Stats bayésiennes - Ph. Aegerter 1 Statistiques Bayésiennes Intérêt croissant : –Aide décision : contexte = diagnostic –puis RC : contexte = estimation,

Nov 2008 Stats bayésiennes - Ph. Aegerter 6

Exemple de calcul de Se et Sp Maladie hépatique et scanner

Se = VP/M+ = 231 /258 = 0,90 Sp = VN/M- = 54/86 = 0,63 RV+ = Se/(1-Sp) = 0,9/0,37 = 2,4

M+ M-S+ 231 32S- 27 54

258 86 344

Page 7: Nov 2008Stats bayésiennes - Ph. Aegerter 1 Statistiques Bayésiennes Intérêt croissant : –Aide décision : contexte = diagnostic –puis RC : contexte = estimation,

Nov 2008 Stats bayésiennes - Ph. Aegerter 7

Fiabilité : valeurs prédictives Post test, quel est le risque de maladie ?

VP Positive = VP/(VP+FP) estime p(M+/S+) Prev = proba(M) a priori, VPP = a posteriori VP Négative = VN/(VN+FN) RR = VPP/(1-VPN)

M+ M-

S+ VP FP

S- FN VN

n

Page 8: Nov 2008Stats bayésiennes - Ph. Aegerter 1 Statistiques Bayésiennes Intérêt croissant : –Aide décision : contexte = diagnostic –puis RC : contexte = estimation,

Nov 2008 Stats bayésiennes - Ph. Aegerter 8

Exemple de valeurs prédictives Maladie hépatique et scanner

VPP = VP/S+ = 231/263 = 0,875 VPN = VN/S- = 54/81 = 0,67 RR = VPP/(1-VPN) = 0,875/0,33 = 2,65 Dépend de proportion M+

M+ M-S+ 231 32 263S- 27 54 81

Page 9: Nov 2008Stats bayésiennes - Ph. Aegerter 1 Statistiques Bayésiennes Intérêt croissant : –Aide décision : contexte = diagnostic –puis RC : contexte = estimation,

Nov 2008 Stats bayésiennes - Ph. Aegerter 9

Se, Sp, prévalence et valeurs prédictives

VPP = p(M+/S+) = p(S+/M+).p(M+)/p(S+) = Se.P / (Se.P + (1-Sp).(1-P))

quand Sp augmente, VPP augmentequand P augmente, VPP augmente

VPN = p(M-/S-) = p(S-/M-).p(M-)/p(S-) = Sp.(1-P) / (Sp.(1-P)+(1-Se).P)

quand Se augmente, VPN augmentequand P augmente, VPN diminue peu

Page 10: Nov 2008Stats bayésiennes - Ph. Aegerter 1 Statistiques Bayésiennes Intérêt croissant : –Aide décision : contexte = diagnostic –puis RC : contexte = estimation,

Nov 2008 Stats bayésiennes - Ph. Aegerter 10

Effet de la prévalence soit Se = 0,99 Sp = 0,99

P(M) (%) VPP (%) VPN (%)0,01 0,5 99,990,1 4,7 99,991 33,3 99,982 50 99,985 72 99,9510 84 99,8920 92 99,75

Page 11: Nov 2008Stats bayésiennes - Ph. Aegerter 1 Statistiques Bayésiennes Intérêt croissant : –Aide décision : contexte = diagnostic –puis RC : contexte = estimation,

Nov 2008 Stats bayésiennes - Ph. Aegerter 11

Théorème de Bayes

Page 12: Nov 2008Stats bayésiennes - Ph. Aegerter 1 Statistiques Bayésiennes Intérêt croissant : –Aide décision : contexte = diagnostic –puis RC : contexte = estimation,

Nov 2008 Stats bayésiennes - Ph. Aegerter 12

Statistique Bayesienne Généralisation du théorème

p(H/r) = p(r/H) . p(H) / p(r)– H : hypothèse ; r = résultat = données observées

Approche fréquentiste : test hypothèse– H

0 => r & p(r/H

0) < rejet H

0 (r/a p)

– Ne renseigne pas sur probabilité H0 et paramètre

– Complément par Int confiance

– Inférence classique basée sur P(R|)

avec fixe et inconnue

– Approche bayésienne : est une v.a.

Page 13: Nov 2008Stats bayésiennes - Ph. Aegerter 1 Statistiques Bayésiennes Intérêt croissant : –Aide décision : contexte = diagnostic –puis RC : contexte = estimation,

Nov 2008 Stats bayésiennes - Ph. Aegerter 13

Statistique Bayesienne Généralisation du théorème

p(H/r) = p(r/H) . p(H) / p(r)– H : hypothèse ; r = résultat = données observées

Connaissance a priori (prior) : p(H) Vraisemblance des observations : p(r/H) Connaissance a posteriori (posterior) : p(H/r) Posterior = vraisemblance * prior / p(r) Utilisation ddp a posteriori :

– Chercher un maximum de cette probabilité

– Chercher la valeur moyenne de la distribution

– Déterminer un intervalle de crédibilité

Page 14: Nov 2008Stats bayésiennes - Ph. Aegerter 1 Statistiques Bayésiennes Intérêt croissant : –Aide décision : contexte = diagnostic –puis RC : contexte = estimation,

Nov 2008 Stats bayésiennes - Ph. Aegerter 14

Statistique Bayesienne

Vraisemblance= p(r/H) soit : p(r=1 / H=2) = 5/10 = 0,5 ... p(r=1 / H=1) ....p(r=1 / H=0)

Prior = p(H) =soit : p(H=2) ... p(H=1) ... p(H=0) P Conjointe = p(r & H) = p(r/ H) * p(H) = Vraisemblance * Prior P prédictive marginale = Somme(P conjointe) = p(r=1) Post = P(H/r) = P Conj / P prédictive

soit : p(H=2 / r=1) = 0,05/0,35 ... p(H=1 / r=1) ... p(H=0 / r=1)

Obs\Hypo H=2 H=1 H=0

r=1 5 10 20 30

r=0 5 25 40 70

10 40 50 100

Vrais = p(r=1/H) 0,5 0,25 0,4 0,3

Prior = p(H) 0,1 0,4 0,5 1

P Conj 0,05 0,1 0,2 0,35

Post 0,14 0,29 0,57 1

Page 15: Nov 2008Stats bayésiennes - Ph. Aegerter 1 Statistiques Bayésiennes Intérêt croissant : –Aide décision : contexte = diagnostic –puis RC : contexte = estimation,

Nov 2008 Stats bayésiennes - Ph. Aegerter 15

Estimation d'une proportion Tirage avec remise : on a observé 4 succès / 10 expériences

Vraisemblance = p(r/H) soit : p(f=4/10 / 0%) = 0 ... p(f=4/10 / 10%) = binom(4,10,0.1) ...

Prior = p(H) =soit : p(0%) ... p(10%) ... P conjointe = p(r/ H) * p(H) soit : p(4/10 & 0%) = p(4/10 / 0%) * p(0%) P prédictive marginale = Somme(p conjointe) = p(4/10) Post = P(H/r) = P conj / P prédictive soit : ... p(10% / 4/10) = 0,0123 ...

0% 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%

4/10

! 4/10

Vrais 0 0,0112 0,0881 0,2001 0,2508 0,2051 0,1115 0,0368 0,0055 0,0001 0 0,91

Prior 1/11 1/11 1/11 1/11 1/11 1/11 1/11 1/11 1/11 1/11 1/11 1

P Conj 0 0,0010 0,0080 0,0182 0,0228 0,0186 0,0101 0,0033 0,0005 0,0000 0 0,08

Post 0 0,0123 0,0969 0,2201 0,2758 0,2256 0,1226 0,0405 0,0060 0,0001 0 1

Page 16: Nov 2008Stats bayésiennes - Ph. Aegerter 1 Statistiques Bayésiennes Intérêt croissant : –Aide décision : contexte = diagnostic –puis RC : contexte = estimation,

Nov 2008 Stats bayésiennes - Ph. Aegerter 16

Estimation d'une proportion Tirage avec remise : on a observé 4 succès / 10 expériences

Estimation modale : 40% Estimation moyenne : 41,6% Intervalle de crédibilité à 95% : 20-70% H par % ou 0,1%

4/10

! 4/10

Vrais 0 0,0112 0,0881 0,2001 0,2508 0,2051 0,1115 0,0368 0,0055 0,0001 0 0,91

Prior 1/11 1/11 1/11 1/11 1/11 1/11 1/11 1/11 1/11 1/11 1/11 1

P Conj 0 0,0010 0,0080 0,0182 0,0228 0,0186 0,0101 0,0033 0,0005 0,0000 0 0,08

Post 0 0,0123 0,0969 0,2201 0,2758 0,2256 0,1226 0,0405 0,0060 0,0001 0 1

H*Post 0 0 0,12 1,94 6,6 11,03 11,28 7,36 2,84 0,48 0,01 41,66

Page 17: Nov 2008Stats bayésiennes - Ph. Aegerter 1 Statistiques Bayésiennes Intérêt croissant : –Aide décision : contexte = diagnostic –puis RC : contexte = estimation,

Nov 2008 Stats bayésiennes - Ph. Aegerter 17

Choix loi a priori Permet d'intégrer connaissances antérieures

Subjectives ou objectives

Ex : delta entre 10 et 15 et pas au-delà

Permet de représenter incertitude Non informative

Permet de modéliser scepticisme Équivalent hypothèse nulle

Page 18: Nov 2008Stats bayésiennes - Ph. Aegerter 1 Statistiques Bayésiennes Intérêt croissant : –Aide décision : contexte = diagnostic –puis RC : contexte = estimation,

Nov 2008 Stats bayésiennes - Ph. Aegerter 18

ddp Triplot

Page 19: Nov 2008Stats bayésiennes - Ph. Aegerter 1 Statistiques Bayésiennes Intérêt croissant : –Aide décision : contexte = diagnostic –puis RC : contexte = estimation,

Nov 2008 Stats bayésiennes - Ph. Aegerter 19

Estimation d'une différence

Page 20: Nov 2008Stats bayésiennes - Ph. Aegerter 1 Statistiques Bayésiennes Intérêt croissant : –Aide décision : contexte = diagnostic –puis RC : contexte = estimation,

Nov 2008 Stats bayésiennes - Ph. Aegerter 20

Estimation d'une moyenne

Page 21: Nov 2008Stats bayésiennes - Ph. Aegerter 1 Statistiques Bayésiennes Intérêt croissant : –Aide décision : contexte = diagnostic –puis RC : contexte = estimation,

Nov 2008 Stats bayésiennes - Ph. Aegerter 21

Exemple: inférence sur la moyenne d’une population gaussienne

I. Soit un échantillon gaussien– Modèle génératif:

II. Les paramètres inconnus sont

• On veut tester l’assertion: « > 0 »

I. Remarque: il s’agit du modèle RFX classique

),(

),...,,( 21 nyyyY )I,(N),( n

2 YP

Page 22: Nov 2008Stats bayésiennes - Ph. Aegerter 1 Statistiques Bayésiennes Intérêt croissant : –Aide décision : contexte = diagnostic –puis RC : contexte = estimation,

Nov 2008 Stats bayésiennes - Ph. Aegerter 22

Inférence classique

I. On forme le rapport de vraisemblances:

• C’est (une fonction croissante de) la statistique de Student

• Si 0, la probabilité que T dépasse un certain seuil est plus petite que si

• P(T|) est une loi de Student à n-1 degrés de liberté – On en déduit le seuil correspondant à un risque fixé

nT

ˆ

),(max

),(max

,0

,

YP

YPT

Page 23: Nov 2008Stats bayésiennes - Ph. Aegerter 1 Statistiques Bayésiennes Intérêt croissant : –Aide décision : contexte = diagnostic –puis RC : contexte = estimation,

Nov 2008 Stats bayésiennes - Ph. Aegerter 23

Inférence bayésiennePremière question: quelle loi a priori ?

– Choix standard (a priori non informatif):– Implique en particulier que l’a priori sur est uniforme

• Avec cet a priori, la loi a posteriori est donnée par:

1

ˆˆ nt

nY

1),( p

Variable de Student à n-1 degrés de libertés

0

P(|Y)

n/

Page 24: Nov 2008Stats bayésiennes - Ph. Aegerter 1 Statistiques Bayésiennes Intérêt croissant : –Aide décision : contexte = diagnostic –puis RC : contexte = estimation,

Nov 2008 Stats bayésiennes - Ph. Aegerter 24

Inférence bayésienneI. On en déduit:

• Autrement dit, la probabilité a posteriori que la moyenne soit positive est: 1 - {P-value du test t classique} !!!

I. Dans ce cas, les inférences classiques et bayésiennes sont rigoureusement équivalentes

• Ce n’est plus vrai si on prend un autre a priori

)/ˆ

ˆ()0( 1

ntPYP n

Page 25: Nov 2008Stats bayésiennes - Ph. Aegerter 1 Statistiques Bayésiennes Intérêt croissant : –Aide décision : contexte = diagnostic –puis RC : contexte = estimation,

Nov 2008 Stats bayésiennes - Ph. Aegerter 25

Choix d’un a priori informatifA priori gaussien centré sur la moyenne:

– s2 est la variance a priori de la moyenne– Si s2 est très grande, l’a priori devient non informatif

• La probabilité a posteriori de dépend de s– Phénomène de shrinkage

1),0;(),( sNp

0

P(|Y)

s fini

s infini

Page 26: Nov 2008Stats bayésiennes - Ph. Aegerter 1 Statistiques Bayésiennes Intérêt croissant : –Aide décision : contexte = diagnostic –puis RC : contexte = estimation,

Nov 2008 Stats bayésiennes - Ph. Aegerter 26

Essai Eurofoetus METHODS

A post-hoc analysis of the Eurofetus trial was conducted using a Bayesian methodology to investigate the credibility of this trial under different hypotheses. The purpose of such an analysis is to put the results of the trial in perspective, based upon available knowledge from published data and archetypal prior scepticism regarding the true benefit of laser surgery compared to amnioreduction in severe TTTS. As opposed to the traditional frequentist approach, the Bayesian approach allows to incorporate prior information as a probability distribution into the raw data available from the trial (the likelihood) and to derive a posterior distribution of the effect of treatment. This posterior distribution determines a credibility interval for the measure of association between the outcome and the treatment option. Bayesian terminology refers to credibility intervals rather than confidence intervals but their interpretation is quite similar in practice.

We used the odds-ratio (OR) as the measure of association for treatment effect and considered the asymptotical Gaussian approximation of the log-odds for the analysis. Under Gaussian priors, the posterior distribution of the log-odds was derived from the conjugate-normal distribution and presented as 95% credibility intervals.

Several priors were considered:

1. An archetypal sceptical prior regarding the treatment effect that was translated as a normal distribution of the log-odds with a mean m=0 and a standard deviation sd=0.35. This is equivalent to an OR=1 with CI95%=[0.5 - 2]. This sceptical prior neglects any published data.

2. A critically sceptical prior which is the prior distribution of mean m=0 (no difference between treatments) but with a variance sufficiently small to make the posterior 95% credibility interval reach the zero-effect (OR=1) line, thus making the posterior result of the trial inconclusive. This is equivalent to finding an archetypal person sufficiently convinced of the absence of treatment effect that his opinion remains unchanged even after the data from the trial was made public.

3. A historical prior incorporating the published data so far. This prior was based upon the two retrospective studies available at the time of the trial comparing serial amniodrainage and percutaneous laser surgery15,16. A pooled OR was derived from the published data from these two studies with a fixed effects meta-analysis and using the Mantel-Haenszel method (Table 1). Of notice, no trials or other form of study have been published since the Eurofetus trial, except for the NIH-funded trial but which we excluded because of major differences in the treatment protocol and because of the lack of statistically sound data.

Page 27: Nov 2008Stats bayésiennes - Ph. Aegerter 1 Statistiques Bayésiennes Intérêt croissant : –Aide décision : contexte = diagnostic –puis RC : contexte = estimation,

Nov 2008 Stats bayésiennes - Ph. Aegerter 27

Essai Eurofoetus 4. Finally, the archetypal sceptic prior and the historical prior were sequentially combined, meaning that the posterior

distribution of the sceptical prior combined with the historical data is used, in turn, as the prior distribution for the trial6,17,18. This analysis is provided along with a sensitivity analysis in which the importance of the historical data is weighed from 0

5 (the historical data is irrelevant, equivalent to prior 1) to 1 (the historical data has the same weight as the trial) using the ‘power prior’ defined by Ibrahim and Chen19. This allows presenting the credibility of the trial for an archetypal sceptical with increasing confidence in the pre-trial published data. Hence, by giving a weight of zero to the historical data, we return to situation 1 which ignored this data.

10 Three outcomes have been chosen for the analysis. Perinatal survival of at least one twin is the only one clearly reported in all studies and used as a main outcome in the Eurofetus trial. The Eurofetus trial also presented survival of at least one twin at 6 months, although this outcome was not available from the 2 historical studies. Thus, the analysis of the 6-months survival used priors 1 and 2. Similarly, the data presenting the neurological morbidity in the 2 historical studies

15 was not made use of, because of differences in the measured outcomes and because we did not have access to the individual data from these studies. Nonetheless, the Bayesian analysis of this outcome from the Eurofetus trial was conducted using priors 1 and 2. The trial odds-ratio was computed using a GEE binomial model to adjust for the correlation between twins and using the robust variance of the estimate. Access to the individual data from the trial made this analysis possible.

Page 28: Nov 2008Stats bayésiennes - Ph. Aegerter 1 Statistiques Bayésiennes Intérêt croissant : –Aide décision : contexte = diagnostic –puis RC : contexte = estimation,

Nov 2008 Stats bayésiennes - Ph. Aegerter 28

Essai Eurofoetus

Page 29: Nov 2008Stats bayésiennes - Ph. Aegerter 1 Statistiques Bayésiennes Intérêt croissant : –Aide décision : contexte = diagnostic –puis RC : contexte = estimation,

Nov 2008 Stats bayésiennes - Ph. Aegerter 29

Essai Eurofoetus

Page 30: Nov 2008Stats bayésiennes - Ph. Aegerter 1 Statistiques Bayésiennes Intérêt croissant : –Aide décision : contexte = diagnostic –puis RC : contexte = estimation,

Nov 2008 Stats bayésiennes - Ph. Aegerter 30

Essai Eurofoetus

Page 31: Nov 2008Stats bayésiennes - Ph. Aegerter 1 Statistiques Bayésiennes Intérêt croissant : –Aide décision : contexte = diagnostic –puis RC : contexte = estimation,

Nov 2008 Stats bayésiennes - Ph. Aegerter 31

Logiciels Fist Bayes

www.firstbayes.co.uk

LePAC http://www.univ-rouen.fr/LMRS/Persopage/Lecoutre/PAC.htm

Bayesien et fréquentiste

WinBUGS Modélisation Bayesienne et MCMC MRC Biostatistics Unit, University of Cambridge, UK

http://www.mrc-bsu.cam.ac.uk/bugs/winbugs/contents.shtml

basé sur BUGS (Bayesian inference Using Gibbs Sampling) Windows (Wine / Linux)

OpenBugs et interface R Brugs