1 / 14

Lecture 16

Lecture 16. MCMC for Poisson response models. Lecture Contents. Multilevel Poisson Model MCMC Algorithms for Poisson Models MLwiN for Poisson models WinBUGS for Poisson models Comparisons. Multilevel Poisson model.

baylee
Télécharger la présentation

Lecture 16

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lecture 16 MCMC for Poisson response models

  2. Lecture Contents • Multilevel Poisson Model • MCMC Algorithms for Poisson Models • MLwiN for Poisson models • WinBUGS for Poisson models • Comparisons

  3. Multilevel Poisson model The Poisson distribution is used to model count data. It is often used in disease data as an approximation to the Binomial distribution where the exposure (number of trials) is used as an offset variable. In the practical we will look in detail at a veterinary epidemiology dataset on TB cases in animal herds in Canada. Here the response is the number of cases of TB in the period 1985 to 1994 in herds of cattle, cervids and bison. Note that the data contains only herds which were infected in outbreaks of TB and the data has been falsified to meet confidentiality regulations.

  4. Multilevel Poisson Regression A multilevel Poisson regression model can be written as follows: You will notice the offset (log(expij)) which in the TB example is the number of animal days at risk in the group. Including this offset allows comparison of rates rather than number of cases which is more sensible as otherwise the model will simply predict that more cases are seen in herds with more days at risk!

  5. Bayesian Multilevel Poisson model To extent the model into a Bayesian framework we need to include priors for the fixed effects and between herd variance. We will use the standard ‘diffuse’ priors as shown below:

  6. MCMC Algorithm Our MLwiN algorithm has 3 steps: • 1. Generate βi by Univariate Normal MH Sampling in MLwiN or Gamerman method in WinBUGS. • 2. Generate each uj by Univariate Normal MH Sampling in MLwiN or AR sampling in WinBUGS. • 3. Generate 1/σu2 from its Gamma conditional distribution.

  7. A final model for TB-Real ? We will consider here only the following model for the dataset which contains all feasible predictors. The model to the right has been fitted using 1st order MQL estimation. Note: to construct this model you will need to make predictors categorical via the Names window and construct the offset via the Calculate window.

  8. MLwiN MH Estimation Using MH in MLwiN gives the following estimates after 50,000 iterations:

  9. Trajectories plot The (thinned) trajectories are as follows:

  10. WinBUGS code model { # Level 1 definition for(i in 1:N) { reactors[i] ~ dpois(mu[i]) log(mu[i]) <- offs[i] + beta[1] * cons[i] + beta[2] * type_2[i] + beta[3] * type_3[i] + beta[4] * type_5[i] + beta[5] * sex_2[i] + beta[6] * age_1[i] + beta[7] * age_2[i] + u2[farm_id[i]] * cons[i] } # Higher level definitions for (j in 1:n2) { u2[j] ~ dnorm(0,tau.u2) } # Priors for fixed effects for (k in 1:7) { beta[k] ~ dflat() } # Priors for random terms tau.u2 ~ dgamma(0.001000,0.001000) sigma2.u2 <- 1/tau.u2 } Here we see the use of dpois for a Poisson distribution. Note that when code is generated via MLwiN the offset is always named ‘offs’. Fortunately WinBUGS allows variable names to include the underscore character.

  11. WinBUGS timing comparison • WinBUGS took 2 minutes 4 seconds for 55,000 iterations compared with 15 seconds in MLwiN. • The chain for the intercept and two worst mixing fixed effects were as follows:

  12. WinBUGS/MLwiN estimates The following estimates were produced:

  13. Effective sample size comparison Note that the Ratio in ESS figures below have to be balanced by the fact that MLwiN is 124/15 = 8.27 times faster!

  14. Information for the practical In the final practical of the week you are asked to look at fitting more Poisson models to the tb-real dataset. You can use the DIC for Poisson models in both MLwiN and WinBUGS to find firstly the best single level model and then the best random effects model.

More Related