Blog Archives

Using and interpreting different contrasts in linear models in R

January 13, 2015
By
Using and interpreting different contrasts in linear models in R

When building a regression model with categorical variables with more than two levels (ie “Cold”, “Freezing”, “Warm”) R is doing internally some transformation to be able to compute regression coefficient. What R is doing is that it is turning your categorical variables into a set of contrasts, this number of contrasts is the number of

Read more »

Interpreting regression coefficient in R

November 23, 2014
By
Interpreting regression coefficient in R

Linear models are a very simple statistical techniques and is often (if not always) a useful start for more complex analysis. It is however not so straightforward to understand what the regression coefficient means even in the most simple case when there are no interactions in the model. If we are not only fishing for

Read more »

DataFrame manipulation in R from basics to dplyr

October 11, 2014
By
DataFrame manipulation in R from basics to dplyr

  In my surroundings at work I see quite a few people managing their data in spreadsheet software like Excel or Calc, these software will do the work but I usually tend to do as little data manipulation in them as possible and to turn as soon as possible my spreadsheets into csv files and

Read more »

Ploting SEMs in R using semPlot

August 10, 2014
By
Ploting SEMs in R using semPlot

This is a short post presenting the great package semPlot developed by Sacha Epskamp (check out his nice website: http://sachaepskamp.com/) to make nice plots from your SEMs. SEMs are a modelling tool that allow the researcher to investiguate complex relationships between the variables, you may find here many links to free tutorials: http://www.structuralequations.org/. Here I

Read more »

Using bootMer to do model comparison in R

July 13, 2014
By
Using bootMer to do model comparison in R

Setting the right random effect part in mixed effect models can be tricky in many applied situation. I will not talk here about choosing wether a grouping variable (sites, individuals …) should be included as a fixed term or as a random term, please see Gelman and Hill (2006) and Zuur et al (2009) for

Read more »

Regular expression and associated functions in R

June 1, 2014
By
Regular expression and associated functions in R

When working with strings regular expressions are an extremely powerful tool to look for specific patterns in the strings. In informatics a string is several characters put together, this can be words, sentences, or DNA code. Regular expression were developed for the language of Perl (http://www.perl.org/) and have been since then implemented in various other

Read more »

Importing 100 years of climate change into R

May 5, 2014
By
Importing 100 years of climate change into R

This is a flashback post, I was working on species distribution shifts over the last 40 years last summer and recently Rémi Genevest contacted me asking me how I managed to import the CRU TS 1.2 dataset into R. As always a more readable version of the code can be found here. At that time I

Read more »

Checking (G)LM model assumptions in R

April 16, 2014
By
Checking (G)LM model assumptions in R

(Generalized) Linear models make some strong assumptions concerning the data structure: Independance of each data points Correct distribution of the residuals Correct specification of the variance structure Linear relationship between the response and the linear predictor For simple lm 2-4) means that the residuals should be normally distributed, the variance should be homogenous across the

Read more »

Interpreting interaction coefficient in R (Part1 lm)

April 8, 2014
By
Interpreting interaction coefficient in R (Part1 lm)

Interaction are the funny interesting part of ecology, the most fun during data analysis is when you try to understand and to derive explanations from the estimated coefficients of your model. However you do need to know what is behind these estimate, there is a mathematical foundation between them that you need to be aware

Read more »

Generalized Linear Mixed Models in Ecology and in R

March 12, 2014
By
Generalized Linear Mixed Models in Ecology and in R

I had a nice workshop two weeks ago in Tübingen (south-germany) concerning Generalized Linear Mixed Models (GLMM) in R. The course was given by two ecologist: Dr. Pius and Fränzi Korner-Nievergelt  that spend now half of their time doing statistical consulting (http://www.oikostat.ch/navigation_engl.htm). Nice reference concerning GLMMs are: the 2009 Bolker paper (paper),  the 2007 book

Read more »