Preface
0.1
Installing R
Mac Users
Windows Users
1
Data in R
1.1
Arithmetic and Variable Assignment
1.2
Vectors
1.3
Indexing Vectors
1.4
Data Types
1.5
Data Frames
1.6
Reading data from files
1.7
Missing Values
1.8
Useful Idioms
1.9
Exercises
2
Probability
2.1
Probability Basics
2.2
Conditional Probability and Independence
2.3
Counting Arguments
2.4
Simulations
2.4.1
Using replicate to simulate experiments
2.4.2
Simulating Conditional Probability
2.5
Exercises
3
Random Variables
3.1
Discrete Random Variables
3.1.1
Expected Values of Discrete Random Variables
3.2
Continuous Random Variables
3.2.1
Expected value of a continuous random variable
3.3
Expected value of a function of an rv: Variance
3.3.1
Linearity of expected values
3.4
Special Discrete Random Variables
3.4.1
Binomial Random Variable
3.4.2
Geometric Random Variable
3.4.3
Poisson Random Variables
3.4.4
Negative Binomial (Optional)
3.4.5
Hypergeometric (Optional)
3.5
Special Continuous Random Variables
3.5.1
Uniform Random Variable
3.5.2
Exponential Random Variable
3.5.3
Normal Random Variable
3.6
Independent Random Variables
3.7
Using R to compute probabilities
3.8
A ggplot interlude
3.9
Summary
3.10
Exercises
4
Simulation of Random Variables
4.1
Estimating probabilities of rvs via simulation.
4.2
Estimating discrete distributions
4.3
Estimating continuous distributions
4.4
Theorems about transformations of random variables
4.5
The Central Limit Theorem
4.6
Sampling Distributions (optional)
4.6.1
Linear combination of normal rv’s
4.6.2
Chi-squared
4.6.3
The
\(t\)
distribution
4.6.4
The F distribution
4.6.5
Summary
4.7
Point Estimators (Optional)
4.7.1
Properites of Point Estimators
4.7.2
Variance of Unbiased Estimators
4.8
Exercises
5
Data Manipulation
5.1
Data manipulation
5.2
Data Manipulation using strings
5.3
(Optional) Using join to merge data frames
5.4
Return to Batting exercise from Chapter Two
5.5
The apply family (Optional)
5.6
Exercises
5.7
Solutions to Two Data Wrangling Exercises
6
ggplot and descriptive statistics
6.1
Scatterplots
6.2
Boxplots
6.3
Histograms
6.4
Quantile-Quantile plots
6.4.1
(Optional) qq plots by hand
6.5
Plotting pmfs
6.6
Plotting functions
6.7
Piping to
ggplot
6.8
Two common ggplot issues
6.9
Examples
6.9.1
Some GIS (Optional)
6.10
Exercises
7
Hypothesis Testing and Confidence Intervals for the mean
7.1
Confidence intervals for the mean
7.2
Hypothesis Tests of the Mean
7.3
One-sided Confidence Intervals and Hypothesis Tests
7.4
Simulations
7.4.1
Symmetric, light tailed
7.4.2
Skew
7.4.3
Heavy tails and outliers
7.4.4
Summary
7.5
Two sample hypothesis tests of
\(\mu_1 = \mu_2\)
7.5.1
Example Two
7.6
Type II errors and power
7.6.1
Effect size
7.7
Exercises
8
Rank based tests
8.1
One sample Wilcoxon Ranked-Sum Test
8.2
Two Sample test
8.2.1
Example
8.2.2
Ordinal Data
8.2.3
Example
8.2.4
Discussion
8.2.5
Example
8.3
Simulations
8.4
Robustness, power, and sample size
8.5
Exercises
9
Tabular Data
9.1
Test of proportions
9.1.1
Hypothesis Testing
9.1.2
Confidence Intervals
9.2
Multinomial Experiments
9.3
\(\chi^2\)
-tests
9.3.1
Simultations
9.4
Exercises
10
Simple Linear Regression
10.1
Finding the intercept and slope
10.2
Using R and Linear Models
10.3
Prediction and Confidence Intervals
10.3.1
Confidence Bands
10.3.2
Prediction Intervals
10.4
Inference on the slope
10.5
Residual Analysis
10.6
Simulations
10.6.1
simulating residuals
10.6.2
Simulating Prediction and Confidence Intervals
10.7
Exercises
11
Analysis of Variance
11.1
Setup
11.2
ANOVA
11.3
Examples
11.3.1
red.cell.folate
11.3.2
InsectSprays
11.4
Pairwise t-tests
11.5
Exercises
12
Multiple Regression
12.0.1
Example One:
cystifbr
12.0.2
Example Two: Secher data
12.1
Exercises
References
Appendix
A
An R Markdown Primer for Doing Homework
Foundations of Statistics with R
References