background preloader

R Graph Gallery

Multiple Regression R provides comprehensive support for multiple linear regression. The topics below are provided in order of increasing complexity. Fitting the Model # Multiple Linear Regression Example fit <- lm(y ~ x1 + x2 + x3, data=mydata) summary(fit) # show results # Other useful functions coefficients(fit) # model coefficients confint(fit, level=0.95) # CIs for model parameters fitted(fit) # predicted values residuals(fit) # residuals anova(fit) # anova table vcov(fit) # covariance matrix for model parameters influence(fit) # regression diagnostics Diagnostic Plots Diagnostic plots provide checks for heteroscedasticity, normality, and influential observerations. # diagnostic plots layout(matrix(c(1,2,3,4),2,2)) # optional 4 graphs/page plot(fit) click to view For a more comprehensive evaluation of model fit see regression diagnostics. Comparing Models You can compare nested models with the anova( ) function. Cross Validation You can assess R2 shrinkage via K-fold cross-validation. Variable Selection

distance {argosfilter Great circle distance between geographical coordinates Description Function distance calculates the distance, in km, between two geographical locations following the great circle route. Function distanceTrack calculates the distance, in km, between a sequence of locations. Usage distance(lat1, lat2, lon1, lon2) distanceTrack(lat,lon) Arguments lat1 latitude of the first location, in decimal degrees lat2 latitude of the second location, in decimal degrees lon1 longitude of the first location, in decimal degrees lon2 longitude of the second location, in decimal degrees lat vector of latitudes, in decimal degrees lon vector of longitudes, in decimal degrees Details Distances are calculated using spherical trigonometry. Values distance returns the distance between the two locations. distanceTrack returns a vector of distances between the sequence of locations. References Zwillinger D. (2003) Standard Mathematical Tables and Formulae, 31st edition. Examples

Graphical Parameters You can customize many features of your graphs (fonts, colors, axes, titles) through graphic options. One way is to specify these options in through the par( ) function. If you set parameter values here, the changes will be in effect for the rest of the session or until you change them again. The format is par(optionname=value, optionname=value, ...) # Set a graphical parameter using par() par() # view current settings opar <- par() # make a copy of current settings par(col.lab="red") # red x and y labels hist(mtcars$mpg) # create a plot with these new settings par(opar) # restore original settings A second way to specify graphical parameters is by providing the optionname=value pairs directly to a high level plotting function. # Set a graphical parameter within the plotting function hist(mtcars$mpg, col.lab="red") See the help for a specific high level plotting function (e.g. plot, hist, boxplot) to determine which graphical parameters can be set this way. Text and Symbol Size Lines Colors

High Resolution Figures in R | Daniel J. Hocking As I was recently preparing a manuscript for PLOS ONE, I realized the default resolution of R and RStudio images are insufficient for publication. PLOS ONE requires 300 ppi images in TIFF or EPS (encapsulated postscript) format. In R plots are exported at 72 ppi by default. I love RStudio but was disappointed to find that there was no options for exporting figures at high resolution. PLOS ONE has extensive instructions for scaling, compressing, and converting image files to meet their standards. Even if scaling up from a low resolution PDF would work, it would be better to have a direct solution in R. [UPDATE: In the original post, I wrote about my trial and error when first trying this out. If you need to use a font not included in R, such as the Arial family of fonts for a publisher like PLOS, the extrafont package is very useful but takes a long time to run (but should only have to run once – except maybe when you update R you’ll have to do it again). [ORIGINAL POST Follows] Like this:

The Workspace The workspace is your current R working environment and includes any user-defined objects (vectors, matrices, data frames, lists, functions). At the end of an R session, the user can save an image of the current workspace that is automatically reloaded the next time R is started. Commands are entered interactively at the R user prompt. Up and down arrow keys scroll through your command history. You will probably want to keep different projects in different physical directories. Here are some standard commands for managing your workspace. IMPORTANT NOTE FOR WINDOWS USERS: R gets confused if you use a path in your code like c:\mydocuments\myfile.txt This is because R sees "\" as an escape character. getwd() # print the current working directory - cwd ls() # list the objects in the current workspace setwd(mydirectory) # change to mydirectory setwd("c:/docs/mydir") # note / instead of \ in windows setwd("/usr/rob/mydir") # on linux q() # quit R.

Interaction plot. / Graphiques. / Aide mémoire R. Aide-memoire-R > Graphiques > Interaction-plot Objectif : on cherche à étudier comment varie une variable numérique en fonction d'un facteur pour différentes valeur d'un deuxième facteur. fr <- data.frame(fact1 = c("a", "b", "a", "b", "a", "b"), fact2 = c("A", "A", "A", "B", "B", "B"), val = c(10, 20, 12, 15, 25, 18)) interaction.plot(fr$fact1, fr$fact2, fr$val) trace un graphe d'interaction montrant la moyenne de val en fonction des valeurs de fact1, avec une courbe pour chaque valeur de fact2. Paramètres :

An Introduction to R Table of Contents This is an introduction to R (“GNU S”), a language and environment for statistical computing and graphics. R is similar to the award-winning1 S system, which was developed at Bell Laboratories by John Chambers et al. It provides a wide variety of statistical and graphical techniques (linear and nonlinear modelling, statistical tests, time series analysis, classification, clustering, ...). This manual provides information on data types, programming elements, statistical modelling and graphics. This manual is for R, version 3.1.0 (2014-04-10). Copyright © 1990 W. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies. Preface This introduction to R is derived from an original set of notes describing the S and S-PLUS environments written in 1990–2 by Bill Venables and David M. Comments and corrections are always welcome. Suggestions to the reader 1.1 The R environment Try ? | Conservation research… with bite Home Page Accueil - Especes Stronger Shark Finning Ban Endorsed by European Parliament Conservation groups are celebrating today’s European Parliament vote to close loopholes in the European Union ban on shark finning (slicing off a shark’s fins and discarding the body at sea), the culmination of six years of campaigning and debate. We owe so much of our success to the tens of thousands of divers across Europe and beyond who voiced their concern for sharks” Suzanne Pleydell, Project AWARE Director Members of the European Parliament voted overwhelmingly in favor of the European Commission’s proposal to impose the best practice for finning ban enforcement: a prohibition on removing shark fins at sea. “Parliament’s overwhelming support for strengthening the EU finning ban represents a significant victory for shark conservation in the EU and beyond,” said Ali Hood, Shark Trust Director of Conservation. Parliament’s final report now goes to the EU Council of Ministers and Commission as part of the process to finalize the regulation.

Société Française d'Écologie Species Distribution Modelling - pecies Distribution Model (SDM) can be defined as a statistical/analytical algorithm that predicts either actual or potential distribution of a species, given field observations and auxiliary maps, as well as expert knowledge. A special group of Species Distribution Models (SDMs) focuses on the so-called occurrence-only records --- pure records of locations where a species occurred (Engler at al. 2004; Tsoar et al. 2007). This article describes a computational framework to map species' distributions using occurrence-only data and environmental predictors. For this purpose, we will use the dataset "bei", distributed together with the spatstat package, and used in school books on point pattern analysis by Baddeley (2008) and many other authors. To run this script, you will need to obtain some of the following packages. For more details about this topic consider obtaining the original article: Hengl, T., Sierdsema, H., Radovic, A., Dilo, A., 2009? Preparation of maps Final predictions

The 5th Bio-logging Science Symposium - Strasbourg 22-26 Sep 2014 - Important dates - 30 Sep 2013 : Workshop submission Closed- 31 Mar 2014 : Abstract submission Closed - 20 Apr 2014: Early registration Soon! 21 Apr 2014 - : Late registration 22-27 Sep 2014 : Symposium Abstract submission Log in with your account and go to My Space > Submission. Presentations Instructions for oral presentations will follow shortly.The size of the poster board is 0.94 (width) x 2.39 (height) m. Registration fees Early (Nov 2013 - Mar 2014): Standard 320 euros / Student 190 euros Late (Apr 2014 - Jul 2014): Standard 360 euros / Student 230 euros Fees include documentation, lunches, coffee breaks, icebreaker, social event and banquet. Accompanying person: 200 euros (Fees include lunches, coffee breaks, icebreaker, social event and banquet) Please follow this link for payment. This will take you to a CNRS-secure payment system called Azur Colloques, where you will need to pre-register once more. WARNING: Exhibitors, please don't use this link to pay. Venue Organizing Committee