Download presentation
Presentation is loading. Please wait.
Published byCody Hudson Modified over 9 years ago
1
December 2010T. A. Louis: Basic Bayes 1 Basic Bayes
2
December 2010T. A. Louis: Basic Bayes 2
3
December 2010T. A. Louis: Basic Bayes 3
4
December 2010T. A. Louis: Basic Bayes 4
5
December 2010T. A. Louis: Basic Bayes 5
6
December 2010T. A. Louis: Basic Bayes 6
7
December 2010T. A. Louis: Basic Bayes 7
8
December 2010T. A. Louis: Basic Bayes 8
9
December 2010T. A. Louis: Basic Bayes 9
10
December 2010T. A. Louis: Basic Bayes 10 To find a method for: “… the probability that an event has to happen, in given circumstances…” Bayes Rule: Pr( |Y) Pr(Y| ) Pr( ) Reverend Thomas Bayes © http://www-history.mcs.st-andrews.ac.uk/PictDisplay/Bayes.html Reverent Thomas Bayes
11
December 2010T. A. Louis: Basic Bayes 11
12
December 2010T. A. Louis: Basic Bayes 12
13
December 2010T. A. Louis: Basic Bayes 13
14
December 2010T. A. Louis: Basic Bayes 14
15
December 2010T. A. Louis: Basic Bayes 15 Example: N=50
16
December 2010T. A. Louis: Basic Bayes 16 Example: N=100 (50 more)
17
December 2010T. A. Louis: Basic Bayes 17 Example: N=150 (50 more)
18
December 2010T. A. Louis: Basic Bayes 18
19
December 2010T. A. Louis: Basic Bayes 19
20
December 2010T. A. Louis: Basic Bayes 20
21
December 2010T. A. Louis: Basic Bayes 21 CABAG DEATH RATE
22
December 2010T. A. Louis: Basic Bayes 22 TOXOPLASMOSIS RATES (centered)
23
December 2010T. A. Louis: Basic Bayes 23
24
December 2010T. A. Louis: Basic Bayes 24
25
December 2010T. A. Louis: Basic Bayes 25 V(b)
26
December 2010T. A. Louis: Basic Bayes 26
27
December 2010T. A. Louis: Basic Bayes 27 regression line Pop line 45 o line
28
December 2010T. A. Louis: Basic Bayes 28
29
December 2010T. A. Louis: Basic Bayes 29
30
December 2010T. A. Louis: Basic Bayes 30
31
December 2010T. A. Louis: Basic Bayes 31
32
December 2010T. A. Louis: Basic Bayes 32
33
December 2010T. A. Louis: Basic Bayes 33 Improving regression estimates Improving regression estimates Similar to the BUGS rat data Dependent variable (Y ij ) is weight for rat “i” at age X ij i = 1,..., I (=10); j = 1,..., J (=5) X ij = X j = (-14, -7, 0, 7, 14) = (8-22, 15-22, 22-22, 29-22 36-22) Y ij = b i0 + b i1 X j + ij –As usual, the intercept depends on the centering Analyses –Each rat has its own line –All rats follow the same line: b i0 = 0, b i1 = 1 –A compromise between these two
34
December 2010T. A. Louis: Basic Bayes 34 Each rat has its own (LSE, MLE) line Each rat has its own (LSE, MLE) line (with the population line) Pop line
35
December 2010T. A. Louis: Basic Bayes 35 A multi-level model: A multi-level model: Each rat has its own line, but the lines come from the same distribution The b i0 are independent Normal( 0, 0 2 ) The b i1 are independent N( 1, 1 2 ) Overdispersion Sample variance of the OLS estimated intercepts: 345 = SE int 2 + 0 2 = 320 + 0 2 0 2 = 25, 0 = 5 Sample variance of the OLS estimated slopes 4.25 = SE slope 2 + 1 2 = 3.25 + 1 2 1 2 = 1.00, 1 = 1.00
36
December 2010T. A. Louis: Basic Bayes 36 A compromise: each rat has its own line, but the lines come from the same distribution Pop line
37
December 2010T. A. Louis: Basic Bayes 37 Observed & Predicted Deviations of Annual Charges (in dollars) for Specialist Services vs. Primary Care Services Deviation, Specialists’ Charges Square (blue) = Posterior Mean of Predicted Deviation Dot (red) = Posterior Mean of Observed Deviation
38
December 2010T. A. Louis: Basic Bayes 38 Observed and Predicted Deviations for Specialist Services: Log(Charges>$0) and Probability of Any Use of Service Mean Deviation of Log(Charges >$0) Dot (red) = Posterior Mean of Observed Deviation Square (blue) = Posterior Mean of Predicted Deviation
39
December 2010T. A. Louis: Basic Bayes 39
40
December 2010T. A. Louis: Basic Bayes 40
41
December 2010T. A. Louis: Basic Bayes 41
42
December 2010T. A. Louis: Basic Bayes 42
43
December 2010T. A. Louis: Basic Bayes 43 BACK TO HISTORICAL CONTROLS
44
December 2010T. A. Louis: Basic Bayes 44
45
December 2010T. A. Louis: Basic Bayes 45
46
December 2010T. A. Louis: Basic Bayes 46
47
December 2010T. A. Louis: Basic Bayes 47
48
December 2010T. A. Louis: Basic Bayes 48
49
December 2010T. A. Louis: Basic Bayes 49
50
December 2010T. A. Louis: Basic Bayes 50 Bayes for Frequentist Goals
51
December 2010T. A. Louis: Basic Bayes 51
52
December 2010T. A. Louis: Basic Bayes 52Summary
53
December 2010T. A. Louis: Basic Bayes 53 SURGICAL SURGICAL Hospital # of ops# of deaths A [1] 47 0 B148 18 C119 8 D810 46 E211 8 F196 13 G148 9 H215 31 I207 14 J 97 8 K256 29 L360 24
54
December 2010T. A. Louis: Basic Bayes 54 model { for( i in 1 : N ) { p[i] ~ dbeta(1.0, 1.0) #need to specify the prior r[i] ~ dbin(p[i], n[i]) } righttail<-step(p[1]-3/n[1]) } # Also run with p[i] ~ dbeta(0.25,0.25) “Surgical” Beta-Binomial Model (no combining; stand alone)
55
December 2010T. A. Louis: Basic Bayes 55 Beta mean sd2.5% median 97.5% (1,1) 0.020 0.019 0.0003 0.0006 0.014 (.25,.25) 0.005 0.010 0.0002 0.0010 0.034 MLE 0 0.078 “Surgical” Results for p[1] (no combining; stand alone) Beta(1,1) Beta(.25,.25)
56
December 2010T. A. Louis: Basic Bayes 56 model {for( i in 1 : N ) { b[i] ~ dnorm(mu,tau) # tau = 1/var r[i] ~ dbin(p[i],n[i]) logit(p[i]) <- b[i] } popmn <- exp(mu) / (1 + exp(mu)) mu ~ dnorm(0.0,1.0E-6) sigma <- 1 / sqrt(tau) tau ~ dgamma(alphatau, betatau) mutau<-1 alphatau<-.001 betatau<-alphatau/mutau } “Surgical” Beta-binomial model (combine evidence; “estimate” the prior)
57
December 2010T. A. Louis: Basic Bayes 57 node mean sd2.5% median 97.5% popmn 0.073 0.010 0.053 0.073 0.095 p[1] 0.053 0.020 0.018 0.052 0.094 “Surgical” Results (combine evidence)
58
December 2010T. A. Louis: Basic Bayes 58 Beta mean sd2.5% median 97.5% Comb 0.053 0.020 0.0180 0.0520 0.094 (1,1) 0.020 0.019 0.0003 0.0006 0.014 (.25,.25) 0.005 0.010 0.0002 0.0010 0.034 MLE 0 0.078 “Surgical” Results for p[1] (stand alone & combine) 1,1.25,.25 Comb
59
December 2010T. A. Louis: Basic Bayes 59Summary Carefully specified and applied, the Bayesian approach is very effective in Structuring designs, analyses, complicated models and goals (e.g., ranking) Incorporating all relevant uncertainties Improving estimates Communicating in a more “scientific” manner Combining evidence and opinions Making assumptions explicit However, The Bayesian approach is no panacea and makes additional demands on the analyst Traditional values still apply Space-age methods will not rescue stone-age data
60
December 2010T. A. Louis: Basic Bayes 60 GRACIAS!
61
December 2010T. A. Louis: Basic Bayes 61 TEACHER EXPECTANCY TEACHER EXPECTANCY (data are in “Datasets” ) Data are from a Raudenbush & Bryk meta-analysis of 19 studies (see Cooper and Hedges,1994) Effect size k = distance between treatment and control group means measured in population standard deviation units SE k = the standard error of the effect size Weeks k = estimated weeks of teacher-student contact prior to expectancy induction
62
December 2010T. A. Louis: Basic Bayes 62 TEACHER EXPECTANCY TEACHER EXPECTANCY (continued) Each study consisted of either telling teachers that a student had great potential or not All students received a pre-test and a post-test Teachers evaluated progress A positive effect size indicates that the teachers rated students who were “likely to improve” as having improved more than the control group A negative slope on “Weeks” indicates that the more a teacher got to know a student before the experiment,the less the influence of the expectancy intervention
63
December 2010T. A. Louis: Basic Bayes 63
64
December 2010T. A. Louis: Basic Bayes 64
65
December 2010T. A. Louis: Basic Bayes 65 ACCOUNTING FOR (explaining) UNEXPLAINED VARIABILITY Including regressors can explain (account for) some of unexplained variability Doing so is always a trade-off in that you need to use degrees of freedom to do the explaining Going too far--adding too many regressors-- inflates residual variability In MLMs there is variance at various levels that can potentially be taken into account
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.