Contents

R helper functions

Simple functions and wrappers to help students with basic R tasks.

binom.CI(): Calculates Wilson’s (1927) confidence interval for a binomial proportion.

plot.means(): Makes basic, annotated plots of means w/ approximate 95% confidence intervals from user-supplied standard errors or confidence intervals

plotTukeysHSD(): makes basic, annotated plot of output of R’s TukeyHSD function (but prettier, IMHO)

R Tutorials: Basic Topics

Code demonstrating basic R tasks.

Loading (messy) data into R: Outline for some tricks to get your data into R.

Plotting means w/ errbar(): making plots with the errbar() function in the Hmisc package

Creating factors/categorical variables: one of the most annoying things in R…

Why isn’t t-apply() working?

Paired t-test walk through (sorry, data not provided).

Paired t-tests: 2 equivalent ways. two ways to do a paired t-test w/ different syntax or data formatting.

Basic R analysis tasks: General walk through of math, summary(), and basic plots.

Standard error for the difference between 2 means: functions for pooled variance and SE of difference, for calculating t-statistics

R Tutorials: More Advanced

Reshaping data: outline of notes on basic data re-shaping

ggplot::stat_summary()

Webcasts:

General R Tasks:

Common problems and headaches: how to get things working again when R and RStudio seem broken (also on YouTube)

Explanation (also on YouTube)
Example 

Doing Stats in R:

Introduction to ANOVA Part 1 (Lab 9): Summary statistics.

Introduction to ANOVA Part 2 (Lab 9): ANOVA

Handouts

R Handouts interpretting_leverage_handout

Double-sided summaries of important R tasks, functions, and output

data.frame setup

Adding a new column to a R dataframe

Anatomy_of_an_r_function

pairwise.t.test()

subset()

tapply()

t.test()

TukeyHSD()

Interpreting leverage & cooks distance plots

Visual Walk-throughs

Slides demonstrating basic R tasks.

Downloading R & Rstudio: Windows

Downloading R & RStudio: Mac

Loading R packages

Dude, where’d RStudio’s script editor go?

t.test() walk-through

Flow chartsflowchart_types_of_analyses

Loading data into R

Exploring grouped data

Types of statistical models

One-way ANOVA (assumes alpha = 0.05)

R labs:

From CalU of PA ENS 495: Design & Analysis, Fall 2016

Lab 1: Intro to R.  Intro to R, plotting eagle populations, etc

Lab 2a: Displaying Data: boxplot() and hist()

Lab 2b: Displaying Data: plotting means

Lab 3a: Basic math for stats in R: mean, variance, standard deviation, standard error

Lab 4: Working with grouped data: using subset() and tapply(), plotting group means, etc

Lab 5: Intro to t-tests in R.

Lab 6a: Basic data plotting review.

Lab 6b: In class plotting exercise.

Lab 7: t-tests.  1-sample, 2-sample, paired

Lab 8: transformations.

Lab 9a: ANOVA.  1-way ANOVA to investigate impacts of diet on deer antler growth.  See the videos Part 1 and Part 2.

Lab 9b: data.  Deer antler datasets for 1-way ANVOA

Lab 10: Regression example

Lab 11a: More regression: Linear regression

Lab 11b: More regression: logistic regression

Lab 11c: More regression: multiple regression

Lab 12: Regression Diagnostics.  qqplots, leverage and Cook’s distance, etc.

Independent Project:

Sample content in RPubs of final paper: Sample content for a complete term paper

Code for Lectures:

Final Lecture a: Reporting results of 1-way ANOVA for independent project

Final Lecture b: 2-way ANOVA

Misc examples:

Loading R Code By hand (see the video)

How R works with strings of numbers: or always put numbers in “c(…)”!

Impact of sample size on precision.

Whitlock & Shulter’s Biological Data Analysis

Worked examples from Analysis of Biological Data, 2nd ed.

Chapter 12: Comparing 2 Means

Chapter 12: Question 18 2 sample t-test example

Chapter 12: Question 20 Paired t-test example

%d bloggers like this: