oikostat GmbH

Content Products Team Projects Publications Partners About us Contact Home

page of the book

Bayesian Data Analysis in Ecology Using Linear Models with R, BUGS and Stan

Fränzi Korner-Nievergelt, Tobias Roth, Stefanie von Felten, Jérôme Guélat, Bettina Almasi, Pius Korner-Nievergelt

Elsevier, New York, 2015

Bayesian Data Analysis in Ecology Using Linear Models with R, BUGS and Stan


Here, we provide the full R, BUGS, and Stan code plus additional information. We cannot provide the full book, please, buy it here.

All data files and some additional functions are published in the R-package blmeco on CRAN.

 

Chapter 2: Prerequisites and Vocabulary

R-code
Exercises
Solutions to the exercises

Chapter 3: The Bayesian and the Frequentist Ways of Analyzing Data

R-code

Chapter 4: Normal Linear Models

R-code
Exercises
Solutions to the exercises

Chapter 5: Likelihood

R-code

Chapter 6: Assessing Model Assumptions

R-code

Chapter 7: Linear Mixed Effects Models

R-code
Exercises
Some solutions to the exercises

Chapter 8: Generalized Linear Models

R-code
Exercises

Chapter 9: Generalized Linear Mixed Models

R-code
Exercises
Solutions to exercises

Chapter 10: Posterior Predictive Model Checking and Proportion of Explained Variance

R-code predictive model checking
R-code explained variance

Chapter 11: Model Selection and Multimodel Inference

R-code

Chapter 12: Markov Chain Monte Carlo Simulation

R-code introduction OpenBUGS

     BUGS file: normlinreg.txt

R-code introduction Stan

     Stan file: linreg.stan

Chapter 13: Modeling Spatial Data Using GLMM

R-code

     BUGS file: SpatialExp.txt 

Chapter 14: Advanced Ecological Models

R-code Hierarchical multinomial model to analyze habitat selection using BUGS

     BUGS file:  siteselection.txt

R-code Zero-Inflated Poisson mixed model for analyzing breeding success using Stan

      Stan file:  zeroinfl.stan

R-code Occupancy model to measure species distribution using Stan

      Stan file: occupancy.stan

R-code Territory occupancy model to estimate survival using BUGS

     BUGS file:  territoryoccupancy.txt

R-code Analyzing survival based on mark-recapture data using Stan

     Stan file:  CJS_swallows.stan

Chapter 15: Prior Influence and Parameter Estimability

R-code

     BUGS files:

normlinreg_folded_t.txt

     Stan files:

linreg.stancauchyprior.txt

linreg.stangammaprior.txt

linreg.stanpriorinfluence.txt

linreg.stanpriorinflusigma.txt

linreg.stanunifprior.txt

zeroinflcauchy.stan

zeroinflgamma.stan

zeroinflhalft.stan

zeroinfluniform.stan