34
Bayesian Computation Andrew Gelman Department of Statistics and Department of Political Science Columbia University Class 3, 21 Sept 2011 Andrew Gelman Bayesian Computation

Andrew Gelman Department of Statistics and Department of ...gelman/bayescomputation/class3.pdf · Department of Statistics and Department of Political Science Columbia University

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Andrew Gelman Department of Statistics and Department of ...gelman/bayescomputation/class3.pdf · Department of Statistics and Department of Political Science Columbia University

Bayesian Computation

Andrew GelmanDepartment of Statistics and Department of Political Science

Columbia University

Class 3, 21 Sept 2011

Andrew Gelman Bayesian Computation

Page 2: Andrew Gelman Department of Statistics and Department of ...gelman/bayescomputation/class3.pdf · Department of Statistics and Department of Political Science Columbia University

Review of homework 3

I Skills:

1. Write the joint posterior density (up to a multiplicativeconstant)

2. Program one-dimensional Metropolis jumps3. Program the accept/reject rule4. Fit generalized linear models in R5. Display and summarize results

I And more . . .

Andrew Gelman Bayesian Computation

Page 3: Andrew Gelman Department of Statistics and Department of ...gelman/bayescomputation/class3.pdf · Department of Statistics and Department of Political Science Columbia University

Review of homework 3

I Skills:

1. Write the joint posterior density (up to a multiplicativeconstant)

2. Program one-dimensional Metropolis jumps3. Program the accept/reject rule4. Fit generalized linear models in R5. Display and summarize results

I And more . . .

Andrew Gelman Bayesian Computation

Page 4: Andrew Gelman Department of Statistics and Department of ...gelman/bayescomputation/class3.pdf · Department of Statistics and Department of Political Science Columbia University

Review of homework 3

I Skills:

1. Write the joint posterior density (up to a multiplicativeconstant)

2. Program one-dimensional Metropolis jumps3. Program the accept/reject rule4. Fit generalized linear models in R5. Display and summarize results

I And more . . .

Andrew Gelman Bayesian Computation

Page 5: Andrew Gelman Department of Statistics and Department of ...gelman/bayescomputation/class3.pdf · Department of Statistics and Department of Political Science Columbia University

Review of homework 3

I Skills:

1. Write the joint posterior density (up to a multiplicativeconstant)

2. Program one-dimensional Metropolis jumps3. Program the accept/reject rule4. Fit generalized linear models in R5. Display and summarize results

I And more . . .

Andrew Gelman Bayesian Computation

Page 6: Andrew Gelman Department of Statistics and Department of ...gelman/bayescomputation/class3.pdf · Department of Statistics and Department of Political Science Columbia University

Review of homework 3

I Skills:

1. Write the joint posterior density (up to a multiplicativeconstant)

2. Program one-dimensional Metropolis jumps3. Program the accept/reject rule4. Fit generalized linear models in R5. Display and summarize results

I And more . . .

Andrew Gelman Bayesian Computation

Page 7: Andrew Gelman Department of Statistics and Department of ...gelman/bayescomputation/class3.pdf · Department of Statistics and Department of Political Science Columbia University

Review of homework 3

I Skills:

1. Write the joint posterior density (up to a multiplicativeconstant)

2. Program one-dimensional Metropolis jumps3. Program the accept/reject rule4. Fit generalized linear models in R5. Display and summarize results

I And more . . .

Andrew Gelman Bayesian Computation

Page 8: Andrew Gelman Department of Statistics and Department of ...gelman/bayescomputation/class3.pdf · Department of Statistics and Department of Political Science Columbia University

Review of homework 3

I Skills:

1. Write the joint posterior density (up to a multiplicativeconstant)

2. Program one-dimensional Metropolis jumps3. Program the accept/reject rule4. Fit generalized linear models in R5. Display and summarize results

I And more . . .

Andrew Gelman Bayesian Computation

Page 9: Andrew Gelman Department of Statistics and Department of ...gelman/bayescomputation/class3.pdf · Department of Statistics and Department of Political Science Columbia University

Review of homework 3

I Skills:

1. Write the joint posterior density (up to a multiplicativeconstant)

2. Program one-dimensional Metropolis jumps3. Program the accept/reject rule4. Fit generalized linear models in R5. Display and summarize results

I And more . . .

Andrew Gelman Bayesian Computation

Page 10: Andrew Gelman Department of Statistics and Department of ...gelman/bayescomputation/class3.pdf · Department of Statistics and Department of Political Science Columbia University

Implementing Gibbs and Metropolis and improving theirefficiency

I Presentation by Wei Wang, Ph.D. student in statistics

I You can interrupt and discuss . . .

Andrew Gelman Bayesian Computation

