# Author Archives: Petr Keil

## The daunting simplicity of rhino wars

Rich people must be smart, that's why they are rich. Except when they are stupid and believe that snorting a line of rhino horn powder gives them a better boner than biting off their own fingernails. Or when they, instead of showing off with something fun to drive, choose to own a rhino horn. The… Read More »

## Bayesian ANOVA: Powerful inference with within-group sample size of 1

1 Objective 2 The data 3 Fixed-effects ANOVA in JAGS 4 Relaxing the assumption of constant variance 5 Conclusion This post is inspired by a question by Dylan Craven that he raised during my Bayesian stats course. 1 Objective My aim here is to demonstrate that, in Bayesian setting, one can make powerful inference about… Read More »

## Introduction to maximum likelihood and Bayesian statistics for ecologists (1-3 March 2017, iDiv)

The course is full. Here is syllabus with instructions. Complete raw codes (Markdown and R) and materials see the course's GitHub repository. DAY 1 Introduction: Course contents, pros and cons of Bayes, necessary skills. Normal distribution: Introducing likelihood on the Normal example. Poisson distribution: Likelihood maximization. Probability mass function. AIC and deviance. The Bayesian way… Read More »

## Science is better than facts

Facts have recently been all over the place. With the Trump thing and the political arguments about climate change, evolution, inauguration crowd sizes, and funding of science, perhaps it is the time to have a closer look at what facts are (see also this post). My take: Science rarely works with facts. Surprisingly, the term… Read More »

## IBS 2017: Weak case for experimental macroecology, dynamic macroecology on the rise, and the problem of process vs mechanism

I’ve returned from IBS meeting in Tucson. Here are my thoughts on experimental and dynamic macroecology, the two big issues discussed this year: Experimental macroecology needs better justification One entire morning was dedicated to experimental macroecology. Presented were results from small-grain manipulative experiments, sometimes replicated over large extents, sometimes not. However, it all felt like a… Read More »

## Will future generations be able to read our e-papers and use our e-data?

In the attic of my grandmother's house there is a box with my old personal stuff. Inside there is a smaller box with a bunch of 3.5 floppy disks. One of them has a fading handwritten label "Bachelor thesis - data". To get to the data I could use the 3.5 drive in a 90's… Read More »

## Reproducible art with R

This is my tribute to the fantastic R package spatstat. All the artwork was 100% done in R, the source code is here. Click the images for hi-res (6000 x 4000) versions. License: This is a public domain work. Feel free to do absolutely whatever you want with the code or the images, there are… Read More »

## Logarithmic axes with linear gridlines in basic R plots

I like Mathematica’s and Matlab’s log-log plots with logarithmic axes and linear tickmarks (and gridlines). In a way, they enable to imagine both multiplication and addition in a single figure. They also enable to more exactly visually connect data points with values. I haven’t found a simple ‘one-liner’ that’d do such plots in R. In… Read More »

## Big-data spatio-temporal analyses using open source GIS software (29 June - 1 July, iDiv, Leipzig)

The course is full. We are organizing a 3 day intensive course on open-source GIS high-performance analytical methods, with Giuseppe Amatulli (Yale University) as the main teacher, and Petr Keil (iDiv) as a teaching assistant. Date and place: 29 June - 1 July 2016, 'Red Queen' room, iDiv, Leipzig, Germany. Summary Over the past decade… Read More »

## Is natural history more fundamental than statistics?

A couple of weeks ago at iDiv I had an exchange with Jonathan Chase about the importance of natural history, and whether it is more fundamental than statistics. Jon was arguing for fundamental importance of natural history, I disagreed. To quote Jon quoting Evelyn Hutchinson: A quote Hutchinson wrote in 1975 about the importance of… Read More »

## Bayesian Biostatistics, 25-27 Jan 2016, iDiv, Leipzig, Germany

## 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 »

## On soil larvae, Beverly Hills, passion, macroecology, and the problem of describing what I do

I have always found it difficult to explain my profession to people. For my bachelor degree I studied larvae of inconspicuous flies (Insecta: Diptera: Therevidae) in soils of remote forests of central Europe. About five people around the world have ever heard of these flies, but I did not care as I was passionately in… Read More »

## Light diversity: obscuring the observed species

Yesterday during an iDiv seminar we stumbled across dark diversity. For those unfamiliar with the concept, it has been defined by Pärtel et al. (2011) : It is possible to specify species that belong to a particular species pool but that are not locally present. We call this unaccounted set of species ‘dark diversity’. So… Read More »

## What did Novak Djokovic really smell?

