Blog Archives

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 »

Computing R square for Generalized Linear Mixed Models in R

March 2, 2014
By
Computing R square for Generalized Linear Mixed Models in R

R square is a widely used measure of model fitness, in General Linear Models (GLM) it can be interpreted as the percent of variance in the response variable explained by the model. This measure is unitless which makes it useful to compare model between studies in meta-analysis analysis. Generalized Linear Mixed models (GLMM) are extending

Read more »

Adding color to R plot: a function

February 24, 2014
By
Adding color to R plot: a function

A friend of mine told me that she was spending her day colouring R plot because she never understood how to put color in them. This triggered a nerdy reaction in me that I had to put in a basic function. This was actually a funny exercise for two reasons: forced me to think at

Read more »

Simulating dice throws in R

December 20, 2013
By
Simulating dice throws in R

I am currently following a course on probability theory in coursera (https://www.coursera.org/course/probas) and I’ve seen some graphs concerning the outcome of some dice throws. Being an R-nerd I wrote a little function to do this in R. This is nothing fancy just I find it interesting the process of thoughts going from a real-world problem

Read more »

Manipulation of the legend in ggplot2 (R)

October 25, 2013
By
Manipulation of the legend in ggplot2 (R)

You are one click away from a post on the various way one can change the legend title in ggplot2, combine several aesthetic, remove the legend in ggplot2. http://rpubs.com/hughes/10012Filed under: R and Stat Tagged: ggplot2, R

Read more »

Non-linear regression in R

August 25, 2013
By
Non-linear regression in R

Here is the link to the article: http://rpubs.com/hughes/7812 There you will discover how to simulate and fit: power function, Michaelis-Menten equation and sigmoid curves in R, the fit is done by least-square using the ‘nls’ function.Filed under: R and Stat Tagged: NLS, R

Read more »