+ All Categories
Home > Documents > Multiparameter modelsMultiparameter models • The parameter of interest can be q while q is just a...

Multiparameter modelsMultiparameter models • The parameter of interest can be q while q is just a...

Date post: 26-Mar-2020
Category:
Upload: others
View: 10 times
Download: 0 times
Share this document with a friend
31
Multiparameter models Usually, we have models with many parameters, let’s start with k=2. p(q 1 , q 2 |X) = p(X|q 1 , q 2 )p(q 1 , q 2 ) p(q 1 , q 2 ) is joint prior. Often used: p(q 1 ) p(q 2 ) Prior could also be hierarchical p(q 1 |q 2 ) p(q 2 ) p(X|q 1 , q 2 ) could be e.g. N(m,s 2 ) Marginal posterior density p(q 1 |X) = ∫ p(q 1 , q 2 |X) dq 2 = ∫ p(q 1 | q 2 ,X) p(q 2 |X) dq 2 1
Transcript
Page 1: Multiparameter modelsMultiparameter models • The parameter of interest can be q while q is just a nuisance parameter. • Example: diagnostic testing with sensitivity

Multiparameter models

• Usually, we have models with many parameters, let’s start with k=2. • p(q1, q2|X) = p(X|q1, q2 )p(q1, q2 )

• p(q1, q2 ) is joint prior. Often used: p(q1) p(q2 )

• Prior could also be hierarchical p(q1|q2 ) p(q2 )

• p(X|q1, q2) could be e.g. N(m,s2)

• Marginal posterior density

• p(q1|X) = ∫ p(q1, q2|X) dq2

= ∫ p(q1| q2 ,X) p(q2 |X) dq2

1

Page 2: Multiparameter modelsMultiparameter models • The parameter of interest can be q while q is just a nuisance parameter. • Example: diagnostic testing with sensitivity

Multiparameter models

• The parameter of interest can be q1 while q2 is just a nuisance parameter. • Example: diagnostic testing with sensitivity <100%

• X ~ Bin(N, q1* q2 )

• Here, q1 is the unknown true prevalence, q2 is the unknown test sensitivity – for which we could have an informative prior, though.

• We should take into account the uncertainty of both parameters jointly, given the data (and prior).

• p(q1, q2 | X) = Bin(X | N,q1q2 ) p(q1) p(q2)

2

Page 3: Multiparameter modelsMultiparameter models • The parameter of interest can be q while q is just a nuisance parameter. • Example: diagnostic testing with sensitivity

3

…Solving posterior is difficult, that’s why WinBUGS is used…

p sample: 10000

-0.5 0.0 0.5 1.0

0.0

2.0

4.0

6.0

8.0

p

0.0 0.5

psen

0.0

0.25

0.5

0.75

1.0

p

0.0 0.05

psen

0.92

0.94

0.96

0.98

1.0

• Assume we observed N=100, X=1.

p sample: 10000

0.0 0.05 0.1

0.0

10.0

20.0

30.0

40.0

Without any prior knowledge of sensitivity

Assuming sensitivity is average 0.97, SD 0.01

Page 4: Multiparameter modelsMultiparameter models • The parameter of interest can be q while q is just a nuisance parameter. • Example: diagnostic testing with sensitivity

Multiparameter models

• The aim could also be to predict a multivariate response. (Correlated data models) • This requires several parameters in the model.

• p(X1,X2 | q1,..., qk)

• Posterior prediction p(X1*,X2*|X1,X2) requires integration over all parameters

• Then, some more integration to get marginal predictive distributions p(X1*| X1,X2)= ∫p(X1*,X2*|X1,X2)dX2*

4

Page 5: Multiparameter modelsMultiparameter models • The parameter of interest can be q while q is just a nuisance parameter. • Example: diagnostic testing with sensitivity

time vs temp

0

50

100

150

200

250

300

0 50 100 150 200

time (min)

tem

p (

C)

Simulated

Real data

Area bound

Area bound

Area bound

• The goal could be to predict a 2D-variable

• Example: cooking times (t) vs cooking temperature (C) based on observed data, using bivariate normal model with 5 uncertain parameters.

• Compute predictive distribution p(t,C | data)

5

Page 6: Multiparameter modelsMultiparameter models • The parameter of interest can be q while q is just a nuisance parameter. • Example: diagnostic testing with sensitivity

Identifiability