As reported by BBC, men’s tennis World number one Novak Djokovic complained to the umpire that he could smell cannabis on court during his Rogers Cup win over Jeremy Chardy. After winning the first set, the Serb approached the chair, saying: “Someone is smoking weed, I can smell it, I’m getting dizzy.” And later: “You… Read More »

## 2015 Pulitzer prize awarded to book on conservation biogeography: The Sixth Extinction by Elisabeth Kolbert reviewed

Elisabeth Kolbert: The Sixth Extinction. Published on Feb 2014 by Henry Holt & Co., New York. The 2015 Pulitzer prize in the General Nonfiction category (awarded on May 28) went to Elisabeth Kolbert for her book on science of extinction, which also happens to be an intro to conservation biogeography. The book has a wide… Read More »

## Typesetting beautiful conference posters with Tickzposter

To make a conference poster you probably use some vector editor: Inkscape, Adobe Illustrator, CorelDraw, or maybe LibreOffice Draw, Impress or MS PowerPoint. But you can also code it, and by that I mean using some markup language to actually write how the poster should look like, and then compile the code. Sounds insane at… Read More »

## Math vs. language, extinctions vs. climate change

Two unrelated insights that I’ve recently had: Math isn’t more abstract than language, it’s just exact The reason is that mathematical notation is part of the same language that we speak, and any mathematical formula is, in fact, a written (or spoken) sentence. Example: Which is equivalent to: The value of function F at x… Read More »

## Do ecological journals accept LaTeX and open document formats?

Last week I started to draft a manuscript that is heavy on the computation side and it uses large data. This requires everything to be well documented and organized, otherwise I get lost in my own code. The real challenge is then to confront my analyses with the co-authors and, ultimately, journal referees -- a… 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 »

## The age of Postdoc: towards liberation of academic middle class

Nature has an article about the daunting prospects for current postdocs in some countries (Nature 520, 144-147). The article is stimulating but reports only a few relatively ad-hoc ways to fix the situation. In the discussion below the article Peter Jurica mentions postdocs as middle class (of academia). I think that this simple analogy can… Read More »

## Simple template for scientific manuscripts in R markdown

I've made a really simple template for the classical manuscript format for R markdown and knitr. Here are the resulting .pdf and .html. The template contains the four usual components of any scientific manuscript: equations (using LaTeX syntax) table with caption (done by kable package, but you can also use xtable) figure with caption citations… Read More »

## GAM splines now easy in JAGS and OpenBUGS. An example on 2D spatial data

Last week I met Simon Wood, creator of mgcv package, which is THE tool for fitting Generalized Additive Models (GAM) in R. Simon brought my attention to function jagam which he has just added to mgcv. The function allows to transform the ‘spline’ or ‘smooth’ component of GAM model formula into BUGS code, meaning that… Read More »

## 12 nifty tips for scientists who use computers

Simple things are good. Here is a list of 12 things that I find simple and useful, yet not many of my colleagues use them. The list is R-biased. Knitr. Intuitive tool to integrate R and text to make reports with fancy fonts, figures, syntax-highlighted R code and equations. If you use R studio, then… Read More »

## Bayesian Biostatistics 2015

Authors: Petr Keil, Jan Smyčka This post contains materials for Bayesian stats course (2-4 Feb 2015 at Faculty of Science, Charles University, Prague, Czech Republic). The complete materials and their source codes (Markdown and R) are on my GitHub repository. The lectures can also be accessed directly as follows: DAY 1 Introduction: Course contents, pros… Read More »

## Bayesian PCA

Authors: Jan Smycka, Petr Keil This post introduces experimental R package bPCA which we developed with Jan Smycka, who actually came with the idea. We do not guarantee the very idea to be correct and there certainly are bugs – we invite anyone to show us wrong, or to contribute. Rationale of bPCA Here is… Read More »

## The cathedral, the bazaar, and the SNAFU principle

I've recently been exploring foundational ideas of Free and Open-Source Software (FOSS) culture, and I've found them relevant not only for software development, but also for academia. Here is something that I picked up for inspiration: If you have no idea who Richard Stallman is, I recommend his TEDx talk on Free software, free society.… Read More »

## On Theory in Ecology – Reading Marquet et al. (2014)

Marquet et al. have essay in Bioscience entitled “On theory in ecology”, with the main message being we need more good theory; I agree 100%. The paper also presents an overview of important ecological theories and some good points about why theory is important. Notable one: “Theory, etymologically, comes from the ancient Greek theoria, which… Read More »

## The man in the academic arena

Lately I went through a couple of ordinary academic failures. I had one manuscript rejected in three statistical journals in a row. I had another one rejected in Science, PNAS and PLoS Biology in a prompt sequence. Interestingly, among all of the six submissions only Science actually sent it out for review (and then rejected).… Read More »