Preface
Quickstart
Acknowledgements
1
Introduction to R
1.1
What is R?
1.2
Packages
1.2.1
Base R
1.2.2
Contributed packages
1.2.3
Installing Packages
1.2.4
Using and Loading Packages
1.2.5
Packages Required for This Tutorial
1.3
Using R
1.3.1
R as a Calculator
1.3.2
Assigning Variables
1.3.3
Rounding
1.3.4
Vectors
1.3.5
Plotting
1.3.6
Exercises
1.4
Documentation and Help
1.4.1
Built-in Documentation and Help
1.4.2
Web search
1.4.3
Online Guides for R
1.4.4
Online Cheatsheets
1.5
The Importance of Being Precise
2
Working with Data
2.1
Loading Data
2.1.1
The
Import Dataset
RStudio Button
2.1.2
The
read_csv()
Function (in the
readr
package)
2.1.3
The Working Directory
2.2
Exploring Univariate Data
2.2.1
Summary Functions
2.3
Plotting Univariate Data
2.3.1
Bar Plots
2.3.2
Histograms
2.3.3
Box Plots
2.4
Plotting Bivariate Data
2.4.1
Box Plots
2.4.2
Scatter Plots
2.5
Numerical Summaries for Bivariate Data
2.5.1
Covariance
2.5.2
Correlation
2.6
Simple Linear Regression
2.6.1
Plotting the Regression Line
2.6.2
Reverse Regression
3
Tabular Data
3.1
Two-Way Tables
3.1.1
Matrices
3.1.2
Example Dataset
3.1.3
Working with Two-Way Tables
3.1.4
Distributions in Two-Way Tables
3.1.5
Exercises
3.2
Simpson’s Paradox
3.3
Sensitivity and Specificity
4
Study Design
4.1
Locate Article
4.2
Literature Exercise
4.2.1
Article Citation
4.2.2
Critical Reading
5
Exploring Distributions of Random Variables Through Simulation
5.1
Simulating Random Variables for Individual Events
5.1.1
Flipping Coins
5.1.2
Rolling Dice
5.1.3
Plotting Results
5.2
Discrete Distributions
5.2.1
The Bernoulli Distribution
5.2.2
The Binomial Distribution
5.2.3
The Poisson Distribution
5.3
Continuous Distributions
5.3.1
The Normal Distribution
5.3.2
The Exponential Distribution
5.4
Limit Theorems
5.4.1
The Law of Large Numbers
5.4.2
The Central Limit Theorem
5.5
Additional examples
5.5.1
The Uniform Distribution
6
Inference
Example Dataset: Theo’s Chocolate Bars
6.1
Confidence Intervals
6.1.1
Illustrating Confidence Intervals
6.2
Hypothesis Tests
6.2.1
Illustrating a Hypothesis Test
6.2.2
Hypothesis Tests for Means
6.2.3
Two-sample Tests
6.2.4
Tests for Proportions
6.2.5
Power
7
Regression
Example Dataset: U.S. Democratic Votes by State
7.1
Linear Regression
7.2
Checking Model Assumptions
7.3
Testing Individual Coefficients
7.4
Confidence Intervals for the Parameter Estimates
7.5
Confidence and Prediction Intervals for specific values of
\(X\)
7.6
Omnibus tests for “Goodness of Fit”
8
Chi-squared Test
9
Appendix
9.1
Random Seeds
10
Accessing Literature
10.1
Academic Search Engines
10.1.1
Google Scholar
10.1.2
Other Search Engines
10.2
Accessing Literature Through Paywalls
Introduction to Statistics with R
10
Accessing Literature
Learning Objectives
Learn about useful websites for searching academic literature
Useful Websites
Google Scholar
UW Libraries
arXiv
JSTOR
PubMed
Web of Science