Publications by Lionel Hertzog
Linear Mixed-effect Model Workflow
Linear Mixed effect Models are becoming a common statistical tool for analyzing data with a multilevel structure. I will start by introducing the concept of multilevel modeling where we will see that such models are a compromise between two extreme: complete pooling and no pooling. Then I will present a typical workflow for the analysis of multil...
9429 sym R (4204 sym/7 pcs) 14 img
Working with the Data Frame in R
Here you will learn about transforming, merging, ordering a data frame, changing the column order, removing a variable, sub setting and indexing. Transforming This means put the rows as columns and the columns as the rows, this is done very easily in one line: data(mtcars) mtcars <- t(mtcars) Merging two Data Frame Often it happen that you have ...
5926 sym R (3304 sym/11 pcs) 6 img
Correlation and Linear Regression
Before going into complex model building, looking at data relation is a sensible step to understand how your different variable interact together. Correlation look at trends shared between two variables, and regression look at causal relation between a predictor (independent variable) and a response (dependent) variable. Correlation As mentioned ...
8419 sym R (3025 sym/10 pcs) 14 img
Introduction to bootstrap with applications to mixed-effect models
Bootstrap is one of the most famous resampling technique and is very useful to get confidence intervals in situations where classical approach (t- or z- tests) would fail. What is bootstrap Instead of writing down some equations let’s directly see how one may perform bootstrap. Below we will show a simple bootstrap example using the height of 1...
6260 sym R (3226 sym/18 pcs) 10 img
Standard deviation vs Standard error
I got often asked (i.e. more than two times) by colleagues if they should plot/use the standard deviation or the standard error, here is a small post trying to clarify the meaning of these two metrics and when to use them with some R code example. Standard deviation Standard deviation is a measure of dispersion of the data from the mean. set.seed...
2585 sym R (915 sym/3 pcs) 8 img
Bringing the powers of SQL into R
One of the big flaw of R is that data loaded into it are stored in the memory (on the RAM) and not on the disk. As you are working in an analysis with large (big) data the processing time of simple and more complex functions can become very long or even crash your computer. SQL enters here, it is a powerful language designed to work with (large) ...
3352 sym R (2808 sym/6 pcs) 6 img
Bayesian regression with STAN: Part 1 normal regression
This post will introduce you to bayesian regression in R, see the reference list at the end of the post for further information concerning this very broad topic. Bayesian regression Bayesian statistics turn around the Bayes theorem, which in a regression context is the following: $$ P(theta|Data) propto P(Data|theta) times P(theta) $$ Where (thet...
7177 sym R (2913 sym/8 pcs) 14 img
Mastering R Plot – Part 1: colors, legends and lines
This is the first post of a series that will look at how to create graphics in R using the plot function from the base package. There are of course other packages to make cool graphs in R (like ggplot2 or lattice), but so far plot always gave me satisfaction. In this post we will see how to add information in basic scatterplots, how to draw a leg...
2034 sym R (2176 sym/6 pcs) 16 img
Bayesian regression with STAN Part 2: Beyond normality
In a previous post we saw how to perform bayesian regression in R using STAN for normally distributed data. In this post we will look at how to fit non-normal model in STAN using three example distributions commonly found in empirical data: negative-binomial (overdispersed poisson data), gamma (right-skewed continuous data) and beta-binomial (ove...
6928 sym R (6850 sym/8 pcs) 14 img
Mastering R plot – Part 2: Axis
This is the second part of the Mastering R plot series. The standard plot function in R allows extensive tuning of every element being plotted. There are, however, many possible ways and the standard help file are hard to grasp at the beginning. In this article we will see how to control every aspects of the axis (labels, tick marks …) in the ...
2914 sym R (2484 sym/5 pcs) 16 img