PPLS Summer Training (R and Stats)
Overview of the Course
Programme
Learning Outcomes
Preparation
Data sets
Expectations
Lets stay in touch
List of extra resources
Authorship
Last, but not least
1
Getting Started in RStudio
1.1
R as an interactive envrionment
1.2
Setting Up Your Working Directory
2
The Console
2.1
Spacing
2.2
Typos
2.3
Unfinishe…. d
2.4
Basic Arithmetic
2.5
Using Functions for Calculations
3
R Scripts
3.1
Short Example
4
Naming variables
5
Vectors
5.1
Numeric Data
5.2
Text/Character Data
5.3
Logical Data
5.3.1
Exercise
6
Variable Classes
6.1
Factors
6.1.1
Exercise
7
Lists
8
Matrices
9
Data Frames
10
Loading Data
10.1
Practical Example
10.2
Subsetting Dataframes
10.2.1
Replacing Values & NAs
10.3
Indexing Data Frames
11
Packages
12
Summary Statistics
12.1
Data Cleaning
13
Visualisations
13.1
Simple Plots
13.1.1
Using
plot()
13.2
Customising Plots
13.2.1
Labels
13.2.2
Plot Type
13.2.3
Other Customisable Features
13.2.4
Change Axes
13.3
Don’t Panic!
13.4
Other Simple Plots
13.4.1
Histograms
13.4.2
Boxplots
13.4.3
Scatterplots
13.5
How to Save Image Files
13.6
Plotting with
ggplot2
13.6.1
ggplot()
13.6.2
Iris Example
13.6.3
ggplot()
with our
mydata
file
13.7
Bring It All Together
13.8
Write Out Files
13.9
Questions
14
DIY
15
Tests and modelling in R
15.1
Hypothesis testing
16
Examining Relationships (more than one variable)
16.1
T test
16.2
Chi squared distribution and test
16.2.1
Contingency tables
16.3
Chi squared distribution
16.4
One way Anova
17
Correlation, Causation, and LM
17.1
Sharks and ice cream example
17.2
Simple Linear Regression in R
17.3
Regression Diagnostics - assess the validity of a model
17.3.1
Violations of the assumptions: available treatments
17.4
Standardisation
17.5
Interaction (simple slope) and multiple explanatory factors
18
Model selection
18.1
AIC & BIC
19
DIY
20
Simple Linear Model and Mixed Methods
20.1
Data sets
20.2
Longitudinal Data
20.3
Why a new model?
20.4
Ecological Fallacy (quick illustration) - no need to run
20.5
Simple Example
20.6
Now for Advanced: Model set up
20.6.1
Pooling
20.6.2
No pooling
20.6.3
Partial Pooling (varying intercepts)
20.6.4
Partial Pooling Extended - (varying intercepts and/or slopes)
20.7
Multilevel modelling with random intercepts and slopes
20.7.1
Overview of the data set
20.7.2
Prepare
20.8
Random slopes, intercepts and cross level interactions (optional)
21
Testing the assumptions
22
Coffee break
23
Logistic setting
23.1
Simple Example
23.1.1
Optional (Odds Refresher)
24
Now for Advanced: logistic mixed effects
25
Now, over to you!
25.1
Data Description
26
Introduction to Bayesian Estimation
26.1
Intro to Bayesian estimation
26.1.1
Data sets
26.2
Bayes inference and one-sample t-test
26.3
Difference between two groups’ means
26.4
Bayes Factor Example
26.5
Bayes Factor and Anova
26.5.1
Exercise
26.6
Linear models with BAS
26.6.1
BIC and R squared
26.7
Predictions from bas.lm
26.8
Examining and presenting results
26.9
Bayesian Mixed methods example (Optional)
26.9.1
Data
27
DIY
27.1
Extra Resources to check
28
Extra Resources
28.1
More R practice
28.2
Data Cleaning
28.3
Visualisations
28.4
Other Common Methods in R
28.5
Big Data
Published with bookdown
PPLS PhD Training Workshop: Statistics and R
Chapter 22
Coffee break