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 … Continue reading

## 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 … Continue reading

## 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 … Continue reading

## 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 … Continue reading

## 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. … Continue reading

## 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 … Continue reading

## 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 … Continue reading

## 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 … Continue reading

## Center for Theoretical Study, Prague: more intense than ivy league

I have recently been lucky to relocate from Yale to Center for Theoretical Study in Prague, Czech Republic. The institute brings together philosophers, mathematicians, physicists, sociologists, economists, biologists and others; it is similar to Santa Fe Institute or Princeton Institute for Advanced Study, and its aim is to stimulate interdisciplinary … Continue reading

## 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 … Continue reading

## Is my brilliant idea any good? I am not sure, so I've pre-printed it on PeerJ

As a scientist, what should I do when I encounter a seemingly fundamental problem that also seems strangely unfamiliar? Is it unfamiliar because I am up to something really new, or am I re-discovering something that has been around for centuries, and I have just missed it? This is a … Continue reading

## Tailoring univariate probability distributions

This post shows how to build a custom univariate distribution in R from scratch, so that you end up with the essential functions: a probability density function, cumulative distribution function, quantile function and random number generator. In the beginning all you need is an equation of the probability density function, … Continue reading

## A suggestion to Windows-based users of R: It may be time to relocate

Do you remember the time when you switched from graphical statistical software to R? I did it eight years ago, and I had hard time doing even a simple regression analysis without constantly searching for help, it was a pain. In desperation I frequently cheated and went back to Statistica … Continue reading

## Our results will be relevant for policy and decision-making and biodiversity management

I used to be involved in a large EU-funded collaborative project. It gave me an opportunity to do fun basic science, and also an opportunity to see the kind of lingo that is used in order to get a big EU project funded. The project promised: "Our results will be … Continue reading

## Would you save the young or the ancient species?

Yesterday I gave a seminar at John Harte's lab at UC Berkeley. It was a joy. There must be something in the lush Californian climate that makes people nice. During the discussion John Harte and Andy Rominger jointly pointed me to a problem: Imagine that you have two species. The … Continue reading

## Do 'macrosystems ecologists' know about macroecology?

Paper by Levy et al. in Frontiers in Ecology and the Environment announces emergence of a new ecological discipline called macrosystems ecology (MSE). The authors define MSE like this: MSE studies explore how broad-scale variation in fine-scale characteristics – such as organismal behavior and fitness, nutrient transformations, and water-use efficiency … Continue reading

## 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 … Continue reading

## Bayesian Biostatistics 2014

This post contains materials for Bayesian stats course that I taught between 2-4 Feb 2014 at Faculty of Science, Charles University, Prague, Czech Republic. There were around 40 participants. The complete materials and their source codes (Markdown and R) are on a GitHub repository. The lectures can also be accessed … Continue reading

## 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 … Continue reading

## Making high-resolution biodiversity maps from low-res maps

This post advertises our new Ecological Applications paper which is in press. Imagine that there would be a tool that could make hi-res images out of low-res ones, just like this: Such tool would be really useful for creating maps of things for which we only have a very crude … Continue reading