writing bayesian hierarchical models
TRANSCRIPT
Writing Bayesian Hierarchical Models
Models for Socio-Environmental Data
Chris Che-Castaldo, Mary B. Collins, N. Thompson Hobbs
December 18, 2020
Che-Castaldo, Collins, Hobbs DBI-1052875, DBI-1639145, DEB 1145200 1 / 4
Examples of
I Multi-level models (aka random e↵ects)
I Sampling error in x’s and y’s
I Calibration error in y’s
All of these will appear in the exercises.
Che-Castaldo, Collins, Hobbs DBI-1052875, DBI-1639145, DEB 1145200 2 / 4
Things to watch for today
Partitioning uncertainty
I Process variance
I Sampling variance
I Calibration variance (aka observation variance)
I Group level variance
Che-Castaldo, Collins, Hobbs DBI-1052875, DBI-1639145, DEB 1145200 3 / 4
Steps in writing Bayesian models
1. Write your deterministic model. Be careful about support.
2. Draw Bayesian network (DAG) describing relationships
between observed and unobserved quantities.
3. Use the Bayesian network to write proportionality between
posterior and joint distributions using bracket notation [ | ].3.1 Posterior distribution: [unobserved quantities |data]3.2 Joint distribution
3.2.1 All nodes in Bayesian network at the heads of arrows (children)must be on the left hand side of a conditioning symbol.
3.2.2 All nodes in Bayesian network at the tails of arrows (parents)must be on the right hand side of a conditioning symbol |.
3.2.3 All nodes at the end of an arrow with no arrow coming intothem must be expressed unconditionally, i.e., they must havenumeric arguments.
4. Assign specific PDF or PMF to each of the brackets.
5. Choose numeric values for parameters of prior distributions.
Do this sensibly! Do not default to vague priors. (Do as I say,
not as I do.)
Che-Castaldo, Collins, Hobbs DBI-1052875, DBI-1639145, DEB 1145200 4 / 4
u- -3¥ Y=ngg¥g positiveA n = number of| tests
p
[ply] a Gdp] Lp)prevalence =p
Yr binomial ( nip)
N - -8¥ Y -_number positive f- sensitivity, probability that a
tests test returns a position conffond
If Ty n-
-7131508 on individual being truly infected .
$2- true
,unobserved Y = specificity, probability tret a
Z number f. Infected test returns a negate resultindividuals
conditional on an individual beingtruly uninfected
>
4-number positive of -_ sensitivity, probability that aN - e z ng tests test returns a position conffond
Ty Tyn -71315% on individual beingtruly uninfected
$ 2- true,unobserved Y = specificity, probability tret a
>number of Infidel test returns a nega the result
- individualsconditional on an
.
individual beingtruly uninfected
@l.Y.zlYIaeIKthk-d.n] Life]Zprevalence = -n
Yr binomial¥I, n)⑤ n betel , BD-must be informed !4~bete.az
,
I- --
zneategoricfcu) v -- Ctn,.. .
,÷) length n
Yi
of Tyobsess:#on
Q
Ii--⇒2iTT ga Princesse ,I p
I
%" theQ
Xi.
- - ⇒ Zi
x
-
9 T a- a G
& p
f -- sensitivity, probability that a Zi = l of sicktest returns a position conditional = o if healthyon individual being truly infected#true
,
unobserved4 = specificity, probability tret - Yi = test result
,test returns a negate result z if positive , Oconditional on an individual being j negative
truly uninfected .
Xi = Vector of~ covariates
✓
% of - sensitivity, probability that a Zi = l of sicky
test returns a position conffond = o if healthy✓
"
Y Ty on individual being truly infected#& true
,
unobserved
× - - ⇒ z :4 - specificity, prob- i .by/Mt - Yi = test result
,- i
qtest returns a negate result z if positive , Oconditional on an individual being if negative
I uuialeetel
Es ,# 4,3117 iilziotd-2.74 -D) Gi Ip :] EID five:3
Yin Bernoulli fifth-2,14-4)) p ;=exp (¥i#-
.
2. in Bernoulli (pi) It exp Gif)Pij n normal (O, 2.5)
-2N
of ~ Bek f. ¥inverse
10,07¥.
.Eu Betas,-1
. prevalence -it Is : 1-i=L o* i
Qf
ok
inis
?Ei.
.-
Fe
oz
wu
nfwp.
I①3
are
TT
bis
u
→isrI
oof
..
I-
so..
in-
Nqf38
¥!)CwxiIal
Errors in the Covariant : we hire ie ! . . ,8 replicate measures
of light intensity at radon points in te canopy
How would we estimate to mean light seen by* me ?
,§÷.
3 II. seen
we now attach this to ourmodel :
÷÷. in.* i.⇒[6%3,79%11,1] ??÷¥ glare.si?ofI
'x'Eisa:;) GIGS)x priors
Errors in.
the y 's : incorporating a calibrationmodel
.
ie:S" ÷
.
h = E)Ir
[a. b. s:L 'D a? gamma fy.IE#E@ilaIE)Gi'
GE
X gammaCal . 001 , .00 1) g.am
malls 1.004.001) gammaCol . ooh, ooo)
? gary ,Yi = observed height
IXi - - Z Mi Mi -true
,an observe 1
a I,
nine:.. .: . .. . .:*. in onx [mil g Ca ,8, e, xit , Gf)x faves so:3 [a aid Ed Gil
Yi n gamma fcmo÷÷, Cmj )
Be careful with choice of likelihood andmoment match
.
These will not work :
log Cy..) ~ normal (log (Iast,
G: )Yi r log normal Clog (Iast
,Q )
why ? he- Ilight
If you want to use the lognormcl :
1) Do cab :bration regression on logscale '
logineight-
log (massand use previous likelihoods
.
zyDo calibrator as before and momentmatch for mean any variance
,
e. g .
Ui - CETIYi n log normal (Ilog(Giani ,MEEEE;D
III.= r- EN
en iii.÷:*'¥ ¥t¥
.
equal - ta !kL HPDI
" I.¥¥¥*÷t¥.# Tu
-025 1975
The media of treponemaGuy
42. 6 (B #ighstposhid ds.txhk-l.BEHPDI =)