R Independent Study - Lessons






Activity Time Estimate Deadline
Read Course Syllabus 15 Minutes Tuesday
Read Week 1 Notes: Introduction 2 Hours Thursday
Complete swirl lessons 1 and 3 40 Minutes Thursday

Objectives

By the end of these lessons, you should have

  • understood important information about this course.
  • installed R, RStudio and swirl
  • completed swirl lessons 1 and 3, and been able to use R to do simple arithmetic calculations

Here is a summary of commands and functions you encounter in Week 1.




Activity Time Estimate Deadline
Read Chapters 5 and 11 of the text (Chapters on R Nuts and Bolts and Vectorized Operations) 1 Hour Tuesday
Complete lessons 4 (Vectors) and 5 (Missing Values) of R programming in swirl 40 Minutes Tuesday
Read Using R as a Calculator and Mean, Median, Standard Deviation, Correlation, Maximum and Minimum 1 Hour Thursday
Watch Using R script (The speaker uses a Mac keyboard. For those of you using other keyboards, replace the Command key by the Ctrl key.) 10 minutes Thursday
Read Checking Your Calculations: Part 1 10 minutes Thursday
Lon Capa HW and quiz 2 – 4 Hours Sunday

Objectives

By the end of week 2, you should be able to

  • find out the data type of an R object
  • convert one data type to another through explicit and implicit coercion
  • find out if an R object has a missing value (NA)
  • perform vectorized operations
  • use the sum(), mean(), median(), sd(), sort(), and cor() functions to compute statistics of data
  • use the min(), max(), which.min(), and which.max() functions to find and locate the maximum and minimum values
  • check your calculations using the methods of sanity check and consistency check

Here is a summary of commands and functions you encounter in Weeks 1 and 2.




Activity Time Estimate Deadline
Read Chapters 6, 9 and 10 (chapters on Getting Data In and Out of R, Interfaces to the Outside World, and Subsetting R Objects) 1.5 Hours Tuesday
Complete lessons 6 (Subsetting Vectors), 7 (Matrices and Data Frames) of R programming in swirl 45 Minutes Thursday
Read Normal, Chi Square and t Distribution 1.5 Hours Thursday
Lon Capa Assignment 2 – 6 Hours Sunday

Objectives

By the end of week 3, you should be able to

  • load data files to R;
  • subset a vector, list and data frame;
  • use R's statistics functions associated with the normal, Chi-square and student's t distributions.
  • plot a histogram using the hist() function;
  • plot a mathematical function using the curve() command.

Here is a summary of commands and functions you encounter in Weeks 1–3.




Activity Time Estimate Deadline
Read Chapter 14 of the text (Control Structures) 1 Hour Tuesday
Complete lessons 8 (Logic) and 2 (Workspace) of R programming in swirl 40 Minutes Tuesday
Read For-Loops and If-else Statements: Examples 1 Hour Thursday
Lon Capa Assignment 3 – 6 Hours Sunday

Objectives

By the end of week 4, you should be able to

  • use if-else statements, for-loops and while-loops to write codes;
  • be familiar with the logical operations.

Here is a summary of commands and functions you encounter in Weeks 1–4.




Activity Time Estimate Deadline
Complete lesson 12 (Looking at Data) of R programming in swirl 30 Minutes Tuesday
Simple Data Analysis and Manipulations 1 Hour Thursday
Lon Capa Assignment 2 – 8 Hours Sunday

You might wonder why the time estimate for the Lon Capa assignment has such a wide range. The actual time required to complete the assignment depends largely on how familiar you are with the material covered so far, and how carefully you read the assignment instructions. The material in each week is cumulative. If you skipped/forgot some material covered in previous weeks, you will find the assignments harder and harder and more and more time consuming.

Objectives

By the end of week 5, you should be able to

  • download data from our data program and load them to R;
  • look at the data loaded to R, perform simple data transformation and calculate summary statistics;
  • export data to files.

Here is a summary of commands and functions you encounter in Weeks 1–5.




Activity Time Estimate Deadline
Ch. 15, Ch. 16 (Functions, Scoping Rules) and Ch. 17 (Coding Standards for R) of the text 1 Hour Tuesday
Complete lessons 9 (Functions) and 15 (Base Graphics) of R programming in swirl 1 Hour Tuesday
Read: Introduction to Plotting in R 1 Hour Thursday
Read Checking Your Calculations: Part 2 1 Hour Friday
Lon Capa Assignment 3 – 8 Hours Sunday

Objectives

By the end of week 6, you should be able to

  • write functions in R;
  • remember several common coding standards for R;
  • make barplots, histograms, boxplots, scatter plots, and density plots using R's base graphics;
  • create conditioning type of plots using R's lattice graphics;
  • be able to verify your code using the techniques of "scaling down the problems" and "comparison to problems with known answers".

Here is a summary of commands and functions you encounter in Weeks 1–6.




Activity Time Estimate Deadline
Watch the three videos on R markdown (courtesy of David Dalpiaz) linked here. 30 Minutes Tuesday
Read RMarkdown Template (courtesy of David Dalpiaz)
This is the written version of the three videos
30 Minutes Tuesday
Read Simple Regression 1.5 Hours Thursday
Lon Capa Assignment 3 – 6 Hours Sunday