• Parameters are unidentifiable (from data) if P(X | q1 ) = P(X | q2 ), with q1 ≠ q2

• Posterior result then depends solely on prior.

• Example: X ~ N(q1 + q2 ,1)

• All combinations with q1 + q2 = c are equally probable, unless prior can make a difference.

• Is the posterior a proper density?

• Multiparameter models with insufficient data may lead to problems of identifiability. Useful to check the likelihood.

6

Page 7: Multiparameter modelsMultiparameter models • The parameter of interest can be q while q is just a nuisance parameter. • Example: diagnostic testing with sensitivity

Multinomial model

• E.g. large bag of balls of k different colors. Pick N balls (with replacement)

• X1,…,Xk = number of balls of each color.

• X1+,…,+Xk = N

• Vector X is multinomially distributed, given the true proportions q1,...,qk .

• Find out p(q1,...,qk |X)

7

Page 8: Multiparameter modelsMultiparameter models • The parameter of interest can be q while q is just a nuisance parameter. • Example: diagnostic testing with sensitivity

Multinomial model

• This is a generalization of earlier inference problem with Binomial & Beta

• p(q1,...,qk ) = Dirichlet(a1,…,ak)

• qi =1

• Thanks to conjugate prior:

p(q1,...,qk |X) = Dirichlet(a1+X1,…,ak+Xk)

• Marginal densities easy, if q ~ Dir(a), then

p(qi|X) = Beta(ai, aj - ai)

8

Page 9: Multiparameter modelsMultiparameter models • The parameter of interest can be q while q is just a nuisance parameter. • Example: diagnostic testing with sensitivity

Multinomial model

• Example: there are 12 subtypes of bacteria. In a sample of 20, we observed the following numbers of each type:

• X=(0,1,4,0,8,0,3,1,3,0,0,0)

• p(q1,...,qk |X) = Dir(a1+X1,…,ak+Xk)

• Note the ’pseudo data’ n=12 in the Dir(1,…,1) prior.

9

Page 10: Multiparameter modelsMultiparameter models • The parameter of interest can be q while q is just a nuisance parameter. • Example: diagnostic testing with sensitivity

Multinomial model

10

Page 11: Multiparameter modelsMultiparameter models • The parameter of interest can be q while q is just a nuisance parameter. • Example: diagnostic testing with sensitivity

Normal model N(X|m,s)

• Take a look at the easy cases first:

• p(m|X,s) and p(s|X,m)

• Convenient notation: precision t=1/s2

this parameterization is also used in BUGS with normal densities.

• Conjugate prior for m is N(m0,s0)

• Assume first a single observation Xi:

