Articles by Lionel Hertzog

R as GIS, part 1: vector

November 4, 2020 | Lionel Hertzog

Are you interested in guest posting? Publish at DataScience+ via your RStudio editor. Category Data Management Tags Data Visualisation Maps R Programming Tips & Tricks Working with spatial data is becoming more and more frequent with the development of geoportals providing free access to large number of spatial datasets. Geographic Information ...
[Read more...]

Spatial regression in R part 2: INLA

June 24, 2020 | Lionel Hertzog

Are you interested in guest posting? Publish at DataScience+ via your RStudio editor. Category Advanced Modeling Tags Data Visualisation R Programming spatial Ten months after part 1 of spatial regression in R (oh my gosh where did these months go?), here is a (hopefully long-awaited) second part this time using INLA, ...
[Read more...]

Spatial regression in R part 1: spaMM vs glmmTMB

September 2, 2019 | Lionel Hertzog

Are you interested in guest posting? Publish at DataScience+ via your editor (i.e., RStudio). Category Advanced Modeling Tags Data Visualisation GLMM Logistic Regression R Programming spatial model Many datasets these days are collected at different locations over space which may generate spatial dependence. Spatial dependence (observation close together are ...
[Read more...]

K-fold cross-validation in Stan

July 30, 2018 | Lionel Hertzog

Comparing multiple models is one of the core but also one of the trickiest element of data analysis. Under a Bayesian framework the loo package in R allows you to derive (among other things) leave-one-out cross-validation metrics to compare the predictive abilities of different models. Cross-validation is basically: (i) separating ... [Read more...]

Mastering R plot – Part 3: Outer margins

March 5, 2016 | Lionel Hertzog

This is the third post in our series Mastering R Plot, in this one we will cover the outer margins. To know more about plot customization read my first and second post. Let’s directly dive into some code: #a plot has inner and outer margins #by default there is ... [Read more...]

First steps with Non-Linear Regression in R

February 25, 2016 | Lionel Hertzog

Drawing a line through a cloud of point (ie doing a linear regression) is the most basic analysis one may do. It is sometime fitting well to the data, but in some (many) situations, the relationships between variables are not linear. In this case one may follow three different ways: (... [Read more...]

Mastering R plot – Part 2: Axis

February 6, 2016 | Lionel Hertzog

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 ... [Read more...]

Bayesian regression with STAN Part 2: Beyond normality

January 26, 2016 | Lionel Hertzog

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) ... [Read more...]

Bayesian regression with STAN: Part 1 normal regression

January 8, 2016 | Lionel Hertzog

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(... [Read more...]

Bringing the powers of SQL into R

December 11, 2015 | Lionel Hertzog

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 ...
[Read more...]

Standard deviation vs Standard error

December 4, 2015 | Lionel Hertzog

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 ... [Read more...]

Correlation and Linear Regression

November 14, 2015 | Lionel Hertzog

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 above ... [Read more...]

Working with the Data Frame in R

November 2, 2015 | Lionel Hertzog

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
[Read more...]

Linear Mixed-effect Model Workflow

October 16, 2015 | Lionel Hertzog

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 ... [Read more...]

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)