An old version of the three videos is also available (in case you find the new version hard to follow):
1. R Markdown Introduction
2. R Markdown Basics
3. R Markdown Tips and Tricks

Objectives

By the end of week 7, you should be able to

  • use R markdown to write documents with embedded R codes;
  • use R to perform simple linear regression, calculate confidence intervals, and make prediction for new data;

Here is a summary of commands and functions you encounter in Weeks 1–7.




Activity Time Estimate Deadline
Complete lessons 10 (lapply and sapply) and 11 (vapply and tapply) of R programming in swirl 30 Minutes Tuesday
Read Chapter 18 (Loop Functions) of the text 1 Hour Tuesday
Read Regression with Factor Variables 1.5 Hours Thursday
Lon Capa Assignment 3 – 7 Hours Sunday

Objectives

By the end of week 8, you should be able to

  • use the loop functions (lapply, sapply, mapply, tapply, vapply... etc) to apply a function on a list/vector;
  • fit linear models with factor variables, calculate confidence intervals, and make predictions for new data;
  • be familiar with the syntax of the model formulae used in the lm() function.

Here is a summary of commands and functions you encounter in Weeks 1–8.




Optional Material: Introduction to Tidyverse




Activity Time Estimate Deadline
Complete lesson 13 (Simulation) of R programming in swirl. 20 Minutes Tuesday
Read Chapter 22 (Simulation) of the text. You can skip the parts on Poisson distribution if you don't know what it is. 1 Hour Tuesday
Read Multivariable Regression 1 Hour Thursday
Lon Capa Assignment 3 – 7 Hours Sunday

Objectives

By the end of week 9, you should be able to

  • use R to perform simple simulations;
  • use the lm() function to perform multivariable regressions.

Here is a summary of commands and functions you encounter in Weeks 1–9.




Activity Time Estimate Deadline
Complete lesson 14 (Dates and Times) of R programming in swirl. After this lesson, you will have completed all lessons on R programming in swirl. 20 Minutes Tuesday
Read Chapter 12 (Dates and Times) and Section 21.1 (Using system.time(). Note that you only need to read the section on Using system.time().) 30 Minutes Tuesday
Read Introduction to Monte Carlo Simulations 1 Hour Thursday
Lon Capa Assignment 3 – 7 Hours Sunday

Objectives

By the end of week 10, you should be able to

  • use R's date and time classes to do simple calculations involving date and time;
  • use system.time() to figure out the time needed for evaluating expressions;
  • use R to perform simple Monte Carlo simulations, visualize and extract information from the simulation results.

Here is a summary of commands and functions you encounter in Weeks 1–10.




Activity Time Estimate Deadline
Read Statistical Tests 1.5 Hours Thursday
Lon Capa Assignment 3 – 5 Hours Sunday

Objectives

By the end of week 11, you should be able to use R to perform Chi-square tests, two-sample t-tests, F-tests, pairwise t-test with Bonferroni correction, and Randomization tests.

Here is a summary of commands and functions you encounter in Weeks 1–11.

Optional Material

Watch this youtube video on regular expressions. Then read Chapter 19 of the textbook on using regular rexpressions in R.

Note: Even though I think regular expressions are very useful and fun. They are probably too complicated to most people. That's why I am making it optional.




Activity Time Estimate Deadline
Read Transformation of Variables 1.5 Hours Thursday
Optional reading: Checking Your Calculations: Part 3
Lon Capa Assignment 3 – 6 Hours Sunday

Objectives

By the end of week 12, you should be able to use the technique of transformation of variables in regression analysis.

Here is a summary of commands and functions you encounter in Weeks 1–12.




Activity Time Estimate Deadline
Read Maximum Likelihood and Logistic Regression 1.5 Hours Wednesday
Read Logistic Regression 1.5 Hours Friday
Lon Capa Assignment 4 – 10 Hours the following Wednesday

Note: Week 13 is 1.5-week long. It covers more material and has more HW assignments than previous weeks.

Reminder: Your lowest weekly HW score and lowest weekly quiz score from Weeks 2-12 will be dropped, but all assignments in Weeks 13 and 14 will be counted.

Objectives

By the end of week 13, you should be able to

  • understand the concept of maximum likelihood;
  • calculate the maximun likelihood estimats of probabilities in discrete categorical variables;
  • use R's glm() function to perform logistic regressions;
  • use the predict() function to calculate the predicted probabilities given the values of the predictors;
  • calculate the deviances and MacFaden's R2 for a logistic regression.

Here is a summary of commands and functions you encounter in Weeks 1–13.




Activity Time Estimate Deadline
Read Non-Parametric Statistics 1.5 Hours Sunday
Lon Capa Assignment 3 – 8 Hours the following Wednesday

Objectives

By the end of week 14, you should be able to use R's build-in functions wilcox.test(), kruskal.test(), pairwise.wilcox.test(), and cor.test() to perform non-parameteric tests introduced in the last three chapters of Stat 200.

Here is a summary of commands and functions you encounter in the whole course.



This is the end of the course, but your study of R shouldn't end here.