### An Introduction to R

##### Topics
• History of R
• Relation to other languages and statistics software
• Installing R and RStudio
• Panels: Source, Console, Environment/History, Other Views
• Setting the working directory
• Setting up R projects
• Saving workspaces
• R Basics
• Using R interactively
• Variables and assignment
• Packages
• R objects
• Object types - Vectors and functions
• Classes and attributes of objects
• Scripting
• Setting up GitHub
• Interfacing between R and GitHub
##### {swirl} Tutorials
• R Programming
The Book of R
• Chapter 1 - Getting Started
• Chapter 2 - Numerics, Arithmetic, Assignment, and Vectors
R in Action
• Chapter 1 - Getting Started
• Chapter 2 - Creating a Dataset
Statistics: An Introduction Using R
• Chapter 1 - Fundamentals
R Programming for Data Science
• Chapter 3 - History and Overview of R
• Chapter 5 - R Nuts and Bolts
Statistics: An Introduction Using R
• Appendix: Essentials of the R Language

### Week 02 (2021-09-10)

Homework 1 assigned - DUE 5pm 2021-09-16

### Data Science Preliminaries

#### Topics

• Good programming practices
• Version control
• The Tao of text
• Reproducible research using Rmarkdown and {knitr}
• Working with data
• More object types - arrays, matrices, lists, and data frames
• Subsetting and filtering data structures
• Factors
• Class coercion and conversion
• Special data values - NA, NaN, Inf
• Getting data in and out of R
• From csv files - {readr}
• From Excel - {readxl}, {XLConnect} and others
• From Dropbox - {rdrop2}
• From other repositories - {curl}
• From databases - {RMySQL}, {RSQLite}, {RPostgreSQL} and others
• Summarizing data and exploratory data analysis
• Basic descriptive statistics
• Simple plotting (boxplots, histograms, scatterplots) - {ggplot2} and others

#### {swirl} Tutorials

• Getting and Cleaning Data:
1. Manipulating Data with {dplyr}
2. Grouping and Chaining with {dplyr}
3. Tidying Data with {tidyr}

The Book of R
• Chapter 3 - Matrices and Arrays
• Chapter 5 - Lists and Data Frames
R in Action
• Chapter 3 - Getting Started with Graphs
• Chapter 4 - Basic Data Management
R Programming for Data Science
• Chapter 6 - Getting Data In and Out of R
• Chapter 7 - Using the {readr} Package

The Book of R
• Chapter 4 - Non-Numeric Values
• Chapter 6 - Special Values, Classes, and Coercion
• Chapter 8 - Reading and Writing Files
R Programming for Data Science
• Chapter 9 - Interfaces to the Outside World

### Week 03 (2021-09-17)

Homework 2 assigned - DUE 5pm 2021-09-30

### Statistics Fundamentals - Exploratory Data Analysis, Central Tendency, and Variance

#### Topics

• Populations and samples
• More on summarizing data
• Percentiles, quantiles, confidence intervals
• Basic visualization techniques for exploratory data analysis
• Box plots
• Histograms
• Beginning R programming
• Functions
• Loops
• Conditional statements and flow control

#### {swirl} Tutorials

• Getting and Cleaning Data (all exercises)

The Book of R
• Chapter 9 - Calling Functions
• Chapter 10 - Conditions and Loops
• Chapter 11 - Writing Functions
R in Action
• Chapter 5 - Advanced Data Management
• Chapter 6 - Basic Graphs
• Chapter 7 - Basic Statistics
• 7.1 Descriptive Statistics
• 7.2 Frequency and Contingency Tables
Statistics: An Introduction Using R
• Chapter 3 - Central Tendency
• Chapter 4 - Variance

The Book of R
• Chapter 13 - Elementary Statistics
• Chapter 14 - Basic Data Visualization

### Statistics Fundamentals - Probability and Distributions

#### Topics

• Probability and conditional probability
• Random variables - dicrete and continuous
• Probability mass functions, probability density functions
• Cumulative probability function
• Useful distributions and their properties
• density (d), cumulative probability (p), quantile (q), and random (r) functions
• Discrete
• Bernoulli
• Poisson
• Binomial
• Continuous
• Beta
• Uniform
• Normal
• Q-Q Plots
• Standard errors and confidence intervals

The Book of R
• Chapter 15 - Probability
• Chapter 16 - Common Probability Distributions

R Programming for Data Science
• Chapter 22 - Simulation

### Week 05 (2021-10-01)

Homework 3 assigned - DUE 5pm 2021-10-14

IMPORTANT! Today is the deadline for choosing a paper from the primary literature to replicate analyses.

You can find instructions for the replication assignment here!

### Statistical Inference and Basic Hypothesis Testing

#### Topics

