# Introduction to WinBUGS for Ecologists

**Bayesian approach to regression, ANOVA, mixed models and related analyses**

**By**

- Marc Kery, Population Ecologist, Swiss Ornithological Institute, Switzerland

Introduction to WinBUGS for Ecologists introduces applied Bayesian modeling to ecologists using the highly acclaimed, free WinBUGS software. It offers an understanding of statistical models as abstract representations of the various processes that give rise to a data set. Such an understanding is basic to the development of inference models tailored to specific sampling and ecological scenarios. The book begins by presenting the advantages of a Bayesian approach to statistics and introducing the WinBUGS software. It reviews the four most common statistical distributions: the normal, the uniform, the binomial, and the Poisson. It describes the two different kinds of analysis of variance (ANOVA): one-way and two- or multiway. It looks at the general linear model, or ANCOVA, in R and WinBUGS. It introduces generalized linear model (GLM), i.e., the extension of the normal linear model to allow error distributions other than the normal. The GLM is then extended contain additional sources of random variation to become a generalized linear mixed model (GLMM) for a Poisson example and for a binomial example. The final two chapters showcase two fairly novel and nonstandard versions of a GLMM. The first is the site-occupancy model for species distributions; the second is the binomial (or N-) mixture model for estimation and modeling of abundance.

View full description### Audience

Ecologists, upper-level graduate and graduate ecology students.

### Book information

- Published: June 2010
- Imprint: ACADEMIC PRESS
- ISBN: 978-0-12-378605-0

### Reviews

"I don’t believe this book was written with the goal of being treated as the primary text of an intro Bayesian statistics course. That said, it could prove to be a useful supplemental text for an introductory Bayesian course or even a linear models course. Although the book was geared towards ecologists, I believe it would be an excellent library addition for any applied modeler interested in applying Bayesian methodologies in their work."--**The American Statistician**

### Table of Contents

Foreword

Preface

1. Introduction

1.1 Advantages of the Bayesian Approach to Statistics

1.2 So Why Then Isn’t Everyone a Bayesian?

1.3 WinBUGS

1.4 Why This Book?

1.5 What This Book Is Not About: Theory of Bayesian Statistics and Computation

1.6 Further Reading

1.7 Summary

2. Introduction to the Bayesian Analysis of a Statistical Model

2.1 Probability Theory and Statistics

2.2 Two Views of Statistics: Classical and Bayesian

2.3 The Importance of Modern Algorithms and Computers for Bayesian Statistics

2.4 Markov chain Monte Carlo (MCMC) and Gibbs Sampling

2.5 What Comes after MCMC?

2.6 Some Shared Challenges in the Bayesian and the Classical Analysis of a Statistical Model

2.7 Pointer to Special Topics in This Book

2.8 Summary

3. WinBUGS

3.1 What Is WinBUGS?

3.2 Running WinBUGS from R

3.3 WinBUGS Frees the Modeler in You

3.4 Some Technicalities and Conventions

4. A First Session in WinBUGS: The “Model of the Mean”

4.1 Introduction

4.2 Setting Up the Analysis

4.3 Starting the MCMC blackbox

4.4 Summarizing the Results

4.5 Summary

5. Running WinBUGS from R via R2WinBUGS

5.1 Introduction

5.2 Data Generation

5.3 Analysis Using R

5.4 Analysis Using WinBUGS

5.5 Summary

6. Key Components of (Generalized) Linear Models: Statistical Distributions and the Linear Predictor

6.1 Introduction

6.2 Stochastic Part of Linear Models: Statistical Distributions

6.3 Deterministic Part of Linear Models: Linear Predictor and Design Matrices

6.4 Summary

7. t-Test: Equal and Unequal Variances

7.1 t-Test with Equal Variances

7.2 t-Test with Unequal Variances

7.3 Summary and a Comment on the Modeling of Variances

8. Normal Linear Regression

8.1 Introduction

8.2 Data Generation

8.3 Analysis Using R

8.4 Analysis Using WinBUGS

8.5 Summary

9. Normal One-Way ANOVA

9.1 Introduction: Fixed and Random Effects

9.2 Fixed-Effects ANOVA

9.3 Random-Effects ANOVA

9.4 Summary

10. Normal Two-Way ANOVA

10.1 Introduction: Main and Interaction Effects

10.2 Data Generation

10.3 Aside: Using Simulation to Assess Bias and Precision of an Estimator

10.4 Analysis Using R

10.5 Analysis Using WinBUGS

10.6 Summary

11. General Linear Model (ANCOVA)

11.1 Introduction

11.2 Data Generation

11.3 Analysis Using R

11.4 Analysis Using WinBUGS (and a Cautionary Tale About the Importance of Covariate Standardization)

11.5 Summary

12. Linear Mixed-Effects Model

12.1 Introduction

12.2 Data Generation

12.3 Analysis Under a Random-Intercepts Model

12.4 Analysis Under a Random-Coefficients Model without Correlation between Intercept and Slope

12.5 The Random-Coefficients Model with Correlation between Intercept and Slope

12.6 Summary

13. Introduction to the Generalized Linear Model: Poisson “t-test”

13.1 Introduction

13.2 An Important but Often Forgotten Issue with Count Data

13.3 Data Generation

13.4 Analysis Using R

13.5 Analysis Using WinBUGS

13.6 Summary

14. Overdispersion, Zero-Inflation, and Offsets in the GLM

14.1 Overdispersion

14.2 Zero-Inflation

14.3 Offsets

14.4 Summary

15. Poisson ANCOVA

15.1 Introduction

15.2 Data Generation

15.3 Analysis Using R

15.4 Analysis Using WinBUGS

15.5 Summary

16. Poisson Mixed-Effects Model (Poisson GLMM)

16.1 Introduction

16.2 Data Generation

16.3 Analysis Under a Random-Coefficients Model

16.4 Summary

17. Binomial “t-Test”

17.1 Introduction

17.2 Data Generation

17.3 Analysis Using R

17.4 Analysis Using WinBUGS

17.5 Summary

18. Binomial Analysis of Covariance

18.1 Introduction

18.2 Data Generation

18.3 Analysis Using R

18.4 Analysis Using WinBUGS

18.5 Summary

19. Binomial Mixed-Effects Model (Binomial GLMM)

19.1 Introduction

19.2 Data Generation

19.3 Analysis Under a Random-Coefficients Model

19.4 Summary

20. Nonstandard GLMMs 1: Site-Occupancy Species Distribution Model

20.1 Introduction

20.2 Data Generation

20.3 Analysis Using WinBUGS

20.4 Summary

21. Nonstandard GLMMs 2: Binomial Mixture Model to Model Abundance

21.1 Introduction

21.2 Data Generation

21.3 Analysis Using WinBUGS

21.4 Summary

22. Conclusions

Appendix

References

Index