Page 11: Andrew Gelman Department of Statistics and Department of ...gelman/bayescomputation/class3.pdf · Department of Statistics and Department of Political Science Columbia University

Implementing Gibbs and Metropolis and improving theirefficiency

I Presentation by Wei Wang, Ph.D. student in statistics

I You can interrupt and discuss . . .

Andrew Gelman Bayesian Computation

Page 12: Andrew Gelman Department of Statistics and Department of ...gelman/bayescomputation/class3.pdf · Department of Statistics and Department of Political Science Columbia University

Implementing Gibbs and Metropolis and improving theirefficiency

I Presentation by Wei Wang, Ph.D. student in statistics

I You can interrupt and discuss . . .

Andrew Gelman Bayesian Computation

Page 13: Andrew Gelman Department of Statistics and Department of ...gelman/bayescomputation/class3.pdf · Department of Statistics and Department of Political Science Columbia University

1. Write the joint posterior density (up to a multiplicativeconstant)

I Binomial model for #deaths given #rats

I Logistic model for Pr(death)

I Prior distribution for the logistic regression coefficients

I Discuss extensions to the model

I Steps 2, 3, 4 5 are straightforward

Andrew Gelman Bayesian Computation

Page 14: Andrew Gelman Department of Statistics and Department of ...gelman/bayescomputation/class3.pdf · Department of Statistics and Department of Political Science Columbia University

1. Write the joint posterior density (up to a multiplicativeconstant)

I Binomial model for #deaths given #rats

I Logistic model for Pr(death)

I Prior distribution for the logistic regression coefficients

I Discuss extensions to the model

I Steps 2, 3, 4 5 are straightforward

Andrew Gelman Bayesian Computation

Page 15: Andrew Gelman Department of Statistics and Department of ...gelman/bayescomputation/class3.pdf · Department of Statistics and Department of Political Science Columbia University

1. Write the joint posterior density (up to a multiplicativeconstant)

I Binomial model for #deaths given #rats

I Logistic model for Pr(death)

I Prior distribution for the logistic regression coefficients

I Discuss extensions to the model

I Steps 2, 3, 4 5 are straightforward

Andrew Gelman Bayesian Computation

Page 16: Andrew Gelman Department of Statistics and Department of ...gelman/bayescomputation/class3.pdf · Department of Statistics and Department of Political Science Columbia University

1. Write the joint posterior density (up to a multiplicativeconstant)

I Binomial model for #deaths given #rats

I Logistic model for Pr(death)

I Prior distribution for the logistic regression coefficients

I Discuss extensions to the model

I Steps 2, 3, 4 5 are straightforward

Andrew Gelman Bayesian Computation

Page 17: Andrew Gelman Department of Statistics and Department of ...gelman/bayescomputation/class3.pdf · Department of Statistics and Department of Political Science Columbia University

1. Write the joint posterior density (up to a multiplicativeconstant)

I Binomial model for #deaths given #rats

I Logistic model for Pr(death)

I Prior distribution for the logistic regression coefficients

I Discuss extensions to the model

I Steps 2, 3, 4 5 are straightforward

Andrew Gelman Bayesian Computation

Page 18: Andrew Gelman Department of Statistics and Department of ...gelman/bayescomputation/class3.pdf · Department of Statistics and Department of Political Science Columbia University

1. Write the joint posterior density (up to a multiplicativeconstant)

I Binomial model for #deaths given #rats

I Logistic model for Pr(death)

I Prior distribution for the logistic regression coefficients

I Discuss extensions to the model

I Steps 2, 3, 4 5 are straightforward

Andrew Gelman Bayesian Computation

Page 19: Andrew Gelman Department of Statistics and Department of ...gelman/bayescomputation/class3.pdf · Department of Statistics and Department of Political Science Columbia University

And more . . .

I Check convergence

I Debug program

I Check fit of model to data

I Understand model in context of data and alternative models

Andrew Gelman Bayesian Computation

Page 20: Andrew Gelman Department of Statistics and Department of ...gelman/bayescomputation/class3.pdf · Department of Statistics and Department of Political Science Columbia University

And more . . .

I Check convergence

I Debug program

I Check fit of model to data

I Understand model in context of data and alternative models

Andrew Gelman Bayesian Computation

Page 21: Andrew Gelman Department of Statistics and Department of ...gelman/bayescomputation/class3.pdf · Department of Statistics and Department of Political Science Columbia University

And more . . .

I Check convergence

I Debug program

I Check fit of model to data

I Understand model in context of data and alternative models

Andrew Gelman Bayesian Computation

Page 22: Andrew Gelman Department of Statistics and Department of ...gelman/bayescomputation/class3.pdf · Department of Statistics and Department of Political Science Columbia University

And more . . .

I Check convergence

I Debug program

