Linear Mixed Models in Linguistics and Psychology
Preface
Prerequisites
How to read this book
Online materials
Software needed
Acknowledgements
About the Authors
I Foundational ideas
1
Some important facts about distributions
1.1
Discrete random variables: An example using the Binomial distribution
1.1.1
The mean and variance of the Binomial distribution
1.1.2
What information does a probability distribution provide?
1.2
Continuous random variables: An example using the Normal distribution
1.3
Other common distributions
1.3.1
The standard normal:
\(\mathit{normal}(\mu=0,\sigma=1)\)
1.3.2
The uniform distribution
1.3.3
The Chi-square distribution
1.3.4
The t-distribution
1.3.5
The F distribution
1.4
Bivariate and multivariate distributions
1.4.1
Example 1: Discrete bivariate distributions
1.4.2
Example 2: Continuous bivariate distributions
1.4.3
Generate simulated bivariate (multivariate) data
1.5
Likelihood and maximum likelihood estimation
1.5.1
The importance of the MLE
1.6
Useful R functions relating to univariate distributions
1.7
Summary
1.8
Further reading
1.9
Exercises
2
Hypothetical repeated sampling and the t-test
2.1
Some terminology surrounding typical experiment designs in linguistics and psychology
2.2
The central limit theorem using simulation
2.3
Three examples of the sampling distribution
2.4
The confidence interval, and what it’s good for
2.4.1
Confidence interals are often misinterpreted
2.5
Hypothesis testing: The one sample t-test
2.5.1
The one-sample t-test
2.5.2
Type I, II error, and power
2.5.3
How to compute power for the one-sample t-test
2.5.4
The p-value
2.5.5
The distribution of the p-value under the null hypothesis
2.5.6
Type M and S error in the face of low power
2.5.7
Searching for significance
2.6
The two-sample t-test vs. the paired t-test
2.7
Using paired t-tests in complex factorial designs
2.7.1
Analyzing a
\(2\times 2\)
repeated measures design using paired t-tests
2.7.2
A complication with multiple t-tests: Inflation of Type I error probability
2.7.3
Analyzing a
\(2\times 2\times 2\)
repeated measures design using paired t-tests
2.8
Common mistakes involving the (paired) t-test
2.8.1
Ignoring the independence assumption
2.8.2
Doing a by-subjects and by-items paired t-test is generally dangerous
2.8.3
The difference between a significant and a non-significant result need not itself be significant
2.9
Summary
2.10
Further readings
2.11
Exercises
3
Linear models and linear mixed models
3.1
From the t-test to the linear (mixed) model
3.2
Sum coding
3.3
Checking model assumptions
3.4
From the paired t-test to the linear mixed model
3.5
Linear mixed models
3.5.1
Model type 1: Varying intercepts
3.5.2
The formal statement of the varying intercepts model
3.5.3
Model type 2: Varying intercepts and varying slopes, without a correlation
3.5.4
Model type 3: Varying intercepts and varying slopes, with correlation
3.6
Shrinkage in linear mixed models
3.6.1
Shrinkage of extreme estimates from individual subjects
3.6.2
Shrinkage when data are missing
3.7
Summary
3.8
Further reading
3.9
Exercises
4
Hypothesis testing using the likelihood ratio test
4.1
The likelihood ratio test: The theory
4.2
A practical example using simulated data
4.3
A real-life example: The English relative clause data
4.4
Summary
4.5
Further reading
4.6
Exercises
5
Linear modeling theory
5.1
A quick review of some basic concepts in matrix algebra
5.1.1
Matrix addition, subtraction, and multiplication
5.1.2
Diagonal matrix and identity matrix
5.1.3
Powers of matrices
5.1.4
Inverse of a matrix
5.1.5
Linear independence, and rank
5.2
The essentials of linear modeling theory
5.2.1
Least squares estimation: Geometric argument
5.2.2
The expectation and variance of the parameters beta
5.2.3
Hypothesis testing using Analysis of variance (ANOVA)
5.2.4
Some further important topics in linear modeling
5.2.5
Generalized linear models
5.3
Summary
5.4
Further reading
5.5
Exercises
6
Contrast coding
6.1
Basic concepts illustrated using a two-level factor
6.1.1
Default contrast coding: Treatment contrasts
6.1.2
Defining hypotheses
6.1.3
Sum contrasts
6.1.4
Cell means parameterization and posterior comparisons
6.2
The hypothesis matrix illustrated with a three-level factor
6.2.1
Sum contrasts
6.2.2
The hypothesis matrix
6.2.3
Generating contrasts: The
hypr
package
6.3
Further examples of contrasts illustrated with a factor with four levels
6.3.1
Repeated contrasts
6.3.2
Contrasts in linear regression analysis: The design or model matrix
6.3.3
Polynomial contrasts
6.4
What makes a good set of contrasts?
6.4.1
Centered contrasts
6.4.2
Orthogonal contrasts
6.4.3
The role of the intercept in non-centered contrasts
6.5
Summary
6.6
Further reading
6.7
Exercises
7
Contrast coding for designs with two predictor variables
7.1
Contrast coding in a factorial 2 x 2 design
7.1.1
The difference between an ANOVA and a multiple regression
7.1.2
Nested effects
7.1.3
Interactions between contrasts
7.2
One factor and one covariate
7.2.1
Estimating a group-difference and controlling for a covariate
7.2.2
Estimating differences in slopes
7.3
Interactions in generalized linear models (with non-linear link functions)
7.4
Summary
7.5
Exercises
8
Using simulation to understand your model
8.1
A reminder: The maximal linear mixed model
8.2
Obtain estimates from a previous study
8.3
Decide on a range of plausible values of the effect size
8.4
Extract parameter estimates
8.5
Define a function for generating data
8.5.1
Generate a Latin-square design
8.5.2
Generate data row-by-row
8.6
Repeated generation of data to compute power
8.7
What you can now do
8.8
Using the package
designr
to simulate data and compute power
8.8.1
Simulating data with two conditions
8.8.2
Simulating data in factorial designs
8.9
Exercises
9
Understanding Type I error inflation using simulation
9.1
Overly simple random effects structure in LMMs inflate Type I error
9.1.1
Type I error with a varying intercepts-only model
9.1.2
Type I error with a varying intercepts and varying slopes model
9.1.3
Type I error inflation due to model mis-specification
9.2
Type I error inflation due to multiple comparisons
9.3
The practical implications
9.4
Summary
9.5
Further reading
References
Published with bookdown
Linear Mixed Models in Linguistics and Psychology: A Comprehensive Introduction
4.4
Summary