cp /))(5.0exp(),|( 2

0000 mmttmm

cXXp ii /))(5.0exp(),|( 2mttm

11

Page 12: Multiparameter modelsMultiparameter models • The parameter of interest can be q while q is just a nuisance parameter. • Example: diagnostic testing with sensitivity

Normal model N(X|m,s)

• Posterior for m is then

• Use ’completing a square’ –technique.

• Here n0 = t0 /t can be interpreted as ’pseudo sample size’ from the prior.

• Posterior mean: wm0 +(1-w)Xi , w=t0/(t0+t)

1,

1

/)))()((5.0exp(),,,|(

0

2

0

00

22

0000

nn

XnN

cXXp

i

ii

sm

mtmmttmtm

12

Page 13: Multiparameter modelsMultiparameter models • The parameter of interest can be q while q is just a nuisance parameter. • Example: diagnostic testing with sensitivity

Normal model N(X|m,s)

• With several measurements X1,…,XN , we can write the data-model as

• Similar to previous case, the posterior is

• Here n0 = t0 /(Nt)

)/,|(),|( 2 NXNXp smsm

1

/,

1 0

2

0

00

n

N

n

XnN

sm

13

Page 14: Multiparameter modelsMultiparameter models • The parameter of interest can be q while q is just a nuisance parameter. • Example: diagnostic testing with sensitivity

Normal model N(X|m,s)

• Posterior mean and variance can also be expressed as

• What happens when N0, or N∞ ?

22

0

22

0

0

1)|(

ss

ss

m

mN

XN

XE

22

0

1

1

)|(

ss

mN

XV

14

Page 15: Multiparameter modelsMultiparameter models • The parameter of interest can be q while q is just a nuisance parameter. • Example: diagnostic testing with sensitivity

Normal model N(X|m,s)

• Improper prior

• The posterior is proper density, and

• Compare with non-bayesian statistics, where the inference is based on

• These are like mirror images…

1)( mp

)/,()|( 2 NXNXp sm

)/,()|( 2 NNXp smm

15

Page 16: Multiparameter modelsMultiparameter models • The parameter of interest can be q while q is just a nuisance parameter. • Example: diagnostic testing with sensitivity

Normal model N(X|m,s)

• p(s|X,m) ?

• Assume observations X1,…,XN

• Here

• Conjugate prior for t? ….gamma(a,b)

)2

exp()2

exp()(

))(2

1exp(),|(

2

0

2/2

02

2/2

1

2

2

sN

sN

XXp

NN

N

i

i

N

tt

ss

ms

ssm

N

i

iXN

s1

22

0 )(1

m

16

Page 17: Multiparameter modelsMultiparameter models • The parameter of interest can be q while q is just a nuisance parameter. • Example: diagnostic testing with sensitivity

Normal model N(X|m,s)

• Following from Bayes, the posterior p(s|X,m) is proportional to

• This is recognized as gamma(N/2+a,Ns0

2/2+b)

• Uninformative prior a0, b0.

))2

(exp(

)exp()2

exp(

2

0

12/

12

0

2/

tbt

bttt

t

a

a

sN

sN

N

N

17

Page 18: Multiparameter modelsMultiparameter models • The parameter of interest can be q while q is just a nuisance parameter. • Example: diagnostic testing with sensitivity

Normal model N(X|m,s)

• p(m,s|X) ?

• Assume observations X1,…,XN

• Several options:

1. conjugate 2D prior p(m,s)=p(m|s)p(s)

2. independent priors p(m), p(s)

3. improper prior

This will get more mathematical, you are free to skip details unless you love the math…

ttm /1),( p

18

Page 19: Multiparameter modelsMultiparameter models • The parameter of interest can be q while q is just a nuisance parameter. • Example: diagnostic testing with sensitivity

Normal model N(X|m,s)

• Difficulties:

1. conjugate 2D prior p(m,s)=p(m|s)p(s)

Not very practical to express prior of m, conditionally on s.

19

Page 20: Multiparameter modelsMultiparameter models • The parameter of interest can be q while q is just a nuisance parameter. • Example: diagnostic testing with sensitivity

Normal model N(X|m,s)

• Difficulties:

2. independent priors p(m), p(s)

Not possible to choose so that posterior could be solved in any familiar form.

20

Page 21: Multiparameter modelsMultiparameter models • The parameter of interest can be q while q is just a nuisance parameter. • Example: diagnostic testing with sensitivity

Normal model N(X|m,s)

• Difficulties:

3. Improper prior

same as

same as

Posterior can be solved by factorization

p(m,s2|X) = p(m|s2,X)p(s2|X)

…we already have solved the first part before.

ttm /1),( p

2/1),( ssm p

1))log(,( smp

21

Page 22: Multiparameter modelsMultiparameter models • The parameter of interest can be q while q is just a nuisance parameter. • Example: diagnostic testing with sensitivity

Normal model N(X|m,s)

• The second part is p(s2|X)

= Scaled-Inverse-c2(n-1,s)

• Or: p(t|X)

= Gamma((n-1)/2,(n-1)s2/2)

• The full joint density can thus be written as a product of two known densities. • Convenient for Monte Carlo simulations. (draw s2,

then m conditionally on s2)

• Also, can solve p(s2 |m,X), useful for Gibbs sampling.

22

N

i

i XXN

s1

22 )(1

1

Page 23: Multiparameter modelsMultiparameter models • The parameter of interest can be q while q is just a nuisance parameter. • Example: diagnostic testing with sensitivity

Working out p(s2|X)

• First, write p(m,s2| X1,…,Xn ) in the form:

where • Then, integrate over m to get marginal

density.

23

]))()1[(2

1exp(

))(2

1exp()|,(

22

2

2

1

2

2

2

ms

s

ms

sssm

Xnsn

XXp

n

N

i

i

n

prior likelihood

N

i

i XXN

s1

22 )(1

1

Manipulation

Page 24: Multiparameter modelsMultiparameter models • The parameter of interest can be q while q is just a nuisance parameter. • Example: diagnostic testing with sensitivity

Working out p(s2|X)

• Solving p(s2|X): integrate the joint density p(s2,m|X) over m.

= Scaled-Inverse-c2(n-1,s) For t1/s2: this is Gamma((n-1)/2,(n-1)s2/2)

24

)2

)1(exp()(

/2))1(2

1exp(

))(2

exp())1(2

1exp(

]))()1[(2

1exp()|(

2

22/)1(2

22

2

2

2

2

2

2

2

22

2

22

ss

ss

s

mmss

s

mms

ss

sn

nsn

dXn

sn

dXnsnXp

n

n

n

n

Page 25: Multiparameter modelsMultiparameter models • The parameter of interest can be q while q is just a nuisance parameter. • Example: diagnostic testing with sensitivity

Working out p(s2|X)

• That required a few steps and manipulations…

• The lesson was: • To give you an impression of what kind of tricks and

techniques are needed for exact solutions.

• To see why and how the seemingly simple principle of Bayes theorem leads to increasingly complicated math which has been a major obstacle in practical Bayesian applications in the past.

• To give motivation for the next sessions on Monte Carlo methods and WinBUGS/OpenBUGS.

25

Page 26: Multiparameter modelsMultiparameter models • The parameter of interest can be q while q is just a nuisance parameter. • Example: diagnostic testing with sensitivity

Other multiparameter models

• Regression models, e.g. linear regression • Example: Yi ~ N(mi,s

2)

• mi = b1Xi1 + … + bkXik = Xi b (vector notation)

• b = regression parameters.

• X = matrix of explanatory variables.

• Y = observations from i=1,…,n individuals.

• Aim to compute p(b,s2|Y,X) which is k+1 dimensional density.

• Typical priors aim to be uninformative.

• Posterior is then proper, if n>k, and the rank of X (number of linearly independent columns) is k. This is the case in most applications.

26

Page 27: Multiparameter modelsMultiparameter models • The parameter of interest can be q while q is just a nuisance parameter. • Example: diagnostic testing with sensitivity

Other multiparameter models

• Regression models, e.g. linear regression • Example: Yi ~ N(mi,s

2), assume s2 is ’known’.

• p(b|Y,X,s) can then be solved, and it is:

N( (XTX)-1 XT Y , (XTX)-1 s2 )

• Here, posterior mean (XTX)-1 XT Y is the same as max likelihood estimate (in this case it’s also the least squares estimate) of b.

27

Page 28: Multiparameter modelsMultiparameter models • The parameter of interest can be q while q is just a nuisance parameter. • Example: diagnostic testing with sensitivity

Multiparameter models

• Generalized linear models • Example: Yi ~ Bin(Ni,qi),

• Link function: logit(qi) = log(qi/(1-qi)) = Xi b

• Prior p(b)

• Posterior p(b|Y,X) = p(Y|X,b)p(b)/c =

Bin(Yi|Ni,qi)p(b)/c

28

Page 29: Multiparameter modelsMultiparameter models • The parameter of interest can be q while q is just a nuisance parameter. • Example: diagnostic testing with sensitivity

Other multiparameter models

• Hierarchical models • Example:

Yijk ~ N(mij,s2

ij), result from patient k in hospital j, in district i.

• mij ~ N(fi,s2

i), mean of hospital j, in district i

• fi ~ N(q,s2), mean of district i.

• q ~ N(0,10000) prior of ’grand mean’

• Also need priors for variance components.

• Compute: p(mij,fi,q, s2ij, s

2i, s

2| Y) =

p(Y|mi,,s2

ij) p(mij|fi, s2

i) p(fi|q, s2) p(q) p(s2ij) p(s2

i) p(s2) /c

29

Page 30: Multiparameter modelsMultiparameter models • The parameter of interest can be q while q is just a nuisance parameter. • Example: diagnostic testing with sensitivity

Other multiparameter models

• Hierarchical models • Intuition: compare with a genetic model of a family

tree: grand parents, parents, children. An observation from a child gives information about cousins too!

• Also used in meta-analysis & evidence synthesis.

• Also known as multilevel models.

• Random effect models, mixed effects, spatial models, spatiotemporal models, applications are wide…

30

Page 31: Multiparameter modelsMultiparameter models • The parameter of interest can be q while q is just a nuisance parameter. • Example: diagnostic testing with sensitivity

• Hierarchical models… (more about DAGs later)

31


Recommended