• Significance and p values
• Classic hypothesis testing
• One- and two-sample T and Z tests
• Type I and Type II error
• Statistical power, effect sizes

The Book of R
• Chapter 17 - Sampling Distributions and Confidence
• Chapter 18 - Hypothesis Testing (through section 18.3)
Statistics Done Wrong
• Chapter 1 - An Introduction to Statistical Significance

Statistics: An Introduction Using R
• Chapter 5 - Single Samples
• Chapter 6 - Two Samples

### Introduction to Linear Regression

#### Topics

• Correlation and covariation
• Introduction to linear modeling
• Continuous random predictor and reponse variables
• Simple linear regression (1 predictor and 1 reponse variable)
• Estimating and interpreting regression coefficients
• Model I and Model II regression
• The lm() function
• Interference in regression
• Confidence intervals and prediction intervals
• Residuals

#### {swirl} Tutorials

• Regression Models (all exercises)

The Book of R

• Chapter 20 - Simple Linear Regression

R in Action

• Chapter 8 - Regression (through section 8.2)

Statistics: An Introduction Using R

• Chapter 7 - Regression

### Week 07 (2021-10-15)

Homework 4 assigned - DUE 5pm 2021-10-28

Seminar will be held on Tuesday, in observance of Indigenous Peoples’ Day.

### Elements of Regression Analysis

#### Topics

• Inference in regression
• Estimating standard errors for regression cofficients
• Model checking
• Partitioning of variance in linear models
• Data transformations

The Book of R

• Chapter 20 - Simple Linear Regression
• Chapter 18 - Hypothesis Testing (section 18.4)

R in Action

• Chapter 8 - Regression (sections 8.3 through 8.8)

### Basic Categorical Data Analysis and ANOVA

#### Topics

• Regression with categorical predictors
• One- and multiple-factor ANOVA
• Type I, Type II, Type III sums of squares
• Simple categorical data analysis
• Kruskal-Wallis tests
• Chi-Square tests of goodness-of-fit and independence
• Interaction plots to visualize changes across groups

#### {swirl} Tutorials

• ANOVA

The Book of R

• Chapter 18 - Hypothesis Testing (section 18.4)
• Chapter 19 - Analysis of Variance

R in Action

• Chapter 9 - Analysis of Variance

Statistics: An Introduction Using R

• Chapter 8 - Analysis of Variance

### Multiple Regression and ANCOVA

#### Topics

• Generating mock data with a defined correlation structure
• Regression with multiple predictors
• More than one continuous predictor
• Combinations of continuous and categorical predictors
• Visualizing linear models with more than one predictor
• Confidence intervals and prediction in multiple regression
• Interactions between predictors

The Book of R

• Chapter 21 - Multiple Linear Regression

Statistics: An Introduction Using R

• Chapter 9 - Analysis of Covariance

### Week 10 (2021-11-05)

Homework 5 assigned - DUE 5pm 2021-11-11

IMPORTANT! Deadline for choosing your team and topic for group statistical methods presentation and vignette

### Model Selection, Generalized Linear Modeling, and Mixed Effects Modeling

#### Topics

• Model simplification and selection
• The Akaike Information Criterion (AIC) and others
• {stats} step()
• {MASS} stepwise()
• {AICcmodavg}
• Generalized Linear Modeling
• Dealing with other response variables types - counts, binary responses
• Introduction to mixed effects modeling and nonlinear models
• Assessing model fit for GLMs and mixed models using {MuMIn}
• Check-in on group project team-building and development.

R in Action

• Chapter 8 - Regression (section 8.6)
• Chapter 13 - Generalized Linear Models

Statistics: An Introduction Using R

• Chapter 12 - Other Response Variables

### Week 11 (2021-11-12)

Same readings as last week, plus:

Bolker, B.M., Brooks, M.E., Clark, C.J., Geange, S.W., Poulsen, J.R., Stevens, M.H.H., White, J-S.S. (2008) Generalized linear mixed models: a practical guide for ecology and evolution. Trends in Ecology and Evolution 24(3):127-135.

### A Very Brief Introduction to Bayesian Methods

#### Topics

• Bayesian vs. frequentist statistics
• Basics and Bayes’ Theorem
• Priors (when they matter and when they don’t)
• Implementing Bayesian (regression) models in R
• Using {MCMCglmm}
• Burn-in, iterations, and intervals
• Model assessment
• Implementing Bayesian models in the {rethinking} package framework

More details coming soon!

• Check-in on group project team-building and development.

### Week 13 (2021-11-26)

NO CLASSES, THANKGIVING BREAK

### Week 14 (2021-12-03)

Group Presentations and Vignettes

### Week 15 (2021-12-10)

Group Presentations and Vignettes