Quantitative genetics in R

Quantitative genetics in R from scratch: selection differentials and gradients, the breeder’s equation, the G matrix, the Price equation and relatedness.

Quantitative genetics is the part of evolutionary biology that deals with traits nobody can assign to a gene: body size, clutch size, flowering date, the things a field biologist actually measures. Its working assumption is that many small effects add up, which makes the machinery statistical rather than genetic, and puts covariances and regression coefficients where alleles would otherwise be. This page collects every tutorial on this site that builds that machinery by hand in base R, from measuring selection in a single season to the exact accounting of evolutionary change and the regression that turns relatedness into a number.

Measuring selection is a regression

Selection acts on phenotypes, so the first task is to describe it without knowing anything about inheritance. The covariance between a trait and relative fitness gives the selection differential, the total change within a generation, and it counts indirect effects: a trait can be under strong apparent selection purely because it correlates with something else that matters. Regressing relative fitness on several traits at once separates the direct part from the borrowed part, and the two quantities answer different questions. The distinction matters in practice because the differential is what a breeder observes and the gradient is what the causal story requires.

Predicting the response needs the genetics back

A within-generation change is not evolution. To get from selection to a response across generations, the phenotypic account has to be scaled by how much of the variation is transmitted, which is what heritability measures and what the breeder’s equation formalises. With several traits the scalar becomes a matrix, and correlated response appears: selecting on one trait moves another that was never under selection, sometimes in the wrong direction. Read that way the genetic covariance matrix is not a nuisance parameter but a description of the constraints a lineage is working under, and its leading axis says where evolution is cheap and where it is expensive.

Heritability without a selection experiment

The breeder’s equation needs a selection episode and a response to it, which is a rare thing to have in the wild. The alternative is to estimate the same transmitted variance directly, from the resemblance between relatives that a pedigree records. The model that does this is a mixed model whose random effect has a covariance matrix built from the pedigree, and once it is written that way the whole apparatus turns out to be generalised least squares with a relatedness matrix in it: the same algebra the comparative posts use across species, with kinship in place of shared ancestry. What it buys is an estimate from observational data alone. What it costs is that the estimate belongs to one population in one environment, and that everything the pedigree cannot resolve, a shared nest most of all, arrives inside the number rather than beside it.

The exact accounting

The Price equation is the general statement all of the above are special cases of. It splits any change in a population mean into a covariance between fitness and the trait, which is selection, and an expectation of the within-individual change, which is transmission. It assumes nothing about additivity, discrete generations, or a particular genetic architecture, which is why it can be applied at any level: alleles within genomes, individuals within groups, groups within a population. That generality is also its limit, since an identity cannot tell anyone what caused what.

Relatedness is a statistic, not a pedigree

Social evolution enters through the same regression logic. When an individual’s fitness depends on a neighbour’s phenotype, the covariance that selection sees runs partly through the neighbour, and the weight it carries is a regression of the neighbour’s breeding value on the actor’s. That is the honest definition of relatedness: a population statistic, measured against the local competitive background, not a fraction read off a family tree. It explains why the same pedigree kinship can imply different amounts of help in different populations, and why the scale of competition can cancel the benefit entirely.

The tutorials

Evolutionary quantitative genetics

The animal model

Kin selection and social evolution

Where this connects

Newsletter

Get new tutorials by email

New R and QGIS tutorials for ecologists, straight to your inbox. No spam; unsubscribe anytime.

By subscribing you agree to receive these emails and confirm your address once. See the privacy policy.