Network showing how various research topics are connected in the Psychonomic Society’s Journals.

Data Science and Statistics Tutorials

How to arrange ggplot2 panel plots

Panel plots are a common name for figures showing every person’s (or whatever your sampling unit is) data in their own little panel. This plot is sometimes also known as “small multiples”, although that more commonly refers to plots that illustrate interactions. Here, I’ll illustrate how to add information to a panel plot by arranging the panels according to some meaningful value. Here’s an example of a panel plot, using the sleepstudy data set from the lme4 package.

Meta-analysis is a special case of Bayesian multilevel modeling

Introduction Hello everybody! Recently, there’s been a lot of talk about meta-analysis, and here I would just like to quickly show that Bayesian multilevel modeling nicely takes care of your meta-analysis needs, and that it is easy to do in R with the rstan and brms packages. As you’ll see, meta-analysis is a special case of Bayesian multilevel modeling when you are unable or unwilling to put a prior distribution on the meta-analytic effect size estimate.

GitHub-style waffle plots in R

In this post, I’ll show how to create GitHub style “waffle” plot in R with the ggplot2 plotting package. Simulate activity data First, I’ll create a data frame for the simulated data, initializing the data types: library(dplyr) d <- data_frame( date = as.Date(1:813, origin = "2014-01-01"), year = format(date, "%Y"), week = as.integer(format(date, "%W")) + 1, # Week starts at 1 day = factor(weekdays(date, T), levels = rev(c("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"))), hours = 0) And then simulate hours worked for each date.

Plots with subplots in R

Visualizations are great for learning from data, and communicating the results of a statistical investigation. In this post, I illustrate how to create small multiples from data using R and ggplot2. Small multiples display the same basic plot for many different groups simultaneously. For example, a data set might consist of a X ~ Y correlation measured simultaneously in many countries; small multiples display each country’s correlation in its own panel.

Multilevel Confidence

In this post, I address the following problem: How to obtain regression lines and their associated confidence intervals at the average and individual-specific levels, in a two-level multilevel linear regression. Background Visualization is perhaps the most effective way of communicating the results of a statistical model. For regression models, two figures are commonly used: The coefficient plot shows the coefficients of a model graphically, and can be used to replace or augment a model summary table.