# Category Archives: Bayesian statistics

## Kéry & Royle have a new book on hierarchical modeling in ecology. It's good

Marc Kéry's books are as important for learning (and teaching) hierarchical modeling as Crawley's The R Book is for learning R. I hold Kéry's Introduction to WinBUGS high for the uncompromising didactic clarity. J. Andrew Royle is one of the founding minds (with James Nichols and Darryl MacKenzie) of the so called occupancy modeling, and… Read More »

## Survival analysis: basic terms, the exponential model, censoring, examples in R and JAGS

I have put together some basic material on survival analysis. It is available as: .html document with highlighted syntax here. Printer-ready .pdf document here. GitHub repository with all the source files here. Main motivation was that I wanted to learn the basics myself; also, it's tricky to find simple examples of survival models fitted in… Read More »

## Species Distribution Models on the right track. Finally.

Species Distribution Models (SDM) a.k.a. Niche Models have always been a busy pile of confusion, ideology and misguided practices, with the real mess being the “presence only” SDMs. Interestingly, when you go to conservation or biogeography symposiums, you can hear the established SDM gurus starting their talks with: “During the last ten years SDMs have… Read More »

## Spatial autocorrelation of errors in JAGS

In the core of kriging, Generalized-Least Squares (GLS) and geostatistics lies the multivariate normal (MVN) distribution – a generalization of normal distribution to two or more dimensions, with the option of having non-independent variances (i.e. autocorrelation). In this post I will show: (i) how to use exponential decay and the multivariate normal distribution to simulate… Read More »

## Poisson regression fitted by glm(), maximum likelihood, and MCMC

The goal of this post is to demonstrate how a simple statistical model (Poisson log-linear regression) can be fitted using three different approaches. I want to demonstrate that both frequentists and Bayesians use the same models, and that it is the fitting procedure and the inference that differs. This is also for those who understand… Read More »

## The joy and martyrdom of trying to be a Bayesian

Some of my fellow scientists have it easy. They use predefined methods like linear regression and ANOVA to test simple hypotheses; they live in the innocent world of bivariate plots and lm(). Sometimes they notice that the data have odd histograms and they use glm(). The more educated ones use generalized linear mixed effect models.… Read More »

## Direct support for hypotheses is finding its way to high-profile journals

In this week's Nature paper, Tingley & Huybers report that recent temperature extremes at high northern latitudes are unprecedented in the past 600 years. Besides the scientific relevance (which I do not discuss here) it has one remarkable methodological aspect: it uses hierarchical Bayesian modelling. Moreover, what is really exciting is the way the authors… Read More »

## Predictors, responses and residuals: What really needs to be normally distributed?

Introduction Many scientists are concerned about normality or non-normality of variables in statistical analyses. The following and similar sentiments are often expressed, published or taught: "If you want to do statistics, then everything needs to be normally distributed." "We normalized our data in order to meet the assumption of normality." "We log-transformed our data as… Read More »

## Data-driven science is a failure of imagination

Professor Hans Rosling certainly is a remarkable figure. I recommend watching his performances. Especially the BBC's "Joy of Stats" is exemplary. Rosling sells passion for data, visual clarity and great deal of comedy. He represents the data-driven paradigm in science. What is it? And is it as exciting and promising as the documentary suggests? Data-driven scientists… Read More »

## Downscaling species distributions using multi-scale logistic model

These are teaching materials to demonstrate how a simple Species Distribution Model can be made multi-scale. We published the methods presented here in the following paper: Keil et al. in Methods in Ecology and Evolution. This post is not entirely self-explanatory, it is going to be used during a lab seminar. Figure 1 Graphic representation… Read More »

## The simplest Species Distribution Model in OpenBUGS & R

This post demonstrates the simplest Species Distribution Model based on logistic regression for presence/absence data. I heavily simplified the example from Kéry (2010): Introduction to WinBUGS for Ecologists, Chapter 20.

## Large datasets in OpenBUGS: Buffer overflow?

I recently made an attempt to run MCMC sampling in OpenBUGS using a large dataset and a spatially explicit occupancy model. Here I report some potentially interesting speed and memory issues that I noticed. Model and Data I won't go into technical details of my model as it is not the main focus of this… Read More »

## Using R for parallelizing OpenBUGS on a single Windows PC

It seems that most of the R-parallelizing business takes place on Linux clusters. And it makes sense. Why would you want to paralellize R on just a few processors (2 or 4) of a Windows laptop PC when the whole thing would be only 2-4x faster. This used to be evident from the selection of… Read More »

## Linear regression in OpenBUGS

I always wondered why is it so difficult to find an OpenBUGS example of simple linear regression on the Web. Curiously, such example is even missing in the OpenBUGS help. The only nice example so far is in the book by Marc Kéry. I have simplified the code. You need to have OpenBUGS (or WinBUGS)… Read More »