Preface
0.1
Why R?
0.2
The golden age of data
0.3
An open source book
0.4
Acknowledgements
1
Introduction to R
1.1
Why programming is hard to learn
1.1.1
Use the web
1.1.2
Rubber duck debugging
1.2
Using RStudio
1.3
Getting started with R
1.4
Variables
1.5
Functions
1.6
Vectors
1.7
Math with vectors
1.8
Data Frames
1.9
Using R libraries
1.10
Working with data files
1.11
Learning objectives
1.12
Suggested readings and videos
2
Summarizing data using R (with Lucy King)
2.1
Introduction to the Tidyverse
2.1.1
Making a data frame using tibble()
2.1.2
Selecting an element
2.1.3
Adding a row or column
2.2
Creating or modifying variables using
mutate()
2.2.1
Remove a column using the select() function
2.3
Tidyverse in action
2.4
Looking at individual variables using pull() and head()
2.5
Computing a frequency distribution (Section @ref(frequency-distributions))
2.6
Computing a cumulative distribution (Section @ref(cumulative-distributions))
2.7
Data cleaning and tidying with R
2.7.1
Statistics attitude data from course survey
3
Data visualization using R (with Anna Khazenzon)
3.1
The grammar of graphics
3.2
Getting started
3.3
Let’s think through a visualization
3.4
Plotting the distribution of a single variable
3.4.1
Histogram
3.4.2
Density plot
3.4.3
Bar vs. line plots
3.5
Plots with two variables
3.5.1
Adding on variables
3.5.2
Plotting dispersion
3.5.3
Scatter plot
3.6
Creating a more complex plot
3.7
Additional reading and resources
4
Fitting simple models using R
4.1
Mean
4.2
Median
4.3
Mode
4.4
Variability
4.5
Z-scores
5
Probability in R (with Lucy King)
5.1
Basic probability calculations
5.2
Empirical frequency (Section @ref(empirical-frequency))
5.3
Conditional probability (Section @ref(conditional-probability))
6
Sampling in R
6.1
Sampling error (Section @ref(samplingerror))
6.2
Central limit theorem
6.3
Confidence intervals (Section @ref(confidence-intervals))
7
Resampling and simulation in R
7.1
Generating random samples (Section @ref(generating-random-numbers))
7.2
Simulating the maximum finishing time
7.3
The bootstrap
8
Hypothesis testing in R
8.1
Simple example: Coin-flipping (Section @ref(randomization-very-simple))
8.2
Simulating p-values
9
Statistical power in R
9.1
Computing confidence intervals
9.1.1
Theoretical
9.1.2
Bootstrap
9.2
Effect Size
9.2.1
Cohen’s d
9.2.2
Pearson’s r
9.2.3
Odds ratio
9.3
Power analysis
9.4
Power curves
9.5
Simulating statistical power
10
Bayesian statistics in R
10.1
A simple example (Section @ref(doing-bayesian-estimation))
10.2
Estimating posterior distributions (Section @ref(estimating-posterior-distributions))
10.3
Bayes factors (Section @ref(Bayes-factors))
11
Modeling categorical relationships in R
11.1
The Pearson Chi-squared test (Section @ref(chi-squared-test))
11.2
Two-way tests (Section @ref(two-way-test})
12
Modeling continuous relationships in R
12.1
Computing covariance and correlation (Section @ref(covariance-and-correlation))
12.2
Hate crime example
12.3
Robust correlations (Section @ref(robust-correlations))
13
The General Linear Model in R
13.1
Linear regression (Section @ref(linear-regression))
13.2
Model criticism and diagnostics (Section @ref(model-criticism))
13.3
Examples of problematic model fit
13.4
Extending regression to binary outcomes.
13.5
Cross-validation (Section @ref(cross-validation))
14
Comparing means in R
14.1
Testing the value of a single mean (Section @ref(single-mean))
14.2
Comparing two means (Section @ref(comparing-two-means))
14.3
The t-test as a linear model (Section @ref(ttest-linear-model))
14.4
Comparing paired observations (Section @ref(paired-ttests))
14.5
Analysis of variance (Section @ref(ANOVA))
14.5.1
Repeated measures analysis of variance
15
Practical statistical modeling in R
References
An R companion to Statistical Thinking for the 21st Century
Chapter 15
Practical statistical modeling in R