BIOL2022 - L02c
The University of Sydney
The ideas in this lecture are a bit more abstract than the previous lectures, but they are important to understand as they will help you to:
You should read through this lecture at your own time as it will make your experiments a bit easier to design, assess and interpret.
A general (mathematical) framework for expressing relationships between variables.
We are trying to fit a line (or a curve) to the data that best explains the relationship between the variables, essentially a simple equation many of you will be familiar with:
\[y = c + mx\]
where \(c\) is the intercept and \(m\) is the slope of the line.
Compare this to the general linear model: \[y = \beta_0 + \beta_1 x + \epsilon\]
or simply (for your benefit):
The equation to rule them all, where
In general, most common statistical tests can be expressed as a GLM like above.
\[response \sim explanation\]
Also read as (recall the previous lecture):
\[response \sim explanation\]
\[ (continuous) \sim (continuous) \]
\[ (continuous) \sim (categorical) \]
\[ (binary) \sim (continuous) \]
\[response \sim explanation\]
\[ (continuous) \sim (categorical) \]
\[ response = \beta_0 + \beta_1 \times explanation + \epsilon \]
\[response \sim explanation\]
\[ (continuous) \sim (categorical) \]
\[ response = \beta_0 + \beta_1 \times explanation + \epsilon \]
In most statistical software (including R and Jamovi) you only need to specify the model formula (the first part) and the software will take care of the rest to produce the statistical output (the third part).
Your job is to determine if the model is a good fit, and interpret the results.
In previous studies, you may have checked assumptions in different ways depending on the statistical test:
A GLM provides a framework for checking model assumptions using residuals to assess any of:
We will cover these in more detail in the next lecture…
So far, we have looked at models with a single explanatory variable. But often, we want to explain the response variable using more than one explanatory variable.
For example, perhaps we want to explain the metabolic rate of an organism using both its body mass and temperature:
\[\text{metabolic rate} \sim \text{body mass} + \text{temperature}\]
The plus sign (+) means we are including both body mass and temperature as separate, additive predictors of metabolic rate. This is called an additive model.
\[\text{metabolic rate} \sim \text{body mass} + \text{temperature}\]
Sometimes, the effect of one variable depends on the value of another. For example, maybe the effect of temperature on metabolic rate changes depending on body mass.
To model this, we include an interaction:
\[\text{metabolic rate} \sim \text{body mass} \times \text{temperature}\]
This expands to:
\[\text{metabolic rate} \sim \text{body mass} + \text{temperature} + \text{body mass}\mathbin{:}\text{temperature}\]
: term represents the interaction between body mass and temperature.* shorthand (body mass * temperature) automatically includes both main effects and their interaction.There are other types of relationships and model structures, which we will cover as we go along.
Model the following relationships.
\[ \text{number of birds} \sim \text{number of trees} + \text{amount of rainfall} \]
\[ \text{number of birds} \sim \text{number of trees} + \text{amount of rainfall} + \text{number of trees}\mathbin{:}\text{amount of rainfall} \]
\[ \text{number of birds} \sim \text{number of trees} \times \text{amount of rainfall} \]
Model the following relationships.
\[ \text{sex of turtle} \sim \text{temperature of nest} \]
\[ \text{height of seedling} \sim \text{temperature} + \text{amount of sunlight} \]
\[ \text{air quality} \sim \text{rainfall} + \text{temperature} + \text{number of trees} + \text{cloud cover} + \text{rainfall}\mathbin{:}\text{temperature} \]
You are probably NOT experienced enough to use it to its full potential, and that is okay.
This presentation is based on the SOLES Quarto reveal.js template and is licensed under a Creative Commons Attribution 4.0 International License.