I Check fit of model to data

I Understand model in context of data and alternative models

Andrew Gelman Bayesian Computation

Page 23: Andrew Gelman Department of Statistics and Department of ...gelman/bayescomputation/class3.pdf · Department of Statistics and Department of Political Science Columbia University

And more . . .

I Check convergence

I Debug program

I Check fit of model to data

I Understand model in context of data and alternative models

Andrew Gelman Bayesian Computation

Page 24: Andrew Gelman Department of Statistics and Department of ...gelman/bayescomputation/class3.pdf · Department of Statistics and Department of Political Science Columbia University

Optimizing the algorithm

I Scale of jumps in α and β

I Jumping distributions

I One-dimensional or two-dimensional jumps

I How to implement Gibbs here??

I Other computational strategies??

Andrew Gelman Bayesian Computation

Page 25: Andrew Gelman Department of Statistics and Department of ...gelman/bayescomputation/class3.pdf · Department of Statistics and Department of Political Science Columbia University

Optimizing the algorithm

I Scale of jumps in α and β

I Jumping distributions

I One-dimensional or two-dimensional jumps

I How to implement Gibbs here??

I Other computational strategies??

Andrew Gelman Bayesian Computation

Page 26: Andrew Gelman Department of Statistics and Department of ...gelman/bayescomputation/class3.pdf · Department of Statistics and Department of Political Science Columbia University

Optimizing the algorithm

I Scale of jumps in α and β

I Jumping distributions

I One-dimensional or two-dimensional jumps

I How to implement Gibbs here??

I Other computational strategies??

Andrew Gelman Bayesian Computation

Page 27: Andrew Gelman Department of Statistics and Department of ...gelman/bayescomputation/class3.pdf · Department of Statistics and Department of Political Science Columbia University

Optimizing the algorithm

I Scale of jumps in α and β

I Jumping distributions

I One-dimensional or two-dimensional jumps

I How to implement Gibbs here??

I Other computational strategies??

Andrew Gelman Bayesian Computation

Page 28: Andrew Gelman Department of Statistics and Department of ...gelman/bayescomputation/class3.pdf · Department of Statistics and Department of Political Science Columbia University

Optimizing the algorithm

I Scale of jumps in α and β

I Jumping distributions

I One-dimensional or two-dimensional jumps

I How to implement Gibbs here??

I Other computational strategies??

Andrew Gelman Bayesian Computation

Page 29: Andrew Gelman Department of Statistics and Department of ...gelman/bayescomputation/class3.pdf · Department of Statistics and Department of Political Science Columbia University

Optimizing the algorithm

I Scale of jumps in α and β

I Jumping distributions

I One-dimensional or two-dimensional jumps

I How to implement Gibbs here??

I Other computational strategies??

Andrew Gelman Bayesian Computation

Page 30: Andrew Gelman Department of Statistics and Department of ...gelman/bayescomputation/class3.pdf · Department of Statistics and Department of Political Science Columbia University

For next week’s class

I Homework 4 due 5pm Tues

I All course material is at http://www.stat.columbia.edu/~gelman/bayescomputation

I Next class:I Student presentation on missing-data imputation

Andrew Gelman Bayesian Computation

Page 31: Andrew Gelman Department of Statistics and Department of ...gelman/bayescomputation/class3.pdf · Department of Statistics and Department of Political Science Columbia University

For next week’s class

I Homework 4 due 5pm Tues

I All course material is at http://www.stat.columbia.edu/~gelman/bayescomputation

I Next class:I Student presentation on missing-data imputation

Andrew Gelman Bayesian Computation

Page 32: Andrew Gelman Department of Statistics and Department of ...gelman/bayescomputation/class3.pdf · Department of Statistics and Department of Political Science Columbia University

For next week’s class

I Homework 4 due 5pm Tues

I All course material is at http://www.stat.columbia.edu/~gelman/bayescomputation

I Next class:I Student presentation on missing-data imputation

Andrew Gelman Bayesian Computation

Page 33: Andrew Gelman Department of Statistics and Department of ...gelman/bayescomputation/class3.pdf · Department of Statistics and Department of Political Science Columbia University

For next week’s class

I Homework 4 due 5pm Tues

I All course material is at http://www.stat.columbia.edu/~gelman/bayescomputation

I Next class:I Student presentation on missing-data imputation

Andrew Gelman Bayesian Computation

Page 34: Andrew Gelman Department of Statistics and Department of ...gelman/bayescomputation/class3.pdf · Department of Statistics and Department of Political Science Columbia University

For next week’s class

I Homework 4 due 5pm Tues

I All course material is at http://www.stat.columbia.edu/~gelman/bayescomputation

I Next class:I Student presentation on missing-data imputation

Andrew Gelman Bayesian Computation