In this unit, you will become familiar with running and plotting correlations and regression in R.

Follow the links to each lecture, lab, and reading.

Scroll down to download the SWIRL lessons.

Lecture: Testing associations

Learning Goals:

- Run correlation and simple regression models,
- Interpret output,
- Extract and plot details from output.

SWIRL: Testing_Associations

Lab: Unit 4: Lab 1

Reading: Crawley, M. The R Book. Ch 10 Regression.

Functions: `ks.test()`

, `cor()`

, `lm()`

, `abline()`

, `coef()`

.

Lecture: Multiple regression

Learning Goals:

- Understand how to code different statistical relationships,
- Interpret model output and diagnose model fit.

SWIRL: Testing_Associations

Lab: Unit 4: Lab 2

Reading: Crawley, M. The R Book. Ch 12. Analysis of Covariance.

Functions: `lm()`

Lecture:

Learning Goals:

- Understand binomial and count data,
- Know how to analyse and plot these data,
- Extract, predict, and plot these data.

SWIRL:

Lab: Unit 4: Lab 3

Reading: Crawley, M. The R Book. Chs 13–17.

Functions: `glm()`

, `predict()`

, `lines()`

.

Lecture: Multivariate Data

Learning Goals:

- Understand multivariate data,
- Know how to analyse and plot multivariate data,
- Search for help on multivariate analyses.

More details:

- The vegan,
- and labdsv R packages.
- Material on ordination,
- New lectures by author of vegan.
- Manly and Alberto. 2017. Multivariate statistical methods: A primer. Fourth edition. Taylor & Francis.
- More examples here

SWIRL: Ordination

Lab: Unit 4: Recap

Functions: `pcord`

, `prcomp()`

, `princomp()`

, `pca()`

, `biplot()`

, `interp()`

.