# Alejandro Buren & Paul Regular Introduction to BIOL 7220 September 2012.

## Presentation on theme: "Alejandro Buren & Paul Regular Introduction to BIOL 7220 September 2012."— Presentation transcript:

Alejandro Buren & Paul Regular Introduction to BIOL 7220 September 2012

What to expect from this workshop Intro to R Data summaries Create plots Run General linear models Easily extensible to glm, gam, glmm, gamm – BUT you have to know what you’re doing

What NOT to expect from this workshop A course in statistics A showcase of R’s capabilities

What is R? Environment and language for – Statistics – Graphics – Etc. Open source

Why use R? It’s FREE! Flexible One stop shop Large up-front cost, but BIG payoff Growing number of users Expansive!

Download & Install Program – R & Tinn-R installed? Packages – Required to use statistical and graphical packages not included in the base package – Install once – Load each new session

Vectors R has symbolic vectors which can be assigned values The traditional way to do this in R is the ’<-’ operator Possible vector names flexible – Vector names cannot start with a digit – Names are case-sensitive – Some common names are already used by R c, q, t, C, D, F, I, T,

Functions MANY built in functions – log() – exp() – sin() – sqrt() – mean() – max() – Etc.

Data Types Vectors (Numeric, Character, Logical) Matrix – All columns in a matrix must have same mode Array – N-dimensional matrix Dataframe – Columns in a data frame can have different modes. Similar to SAS and SPSS datasets Lists – Collection of objects, can be different modes and dimensions Factor

Data Management Import & Export Useful functions – subset – na.omit – cbind, rbind – sort – summaryBy – Operate over dataframe – Random numbers

Good Practice Set up a working directory Comment on each line of code Avoid attach function Define parameters in first lines of code Use standard format use.dots, OrCapitals, avoid spaces anywhere Clean up

Statistics & Graphics Working example – Look at data – Graph data – Run one regression and one ANOVA

HELP! Useful websites – Official site (http://www.r-project.org/)http://www.r-project.org/ Manuals found on this site (http://cran.r-project.org/manuals.html)http://cran.r-project.org/manuals.html – R search site (http://finzi.psych.upenn.edu/search.html)http://finzi.psych.upenn.edu/search.html – Quick-R (http://www.statmethods.net/index.html)http://www.statmethods.net/index.html – R graphics gallery (http://addictedtor.free.fr/graphiques/)http://addictedtor.free.fr/graphiques/ Books – The R Book – Etc. List serve ?function

Useful Packages...for us Statistical – VEGAN – lme4 – gam – nnet – Rcmdr Graphical – lattice – Rcmdr – gplots Data management – RODBC – doBy – reshape

Possibilities... Customized graphics... Complex statistics...

t-test ANOVA Simple Linear Regression Multiple Linear Regression ANCOVA GENERAL LINEAR MODELS ε ~ Normal R: lm()

t-test ANOVA Simple Linear Regression Multiple Linear Regression ANCOVA Poisson Binomial Negative Binomial Gamma Multinomial GENERALIZED LINEAR MODELS Inverse Gaussian Exponential GENERAL LINEAR MODELS ε ~ Normal Linear combination of parameters R: lm() R: glm()

t-test ANOVA Simple Linear Regression Multiple Linear Regression ANCOVA Poisson Binomial Negative Binomial Gamma Multinomial GENERALIZED LINEAR MODELS Inverse Gaussian Exponential Non-linear effect of covariates GENERALIZED ADDITIVE MODELS GENERAL LINEAR MODELS ε ~ Normal Linear combination of parameters R: lm() R: glm() R: gam()

Fixed effects modelRandom effects model

Similar presentations