Blog Archives

Plotting spatial neighbors in ggmap

June 15, 2015
By
Plotting spatial neighbors in ggmap

The R package spdep has great utilities to define spatial neighbors (e.g. dnearneigh, knearneigh, with a nice vignette to boot), but the plotting functionality is aimed at base graphics. If you’re hoping to plot spatial neighborhoods as line segments in ggplot2, or ggmap, you’ll need the neighborhood data to be stored in a data frame. So, to...

Read more »

Why I think twice before editing plots in Powerpoint, Illustrator, Inkscape, etc.

February 26, 2015
By
Why I think twice before editing plots in Powerpoint, Illustrator, Inkscape, etc.

Thanks to a nice post by Meghan Duffy on the Dynamic Ecology blog (How do you make figures?), we have some empirical evidence that many figures made in R by ecologists are secondarily edited in other programs including MS Powerpoint, Adobe Illustrator, Inkscape, and Photoshop. This may not be advisable* for two reasons: reproducibility and bonus learning. Reproducibility R...

Read more »

Why I think twice before editing plots in Powerpoint, Illustrator, Inkscape, etc.

February 26, 2015
By
Why I think twice before editing plots in Powerpoint, Illustrator, Inkscape, etc.

Thanks to a nice post by Meghan Duffy on the Dynamic Ecology blog (How do you make figures?), we have some empirical evidence that many figures made in R by ecologists are secondarily edited in other programs including MS Powerpoint, Adobe Illustrator, Inkscape, and Photoshop. This may not be advisable* for two reasons: reproducibility and bonus learning. Reproducibility R is nice...

Read more »

Visualizing bivariate shrinkage

January 20, 2015
By
Visualizing bivariate shrinkage

Inspired by this post about visualizing shrinkage on Coppelia, and this thread about visualizing mixed models on Stack Exchange, I started thinking about how to visualize shrinkage in more than one dimension. One might find themselves in this situation with a varying slope, varying intercept hierarichical (mixed effects) model, a model with two varying intercepts, etc. Then...

Read more »

Visualizing bivariate shrinkage

January 20, 2015
By
Visualizing bivariate shrinkage

Inspired by this post about visualizing shrinkage on Coppelia, and this thread about visualizing mixed models on Stack Exchange, I started thinking about how to visualize shrinkage in more than one dimension. One might find themselves in this situation with a varying slope, varying intercept hierarichical (mixed effects) model, a model with two varying intercepts, etc. Then...

Read more »

Notes on shrinkage & prediction in hierarchical models

December 13, 2014
By
Notes on shrinkage & prediction in hierarchical models

Ecologists increasingly use mixed effects models, where some intercepts or slopes are fixed, and others are random (or varying). Often, confusion exists around whether and when to use fixed vs. random intercepts/slopes, which is understandable given their multiple definitions. In an attempt to help clarify the utility of varying intercept models (and more generally, hierarchical modeling), specifically in...

Read more »

Notes on shrinkage & prediction in hierarchical models

December 13, 2014
By
Notes on shrinkage & prediction in hierarchical models

Ecologists increasingly use mixed effects models, where some intercepts or slopes are fixed, and others are random (or varying). Often, confusion exists around whether and when to use fixed vs. random intercepts/slopes, which is understandable given their multiple definitions. In an attempt to help clarify the utility of varying intercept models (and more generally, hierarchical modeling), specifically in terms of...

Read more »

Dynamic occupancy models in Stan

November 14, 2014
By
Dynamic occupancy models in Stan

Occupancy modeling is possible in Stan as shown here, despite the lack of support for integer parameters. In many Bayesian applications of occupancy modeling, the true occupancy states (0 or 1) are directly modeled, but this can be avoided by marginalizing out the true occupancy state. The Stan manual (pg. 96) gives an example of this kind...

Read more »

Dynamic occupancy models in Stan

November 14, 2014
By
Dynamic occupancy models in Stan

Occupancy modeling is possible in Stan as shown here, despite the lack of support for integer parameters. In many Bayesian applications of occupancy modeling, the true occupancy states (0 or 1) are directly modeled, but this can be avoided by marginalizing out the true occupancy state. The Stan manual (pg. 96) gives an example of this kind of marginalization...

Read more »

Spatial data extraction around buffered points in R

November 8, 2014
By

Quantifying spatial data (e.g. land cover) around points can be done in a variety of ways, some of which require considerable amounts of patience, clicking around, and/or cash for a license. Here’s a bit of code that I cobbled together to quickly extract land cover data from the National Land Cover Database for buffered regions around points (e.g....

Read more »