Quantitative Genetics in AlphaSimR
Gregor Gorjanc and Chris Gaynor
2026-12-01
Source:vignettes/articles/QuanGen.Rmd
QuanGen.RmdIntroduction and reading guide
This article explains how AlphaSimR constructs genetic
values from genotypic effects, decomposes them into population-specific
components, such as breeding values and non-additive deviations, and
calculates their variances.
While we try to introduce these concepts in a user-friendly way, it
is expected that the reader is familiar with the background theory (Falconer and Mackay 1996; Lynch and Walsh
1998). Also, the companion vignette("traits")
introduces trait specification and should be read first so you
understand how AlphaSimR generates genetic values. For an
application to cross performance involving multiple populations (pools /
breeds), the Combining Ability
article demonstrates general and specific combining ability (GCA and
SCA).
Principles of quantitative genetics are conceptually simple, but the stated and implied assumptions can be subtle. We address these subtleties across this article to the best of our ability within the scope of this article.
| If you want to understand… | Start with… |
|---|---|
| Difference between two common parameterizations of genetic values | Two parameterizations of genetic values |
| How genotypes and trait effects determine genetic values | Genotypic effects and genetic values |
| Why breeding values and non-additive deviations depend on a population | Breeding values and non-additive deviations |
Which reference population AlphaSimR uses
to partition genetic values |
From one locus to a reference population |
| How genetic variance differs from genic variance | Genetic and genic variances |
| How inbreeding affects genetic variance | Departures from Hardy-Weinberg proportions |
| How selection affects genetic variance | Linkage disequilibrium and the Bulmer effect |
| What is approximate under partial inbreeding and LD | Where the decomposition departs from least squares |
| What changes for polyploids | Polyploids and digenic dominance |
How AlphaSimR implementation relates to
classical quantitative genetics |
Relationship to classical theory |
Note that the examples in this article build on earlier code: use the links to navigate when reading, but run the examples in order.
All of the quantitative genetics quantities described below are
computed by genParam. User-friendly functions, such as
bv, internally call genParam. For a more
detailed numerical walkthrough of the genParam function,
see the genParam unit tests in
tests/testthat/test-genParam.R in the
AlphaSimR source package or git repository.
Two parameterizations of genetic values
There are two commonly used parameterizations of genetic values, the genotypic parameterization and breeding value parameterization, and they are a constant source of confusion. They describe the same genetic values and are hence equivalent from that point of view, but divide the genetic values into different components that differ in their meaning. The key distinction is how those components depend on the population.
The genotypic parameterization constructs genetic values from genotypes, genotypic effects, and a trait intercept. Once the effects and intercept are specified, the genetic value assigned to a genotype does not depend on allele or genotype frequencies. This is sometimes called the “functional” or “biological” model, but note that this model is a very simplified representation of trait biology to enable mathematical analysis.
The breeding value parameterization decomposes genetic values into a population mean, additive genetic (breeding) values, and non-additive deviations. The non-additive effects considered in this article are dominance and epistasis. These components depend on allele and genotype frequencies in a population. The same individual can therefore have different breeding values and non-additive deviations in different populations, even when their genetic value is unchanged. This is sometimes called the “statistical” model, because we obtain breeding values and deviations from fitting a statistical model to a specific population.
Both parameterizations can be used for simulation, theoretical calculations, and estimation from data. The breeding value parameterization underlies much of quantitative genetics, evolution, and breeding theory (Falconer and Mackay 1996; Lynch and Walsh 1998) and is the main focus here. In the following, we first describe the genotypic parameterization, then derive breeding values and non-additive deviations and their corresponding variances.
Note that ADEG symbols can denote different quantities in the two parameterizations, so symbol definitions should be read carefully.
Genotypic effects and genetic values
Genotype coding and the genetic value model
AlphaSimR builds the genetic value of an individual from
biallelic loci using scaled genotype dosages following the genotypic
parameterization. For a locus with raw dosage
(the number of copies of the “1” allele) in an organism of ploidy
,
the scaled additive and dominance dosages are respectively:
and the genetic value of an individual is:
where is the trait intercept, calibrated to achieve the requested founder mean and not generally equal to that mean, and are additive and dominance effects at locus , and is an additive-by-additive epistatic effect between the pair of loci and . The additive and dominance sums are over the causal (quantitative trait) loci (QTL), while the epistatic sum is over the pairs of QTL.
AlphaSimR assigns each QTL to exactly one epistatic
pair, so these pairs are disjoint and the number of pairs is half the
number of QTL. This means the two-locus calculations described below can
be carried out one pair at a time and summed. Note that the only modeled
epistasis is additive-by-additive. Additive-by-dominance or
dominance-by-dominance epistasis are not supported.
Note that genetic values in AlphaSimR include the trait
intercept
,
while standard literature often removes it (or the trait mean of a
population) (Fisher 1919; Falconer and Mackay
1996; Lynch and Walsh 1998). While this difference only shifts
the “baseline” of genetic values, it is convenient for seamless
comparisons across populations and time. Since there are several
“baseline”-related quantities in AlphaSimR, we next explain
these concretely.
Founder mean, trait intercept, and population mean
It is useful to distinguish between the mean requested when specifying a trait from the intercept used to calculate genetic values, and a population mean. The intercept sets a fixed baseline, while the population mean also depends on the genotypes in the population. Three quantities therefore need to be distinguished:
| Quantity | Symbol | R quantity |
|---|---|---|
| Requested founder mean |
mean argument to
addTrait*()
|
|
| Trait intercept |
SP$traits[[t]]@intercept and
genParam(pop)$gv_mu[t] for trait t
|
|
| Current population mean genetic value |
meanG(pop) and
genParam(pop)$mu
|
These are related in the following way. Let be the sum of individual ’s contributions from genotypic effects. Then:
After scaling the effects to achieve the requested founder variance,
AlphaSimR chooses the trait intercept as:
Thus the founder mean equals the requested mean, but the intercept
generally differs from it. With the trait definition held fixed, the
intercept remains constant while the population mean can change as
genotype frequencies change. The corresponding identity for the
quantities returned by genParam() (as shown below) is
mu = gv_mu + colMeans(gv_a + gv_d + gv_aa), where
mu is current population mean genetic value
,
gv_mu is trait intercept
,
and colMeans(gv_a + gv_d + gv_aa) is the mean of
contributions from genotypic effects
.
Worked example: one locus
We now illustrate how the intercept and genotypic effects combine to give genetic values at one locus. First we simulate founder genomes and specify a trait with one QTL, a requested founder mean of 10, and additive (default) and dominance genotypic effects.
# Founders and a trait
founderPop = quickHaplo(nInd = 100, nChr = 1, segSites = 1)
SP = SimParam$new(founderPop)
SP$addTraitAD(nQtlPerChr = 1, mean = 10, meanDD = 0.75)
# Parameters of the genotypic parameterization
SP$traits[[1]]@intercept
#> [1] 9.316451
SP$traits[[1]]@addEff
#> [1] -1.527483
SP$traits[[1]]@domEff
#> [1] 1.145612Now we use this setup in a population and show the genotypic parameterization of genetic values.
# Simulate a population
pop = newPop(founderPop)
# QTL genotypes
popQtlGenos = pullQtlGeno(pop)
x_A = popQtlGenos - 1
x_D = popQtlGenos * (2 - popQtlGenos)
# Genotypic parameterization of genetic values
tmp = cbind(popQtlGenos, gv(pop),
SP$traits[[1]]@intercept,
x_A, x_A * SP$traits[[1]]@addEff,
x_D, x_D * SP$traits[[1]]@domEff)
colnames(tmp) = c("genotype", "gv", "mu0", "x_A", "x_A_a", "x_D", "x_D_d")
head(tmp)
#> genotype gv mu0 x_A x_A_a x_D x_D_d
#> 1 0 10.84393 9.316451 -1 1.527483 0 0.000000
#> 2 1 10.46206 9.316451 0 0.000000 1 1.145612
#> 3 1 10.46206 9.316451 0 0.000000 1 1.145612
#> 4 0 10.84393 9.316451 -1 1.527483 0 0.000000
#> 5 1 10.46206 9.316451 0 0.000000 1 1.145612
#> 6 1 10.46206 9.316451 0 0.000000 1 1.145612
# ... genetic value for the individual i
id = 1 # change to inspect other individuals
tmp[id, "gv"]
#> [1] 10.84393
# ... and its genotypic parameterization
tmp[id, "mu0"] + tmp[id, "x_A_a"] + tmp[id, "x_D_d"]
#> [1] 10.84393Breeding values and non-additive deviations
Average effects and breeding values
Under the breeding value parameterization
AlphaSimR decomposes the genetic value of an individual
with genotype
into the population mean
,
breeding value (also known as additive genetic value)
,
and non-additive deviations
:
Here is the mean genetic value in the current population, rather than the fixed trait intercept introduced above.
The breeding value summarizes the additive contribution associated with an individual’s alleles in a specified population. Its usual interpretation in terms of offspring performance requires assumptions about that population and how it reproduces (Falconer and Mackay 1996; Falconer 1985). We start with the statistical definition at one locus: the least-squares projection of genetic value onto centered allele dosage. The slope is the average effect of allele substitution, usually denoted as .
AlphaSimR uses observed single-locus genotype
frequencies for this calculation, without requiring Hardy-Weinberg
proportions. At multiple loci it uses a reference population that treats
loci as independent, as explained below.
Its reported breeding values therefore need not be the joint
least-squares fit to all dosages in the observed population. Even an
exact statistical projection need not equal twice the expected
offspring-mean deviation under a different mating system (Falconer 1985).
We now describe the and breeding values in more detail and later turn attention to non-additive deviations.
Consider a single locus in a population where genotype dosage occurs with frequency . Let be the mean dosage and the genetic value of dosage . The average effect of allele substitution is the regression coefficient of genetic value on dosage:
and the breeding value of an individual with dosage is:
A breeding value of an individual for a trait is the sum of over all QTL.
Three features of this definition deserve emphasis. First, and hence also are not a property of the locus alone. They depend on allele and genotype frequencies in a population and are hence population specific. Second, when there are no non-additive genotypic effects, is linear in and the regression is exact. With the scaled dosage defined above, the slope on raw dosage is , which equals the additive genotypic effect for diploids. Breeding values then account for all of the genetic variation. Third, breeding values are centered on the population mean by construction, since .
AlphaSimR computes two versions of
for every locus using genParam function. The first uses the
genotype frequencies actually observed in the population and is returned
as alpha. The second uses the genotype frequencies expected
under Hardy-Weinberg equilibrium at the observed allele frequency, and
is returned as alpha_HW. Writing
for the allele frequency, the Hardy-Weinberg genotype frequencies for
ploidy
are:
which is the familiar binomial expansion. For
we obtain the usual genotype frequencies of
,
,
and
.
The two versions of
can differ when the population departs from Hardy-Weinberg proportions,
for example through inbreeding or non-random mating. The variance that
this departure accounts for is what AlphaSimR reports as
the non-random-mating components of variance.
We now return to demonstration. We first demonstrate genotype and
allele frequencies, followed by
and breeding value parameterization of genetic values. For
comparison we also show genotypic parameterization of genetic
values. All these quantities can be obtained using
genParam. We will return to theory of non-additive
deviations after this demonstration.
# Observed genotype frequencies
tmp = table(popQtlGenos)
(fObs = prop.table(tmp))
#> popQtlGenos
#> 0 1 2
#> 0.26 0.53 0.21
# Allele frequencies and Hardy-Weinberg genotype frequencies
(tmp = mean(popQtlGenos) / 2)
#> [1] 0.475
(fHW = c((1 - tmp)^2, 2 * tmp * (1 - tmp), tmp^2))
#> [1] 0.275625 0.498750 0.225625
# Deviation from Hardy-Weinberg equilibrium frequencies
fObs - fHW
#> popQtlGenos
#> 0 1 2
#> -0.015625 0.031250 -0.015625
# Calculate the quantities
ans = genParam(pop)
# Alpha under
head(ans$alpha[[1]]) # Observed frequencies
#> [,1]
#> [1,] -1.462545
head(ans$alpha_HW[[1]]) # Hardy-Weinberg frequencies
#> [,1]
#> [1,] -1.470203
# Quantities from
# genotypic parameterization of genetic values and
# breeding value parameterization of genetic values
tmp = cbind(popQtlGenos, ans$gv[, 1],
ans$gv_mu[1], ans$gv_a[, 1], ans$gv_d[, 1],
ans$mu[1], ans$bv[, 1], ans$dd[, 1])
colnames(tmp) = c("genotype", "gv",
"mu0", "x_A_a", "x_D_d",
"meanGv", "bv", "dd")
head(tmp)
#> genotype gv mu0 x_A_a x_D_d meanGv bv dd
#> 1 0 10.84393 9.316451 1.527483 0.000000 10 1.38941761 -0.5454831
#> 2 1 10.46206 9.316451 0.000000 1.145612 10 -0.07312724 0.5351909
#> 3 1 10.46206 9.316451 0.000000 1.145612 10 -0.07312724 0.5351909
#> 4 0 10.84393 9.316451 1.527483 0.000000 10 1.38941761 -0.5454831
#> 5 1 10.46206 9.316451 0.000000 1.145612 10 -0.07312724 0.5351909
#> 6 1 10.46206 9.316451 0.000000 1.145612 10 -0.07312724 0.5351909
# ... genetic value for the individual i
id = 2 # change to inspect other individuals
tmp[id, "gv"]
#> [1] 10.46206
# ... and its breeding value parameterization
tmp[id, "meanGv"] + tmp[id, "bv"] + tmp[id, "dd"]
#> [1] 10.46206
# Mean of breeding values and deviations is (numerical) zero
mean(ans$bv)
#> [1] -8.899674e-17
mean(ans$dd)
#> [1] -2.437829e-17
# ... while this is not the case for genotypic parameterization
mean(ans$gv_a)
#> [1] 0.07637417
mean(ans$gv_d)
#> [1] 0.6071746Visualizing breeding values at one locus
We now have all the ingredients to reproduce the well-known figure of
breeding value parameterization of genetic values from Falconer and Mackay (1996). We will mirror
AlphaSimR calculation by showing the projection of genetic
values onto dosages.
First, prepare all the ingredients.
gvs = ans$gv
# also gv(pop)
meanGv = ans$mu
# also mean(gv(pop))
# also meanG(pop)
dosage = popQtlGenos
meanDosage = mean(dosage)
x = dosage - meanDosage
# alpha from observed genotypes
cov(gvs, x) / var(x)
#> 1_1
#> Trait1 -1.462545
# also ans$alpha[[1]]
bvs = ans$bv
# also bv(pop)
# also x %*% ans$alpha[[1]]Now the figure.
rangeY = range(c(gvs, meanGv + bvs))
# ... genetic values (black dots)
plot(gvs ~ dosage,
xlab = "Genotype dosage", ylab = "Genetic value",
ylim = rangeY, pch = 21, bg = "black")
# ... least-squares line
abline(a = meanGv - ans$alpha[[1]] * meanDosage, b = ans$alpha[[1]])
# ... breeding values (white dots on the line)
points(meanGv + bvs ~ dosage, pch = 21, bg = "white")
# ... deviations between genetic values and breeding values
segments(x0 = dosage, x1 = dosage,
y0 = gvs, y1 = meanGv + bvs)
# ... mean of genetic values and dosages (plus symbol)
points(meanGv ~ mean(dosage), pch = "+")
Extension to multiple loci
It is instructive to demonstrate the same principles with multiple QTL.
founderPop = quickHaplo(nInd = 100, nChr = 1, segSites = 3)
SP = SimParam$new(founderPop)
SP$addTraitAD(nQtlPerChr = 3, mean = 10, meanDD = 0.75)
SP$traits
#> [[1]]
#> An object of class "TraitAD"
#> Slot "domEff":
#> [1] 0.04998224 0.83842956 0.48326900
#>
#> Slot "addEff":
#> [1] 0.06664299 -1.11790609 -0.64435867
#>
#> Slot "intercept":
#> [1] 9.418719
#>
#> Slot "nLoci":
#> [1] 3
#>
#> Slot "lociPerChr":
#> [1] 3
#>
#> Slot "lociLoc":
#> [1] 1 2 3
#>
#> Slot "name":
#> [1] "Trait1"
pop = newPop(founderPop)
popQtlGenos = pullQtlGeno(pop)
# Observed genotype frequencies
tmp = apply(popQtlGenos, 2, table)
(fObs = apply(tmp, 2, prop.table))
#> 1_1 1_2 1_3
#> 0 0.25 0.25 0.24
#> 1 0.49 0.43 0.54
#> 2 0.26 0.32 0.22
# Allele frequencies and Hardy-Weinberg genotype frequencies
(tmp = apply(popQtlGenos, 2, mean) / 2)
#> 1_1 1_2 1_3
#> 0.505 0.535 0.490
(fHW = rbind((1 - tmp)^2, 2 * tmp * (1 - tmp), tmp^2))
#> 1_1 1_2 1_3
#> [1,] 0.245025 0.216225 0.2601
#> [2,] 0.499950 0.497550 0.4998
#> [3,] 0.255025 0.286225 0.2401
# Deviation from Hardy-Weinberg equilibrium frequencies
fObs - fHW
#> 1_1 1_2 1_3
#> 0 0.004975 0.033775 -0.0201
#> 1 -0.009950 -0.067550 0.0402
#> 2 0.004975 0.033775 -0.0201
# Calculate the quantities
ans = genParam(pop)
# Alphas under
head(ans$alpha[[1]]) # Observed frequencies
#> [,1]
#> [1,] 0.06616267
#> [2,] -1.16256496
#> [3,] -0.63300248
head(ans$alpha_HW[[1]]) # Hardy-Weinberg frequencies
#> [,1]
#> [1,] 0.06614317
#> [2,] -1.17659616
#> [3,] -0.63469329
# Quantities from
# breeding value parameterization of genetic values and
# genotypic parameterization of genetic values
tmp = cbind(ans$gv[, 1],
ans$gv_mu[1], ans$gv_a[, 1], ans$gv_d[, 1],
ans$mu[1], ans$bv[, 1], ans$dd[, 1])
colnames(tmp) = c("gv",
"mu0", "x_A_a", "x_D_d",
"meanGv", "bv", "dd")
head(tmp)
#> gv mu0 x_A_a x_D_d meanGv bv dd
#> [1,] 11.114340 9.418719 1.69562177 0.00000000 10 1.79746264 -0.6831223
#> [2,] 7.589811 9.418719 -1.82890774 0.00000000 10 -1.79367224 -0.6165170
#> [3,] 10.790399 9.418719 0.00000000 1.37168081 10 0.06805787 0.7223415
#> [4,] 10.807060 9.418719 0.06664299 1.32169857 10 0.13422054 0.6728396
#> [5,] 7.706436 9.418719 -1.76226476 0.04998224 10 -1.72750957 -0.5660544
#> [6,] 10.790399 9.418719 0.00000000 1.37168081 10 0.06805787 0.7223415From one locus to a reference population
The multilocus calculation needs one additional assumption.
AlphaSimR defines the effects in a hypothetical population
with the observed genotype frequencies at each locus, but with
independent loci. This is the linkage-equilibrium reference
population. It allows each locus, or each epistatic pair, to be
processed independently. However, it does not assume Hardy-Weinberg
equilibrium. We will discuss this assumption and other reference
populations in more detail below.
The resulting effects are then applied to the individuals. Their
breeding values and deviations can be correlated because their genotypes
need not follow the reference distribution. Thus AlphaSimR
uses observed frequencies to define the reference population, but does
not fit a joint regression to the observed multilocus genotypes. The
distinction matters with non-additive effects and linkage disequilibrium
(LD), including dominance with partial inbreeding. We explain the
consequences after introducing both kinds of non-additive deviation.
Dominance deviations
Once the breeding value has absorbed everything that can be explained by a linear regression on dosage, whatever is left over at that locus is the non-additive deviation. It is simply defined as a lack of fit. In the demonstration above the dominance deviation is obtained as:
so that exactly. Because is a least-squares projection, the dominance deviations are uncorrelated with the breeding values within a locus, and they have mean zero over the population.
These dominance deviations are often referred to as dominance values. Critically, these deviations are not the dominance genotypic effects or their contributions to genetic values ! The same holds for breeding values - they are not additive genotypic effects or their contributions to genetic values ! This is a constant source of confusion (Hill et al. 2008; Hivert et al. 2021). Breeding values are a linear projection of genetic values onto dosages (capturing additive and partly also non-additive genotypic effects), while dominance deviations are residuals of this projection (capturing the remainder of genetic values when only additive and dominance effects exist). These residuals are non-zero when there are non-zero non-additive genotypic effects as these effects make non-linear in .
Epistatic deviations
Epistatic deviations follow the same lack-of-fit logic, applied to a pair of loci rather than to a single locus. The calculation proceeds in two stages.
Stage 1: marginal genetic values
For the pair , the marginal genetic value of dosage at the locus is its genetic value averaged over the distribution of dosages at the locus :
and symmetrically for the locus . Because the epistatic contribution to genetic value is , the average over the locus contributes , which is linear in . The epistatic effect therefore shifts the marginal genetic value at the first locus () in a way that depends on the allele frequency at the second locus . Note that this is the mechanism by which epistasis contributes to breeding values and their variance (additive genetic variance) and changes in allele frequencies can thereby “convert” epistatic into additive variance (Hill 2017).
The average effect and breeding values for locus are then obtained from the marginal genetic values exactly as in the single-locus case with linear regression shown above, and the dominance deviations are residuals from that regression. Because the marginalized epistatic contribution is linear in , it is absorbed entirely by the linear regression for breeding values and leaves the dominance deviations untouched. In this reference-population decomposition, the modeled epistasis effects therefore contribute to additive and epistatic variance, but not to dominance variance. This is a property of this specific decomposition.
Stage 2: epistatic deviations
The two-locus breeding values and dominance deviations are the sums of the single-locus quantities:
and the epistatic deviation is what remains:
Summing over the pairs gives the individual’s epistatic deviation for the trait. As with the other components it has mean zero over the population, so that for every individual the following holds exactly:
Let’s demonstrate this.
founderPop = quickHaplo(nInd = 100, nChr = 2, segSites = 20)
SP = SimParam$new(founderPop)
SP$addTraitADE(nQtlPerChr = 10, mean = 10, meanDD = 0.75, relAA = 0.2)
pop = newPop(founderPop)
ans = genParam(pop)
tmp = cbind(ans$gv[, 1],
ans$gv_mu[1], ans$gv_a[, 1], ans$gv_d[, 1], ans$gv_aa[, 1],
ans$mu[1], ans$bv[, 1], ans$dd[, 1], ans$aa[, 1])
colnames(tmp) = c("gv",
"mu0", "x_A_a", "x_D_d", "x_AA_aa",
"meanGv", "bv", "dd", "aa")
head(tmp)
#> gv mu0 x_A_a x_D_d x_AA_aa meanGv bv
#> [1,] 10.983222 8.3656 0.6749354 1.951510 -0.008823369 10 0.7814198
#> [2,] 9.460670 8.3656 -1.1900039 1.746973 0.538100480 10 -1.0715269
#> [3,] 9.351284 8.3656 -0.6225043 1.771387 -0.163198900 10 -0.3556615
#> [4,] 9.809322 8.3656 -0.5276056 1.848662 0.122665629 10 -0.5517348
#> [5,] 9.752959 8.3656 0.7006672 1.020960 -0.334268318 10 0.7665867
#> [6,] 10.840587 8.3656 -0.1481544 2.582608 0.040533272 10 -0.0336519
#> dd aa
#> [1,] 0.21010631 -0.008304123
#> [2,] 0.05522538 0.476971498
#> [3,] -0.13200919 -0.161045389
#> [4,] 0.19667009 0.164386606
#> [5,] -0.67181499 -0.341812541
#> [6,] 0.84384117 0.030397591
# G = mu + A + D + AA, for every individual
resid = ans$gv[, 1] - (ans$mu[1] + ans$bv[, 1] + ans$dd[, 1] + ans$aa[, 1])
max(abs(resid)) # numerical zero for every individual
#> [1] 3.552714e-15Interpretation under linkage disequilibrium
The marginalization above weights the partner locus by its own
marginal genotype frequencies, which treats the two loci of a pair as
independent. When they are in LD, this approach need not equal the
least-squares projection in the observed population, and some of the
epistatic contribution can enter the additive component in a
least-squares fit of the pair’s epistatic value to both dosages jointly,
under the pair’s observed joint genotype frequencies (Hill and Mäki-Tanila 2015). Moreover, an
interaction between loci 1 and 2 can even affect the joint regression
coefficient of locus 3 through LD, although locus 3 has no epistatic
interaction of its own. Under LD, additive-by-additive effects can also
induce a marginal dominance component, which a parameterization built on
the joint two-locus genotype frequencies reports as dominance variance
(Álvarez-Castro and Crujeiras 2019).
AlphaSimR does not refit the pair. Because the
marginalization makes the epistatic contribution exactly linear in a
locus’s own dosage, a trait with no dominance effects has dominance
deviations of exactly zero however strong the disequilibrium. The
resulting non-additive remainder is assigned to the epistatic deviation.
The difference can affect breeding values and additive
variance as well as the dominance/epistasis split. The genetic
values and their variance are however unaffected, because
as shown above. This is one of the reasons why AlphaSimR
also reports the sum of all non-additive deviations,
,
as shown below.
The demonstration below pairs neighboring loci of
runMacs founders, which are in strong LD, for a trait
without dominance effects. For comparison, it also fits the genetic
values to all dosages jointly by least squares.
set.seed(2019)
founderLD = runMacs(nInd = 1000, nChr = 1, segSites = 40)
SPLD = SimParam$new(founderLD)
SPLD$addTraitAE(nQtlPerChr = 40, relAA = 0.5)
# Pair each locus with its neighbor, so that every pair is tightly linked
traitLD = SPLD$traits[[1]]
traitLD@epiEff[, 1:2] = matrix(1:40, ncol = 2, byrow = TRUE)
SPLD = SimParam$new(founderLD)
SPLD$manAddTrait(traitLD)
popLD = newPop(founderLD, simParam = SPLD)
ansLD = genParam(popLD, simParam = SPLD)
XLD = pullQtlGeno(popLD, simParam = SPLD)
jointA = fitted(lm(ansLD$gv[, 1] ~ XLD))
round(c(varA = ansLD$varA[1, 1], varD = ansLD$varD[1, 1],
varAA = ansLD$varAA[1, 1], covAAA_L = unname(ansLD$covAAA_L),
jointVarA = mean((jointA - mean(jointA))^2)), 4)
#> varA varD varAA covAAA_L jointVarA
#> 1.2892 0.0000 0.1011 -0.0466 1.2259Under AlphaSimR’s decomposition this trait has no
dominance variance. The joint fit can give a different additive variance
because it uses the observed associations within and between pairs when
fitting the effects. Adding genParam’s covariance terms
reconciles the total variance, but does not refit those effects.
LD within pairs also changes the mean. The mean under LE,
mu_LE, differs from the observed mean mu by
each pair’s epistatic effect times the covariance of its two
dosages:
pairCov = apply(traitLD@epiEff, 1, function(e)
e[3] * mean((XLD[, e[1]] - mean(XLD[, e[1]])) * (XLD[, e[2]] - mean(XLD[, e[2]]))))
c(mu = unname(ansLD$mu), mu_LE = unname(ansLD$mu_LE),
difference = unname(ansLD$mu - ansLD$mu_LE), sumOfPairs = sum(pairCov))
#> mu mu_LE difference sumOfPairs
#> -0.9893377 -0.7539885 -0.2353492 -0.2353492How much this matters depends on the genotype frequencies, effects,
and LD. The addTrait functions assign epistatic QTL pairs
by a random permutation across the genome, so interacting pairs are not
preferentially tightly linked. Pairs given to importTrait
are chosen by the user and may be tightly linked. Recombination erodes
LD between loosely linked loci, while drift, selection, and population
structure can generate new LD. There are special cases: in the
theoretical distribution of an unselected diploid F2 from two inbred
parents, symmetry makes the modeled additive-by-additive contribution
uncorrelated with additive dosages even with LD. This preserves the
additive projection, but need not make the dominance and epistatic
components uncorrelated.
Total non-additive deviations
AlphaSimR also reports the total non-additive deviation
as
,
available through nd(pop) or genParam(pop)$nd.
It has population mean zero because its components have mean zero. For
traits without epistasis it equals the dominance deviation; without
dominance it equals the epistatic deviation; and for purely additive
traits it is zero.
tmp = cbind(ans$gv[, 1],
ans$gv_mu[1], ans$gv_a[, 1], ans$gv_d[, 1], ans$gv_aa[, 1], ans$gv_n[, 1],
ans$mu[1], ans$bv[, 1], ans$dd[, 1], ans$aa[, 1], ans$nd[, 1])
colnames(tmp) = c("gv",
"mu0", "x_A_a", "x_D_d", "x_AA_aa", "x_N_n",
"meanGv", "bv", "dd", "aa", "nd")
head(tmp)
#> gv mu0 x_A_a x_D_d x_AA_aa x_N_n meanGv
#> [1,] 10.983222 8.3656 0.6749354 1.951510 -0.008823369 1.942687 10
#> [2,] 9.460670 8.3656 -1.1900039 1.746973 0.538100480 2.285074 10
#> [3,] 9.351284 8.3656 -0.6225043 1.771387 -0.163198900 1.608188 10
#> [4,] 9.809322 8.3656 -0.5276056 1.848662 0.122665629 1.971328 10
#> [5,] 9.752959 8.3656 0.7006672 1.020960 -0.334268318 0.686692 10
#> [6,] 10.840587 8.3656 -0.1481544 2.582608 0.040533272 2.623141 10
#> bv dd aa nd
#> [1,] 0.7814198 0.21010631 -0.008304123 0.2018022
#> [2,] -1.0715269 0.05522538 0.476971498 0.5321969
#> [3,] -0.3556615 -0.13200919 -0.161045389 -0.2930546
#> [4,] -0.5517348 0.19667009 0.164386606 0.3610567
#> [5,] 0.7665867 -0.67181499 -0.341812541 -1.0136275
#> [6,] -0.0336519 0.84384117 0.030397591 0.8742388
# G = mu + A + D + AA = mu + A + N, for every individual
resid = (ans$dd[, 1] + ans$aa[, 1]) - ans$nd[, 1]
max(abs(resid)) # numerical zero for every individual
#> [1] 0This is a quantity from the breeding value parameterization, distinct
from genParam(pop)$gv_n, the contribution of non-additive
genotypic effects to genetic values. Combining the deviations as
avoids relying on the finer dominance/epistasis split, but does not
remove the reference dependence of
or make
and
uncorrelated in the observed population.
Genetic and genic variances
Variances and covariances
Having decomposed genetic values of individuals, we can also decompose genetic variance of their population. The genetic variance is defined simply as variance of genetic values in a population:
where summation is across individuals
of a population with size
.
Note that AlphaSimR reports population variance, where we
divide by
,
instead of sample variance, where we divide by
.
This leads to only a small difference for large populations, but can be
substantial for small populations.
# Genetic variance
# = variance of genetic values
varG(pop)
#> Trait1
#> Trait1 1.292446
k = (nInd(pop) - 1) / nInd(pop)
# also var(gv(pop)) * k
# also popVar(gv(pop))
# also ans$varG
var(gv(pop)) # sample variance, while AlphaSimR reports population variance!
#> Trait1
#> Trait1 1.305501
# Difference between population and sample variance in a small population
nSmall = 10
# ... population variance
popVar(gv(pop[1:nSmall]))
#> [,1]
#> [1,] 1.13002
# ... sample variance
var(gv(pop[1:nSmall]))
#> Trait1
#> Trait1 1.255578Three reference populations
Having access to breeding values and non-additive deviations, we can
calculate their variances and covariances in the same way.
AlphaSimR does this for three different “reference”
populations (observed population, linkage-equilibrium population, and
idealized population) and understanding these is the key to
understanding the output of genParam.
As described in the sections on effects
reference and epistasis, allele
substitution effects are defined with respect to an infinite reference
population using observed single-locus genotype frequencies, allowing
for departures from Hardy-Weinberg equilibrium, but assuming linkage
equilibrium between loci, and considering epistatic pairs. Applying
these effects to the observed individuals introduces LD contributions to
variance components through covX_L and covariances between
components.
The observed population is the set of individuals in
a population and uses their actual genotypes. Variances computed here
are the genetic variances of the population (varG
for
,
varA for
,
etc.). These variances include deviations from Hardy-Weinberg or other
equilibria, such as linkage disequilibrium (LD). This is best
demonstrated with AlphaSimR code.
# Additive genetic variance
# = variance of additive genetic (breeding) values
varA(pop)
#> Trait1
#> Trait1 1
# also var(bv(pop)) * k
# also popVar(bv(pop))
# also ans$varA
# Dominance genetic variance
# = variance of dominance deviations
varD(pop)
#> Trait1
#> Trait1 0.2215577
# also var(dd(pop)) * k
# also popVar(dd(pop))
# also ans$varD
# Epistatic genetic variance
# = variance of epistatic deviations
varAA(pop)
#> Trait1
#> Trait1 0.0603773
# also var(aa(pop)) * k
# also popVar(aa(pop))
# also ans$varAA
# Non-additive genetic variance
# = variance of non-additive deviations
varN(pop)
#> Trait1
#> Trait1 0.3176149
# also var(nd(pop)) * k
# also popVar(nd(pop))
# also ans$varN
# Covariances (we describe these covariance in a separate section below)
# Because G = A + D + ... = A + N then
# varG = varA + varD + 2covAD + ... = varA + varN + 2covAN
(tmp = popVar(cbind(bv(pop), dd(pop), aa(pop), nd(pop))))
#> [,1] [,2] [,3] [,4]
#> [1,] 1.00000000 0.01138957 -0.02397402 -0.01258446
#> [2,] 0.01138957 0.22155774 0.01783992 0.23939766
#> [3,] -0.02397402 0.01783992 0.06037730 0.07821722
#> [4,] -0.01258446 0.23939766 0.07821722 0.31761488
# also cov(bv(pop), dd(pop)) * k
# also cov(bv(pop), aa(pop)) * k
# also cov(dd(pop), aa(pop)) * k
# also cov(bv(pop), nd(pop)) * k
varG(pop)
#> Trait1
#> Trait1 1.292446
sum(tmp[1:3, 1:3]) # varA + varD + 2covAD + ...
#> [1] 1.292446
sum(tmp[c(1,4), c(1,4)]) # varA + varN + 2covAN
#> [1] 1.292446The linkage-equilibrium population has the same genotype frequencies at each locus as the observed population, but loci are treated as independent (non-correlated). Variances computed here are sums of single-locus (or single-pair for epistasis, with the two loci of a pair also independent) contributions with no covariance (LD) between loci. We will demonstrate the linkage-equilibrium population variances below.
The idealized population has the same
allele frequencies as the observed population, but genotype
frequencies at Hardy-Weinberg proportions and loci in linkage
equilibrium. These variances are the genic variances:
genicVarG for
,
genicVarA for
,
etc. The genic variance is the variance the population would have at the
same allele frequencies under Hardy-Weinberg and linkage equilibrium. We
will demonstrate the idealized population variances below.
The genic variances are computed as exact theoretical expectations over the frequency distribution rather than variances over observed individuals. For the additive component, let , then we have:
and similarly for other components. Because breeding values and deviations have mean zero, these sums of squares are variances. The total genic variance is then sum of the component genic variances.
Following the distinction between Hardy-Weinberg and linkage
disequilibrium contributions described by Bulmer
(1976), AlphaSimR expresses genetic variance as
genic variance plus two additional terms. For additive genetic variance
we have:
Here,
(genParam(pop)$genicVarA) is the variance in the idealized
population. The first addition,
(genParam(pop)$covA_HW), is the variance in the
linkage-equilibrium population minus that in the idealized population.
It measures the change caused by replacing Hardy-Weinberg genotype
frequencies with observed frequencies while keeping loci independent.
The second addition,
(genParam(pop)$covA_L), is the variance in the observed
population minus that in the linkage-equilibrium population. It accounts
for linkage disequilibrium (LD) between loci. Thus, adding both terms
gives the full
(genParam(pop)$varA).
The same partition applies to the additive, dominance, epistatic, total non-additive components, and total genetic variance. Non-random mating, drift, and selection can change these terms through changes in genotype frequencies and linkage disequilibrium between loci, even when allele frequencies change little. We demonstrate departures from Hardy-Weinberg and linkage equilibrium in the following. For a more comprehensive study see Lara et al. (2022).
Departures from Hardy-Weinberg proportions
covX_HW measures the difference in the variance of
component X between the linkage-equilibrium and idealized populations,
it compares the variance at observed genotype frequencies with that at
Hardy-Weinberg genotype frequencies, using the corresponding
substitution effects in each case. For a purely additive diploid trait,
excess homozygosity increases the single-locus dosage variance and hence
this additive genetic variance term. With non-additive effects, changes
in the substitution effects and deviations also matter, so
covX_HW need not be positive for every component. The
example below uses a trait with dominance, for which the dominance term
is negative, and ends by contrasting it with a purely additive
trait.
Worked example: equal allele frequencies, different inbreeding
We construct two diploid populations with one QTL, the same genotypic effects, but different genotype frequencies. In the first population we have genotype frequencies for dosages , exactly as expected with Hardy-Weinberg equilibrium (HWE) at . In the second population we have genotype frequencies hence fully inbred, with the same allele frequency. With only one locus, there is no LD.
set.seed(113)
founderDemo = quickHaplo(nInd = 1000, nChr = 1, segSites = 1)
SPDemo = SimParam$new(founderDemo)
SPDemo$addTraitAD(nQtlPerChr = 1, meanDD = 0.5)
popDemo = newPop(founderDemo, simParam = SPDemo)
# One representative of each dosage, repeated to set exact frequencies
representatives = match(0:2, as.vector(pullQtlGeno(popDemo, simParam = SPDemo)))
stopifnot(!anyNA(representatives))
popHWE = popDemo[rep(representatives, times = c(64, 32, 4))]
popInbred = popDemo[rep(representatives, times = c(80, 0, 20))]
referenceSummary = function(population) {
g = genParam(population, simParam = SPDemo)
c(p = mean(pullQtlGeno(population, simParam = SPDemo)) / 2,
alpha = g$alpha[[1]][1],
alpha_HW = g$alpha_HW[[1]][1],
genicVarG = unname(g$genicVarG[1]),
HW_adjustment = unname(g$covG_HW[1]),
observed_frequency_VarG = unname(g$genicVarG[1] + g$covG_HW[1]),
observed_VarG = g$varG[1, 1],
LD_adjustment = unname(g$covG_L[1]),
genicVarD = unname(g$genicVarD[1]),
observed_VarD = g$varD[1, 1])
}
round(rbind(HWE = referenceSummary(popHWE),
inbred = referenceSummary(popInbred)), 4)
#> p alpha alpha_HW genicVarG HW_adjustment observed_frequency_VarG
#> HWE 0.2 1.8602 1.8602 1.1598 0.0000 1.1598
#> inbred 0.2 1.4310 1.8602 1.1598 0.1507 1.3105
#> observed_VarG LD_adjustment genicVarD observed_VarD
#> HWE 1.1598 0 0.0524 0.0524
#> inbred 1.3105 0 0.0524 0.0000The allele frequency, alpha_HW, and genic variances are
identical in the two rows. However, alpha changes: under
Hardy-Weinberg equilibrium it is
,
whereas in the fully inbred population it is
,
because only the two homozygotes remain. Their genetic values have not
changed; the regression defining the breeding values has changed.
In the Hardy-Weinberg equilibrium row, HW_adjustment is
zero. In the inbred row, observed_frequency_VarG includes
the adjustment and equals observed_VarG.
LD_adjustment is zero in both rows since we are working
with one QTL. The inbred population also has zero observed dominance
variance, despite non-zero dominance genotypic effect and positive genic
dominance variance: its Hardy-Weinberg equilibrium reference includes
heterozygotes, while the observed population contains none.
For a purely additive one-locus trait, full inbreeding at fixed allele frequency doubles variance, from to . With dominance or epistasis, a doubling of total genetic variance is not a general expectation.
Linkage disequilibrium and the Bulmer effect
After accounting for genotype frequencies at each locus, the
remaining additional term
(genParam(pop)$covA_L), measures the difference between the
observed and linkage-equilibrium populations. For additive variance,
covA_L is the covariance contribution between loci arising
from LD. It is obtained by subtracting genicVarA and
covA_HW from the observed additive variance
varA.
The change in additive genetic variance caused by selection-induced LD is known as the Bulmer effect (1971). Directional or stabilizing selection can generate a negative LD contribution, whereas disruptive selection can generate a positive contribution. Recombination reduces these associations and can therefore reveal some of the variance masked by negative LD.
Worked example: selection changes genetic and genic variance
The Bulmer partitioning is easiest to see by performing selection and then inspecting what changed. In the example below the genic additive variance is almost unchanged after one generation of strong selection, because allele frequencies have barely moved, while the additive genetic variance has dropped because selection has generated negative linkage disequilibrium.
set.seed(1234)
founderSelection = quickHaplo(nInd = 1000, nChr = 10, segSites = 20)
SPSelection = SimParam$new(founderSelection)
SPSelection$addTraitA(nQtlPerChr = 10)
SPSelection$setVarE(h2 = 0.5)
popSelection = newPop(founderSelection, simParam = SPSelection)
selectedPop = selectInd(popSelection, nInd = 100, simParam = SPSelection)
selectionProgeny = randCross(selectedPop, nCrosses = 1000, simParam = SPSelection)
beforeSelection = genParam(popSelection, simParam = SPSelection)
afterSelection = genParam(selectionProgeny, simParam = SPSelection)
round(c(varA_before = beforeSelection$varA[1,1],
varA_after = afterSelection$varA[1,1],
genicA_before = unname(beforeSelection$genicVarA[1]),
genicA_after = unname(afterSelection$genicVarA[1]),
covA_L_before = unname(beforeSelection$covA_L[1]),
covA_L_after = unname(afterSelection$covA_L[1])), 3)
#> varA_before varA_after genicA_before genicA_after covA_L_before
#> 1.000 0.832 1.017 0.989 -0.014
#> covA_L_after
#> -0.153Choosing a reference population
The two examples illustrate why the choice of reference population
matters. In most cases, users will be interested in variances in the
observed population. The other two reference populations are useful when
we try to understand why variances differ. For
ans = genParam(pop), we have:
| Population | Genotype frequencies | Association between loci (LD) | Mean | Total variance |
|---|---|---|---|---|
| Observed | Observed | Observed | ans$mu |
varG(pop) or ans$varG
|
| Linkage equilibrium | Observed | Independent | ans$mu_LE |
ans$genicVarG + ans$covG_HW |
| Idealized | HWE at current allele frequencies | Independent | ans$mu_HW |
ans$genicVarG |
The means split in the same way as the variances.
ans$mu_LE - ans$mu_HW is the change in the mean from
departures from Hardy-Weinberg genotype frequencies, which only
dominance effects respond to, because the mean additive coding depends
only on the allele frequency. ans$mu - ans$mu_LE is the
change in the mean from LD, which only epistatic effects respond to: for
a diploid it is the sum over epistatic pairs of the pair’s effect times
the covariance of its two dosages. Without epistasis,
ans$mu_LE equals ans$mu. Because the
deviations are centered on the observed mean, none of these differences
appears in bv, dd or aa. The LD
part matters because it changes the mean without any change in allele
frequencies: if the disequilibrium decays, for example when selection
stops, the mean moves by the LD part even though no allele frequency
changes.
Thus, to retain departures from Hardy-Weinberg equilibrium but remove
LD, use ans$genicVarG + ans$covG_HW. This is generally
not the variance of genetic values in the observed
population: recovering that variance also requires
ans$covG_L. The same recipe applies with G
replaced by A, D, AA, or
N. Note that changing reference population also changes the
substitution effects: the idealized calculation uses
alpha_HW, while the linkage-equilibrium calculation uses
alpha, the substitution effects at the observed genotype
frequencies with loci treated as independent. Adding
covX_HW therefore accounts for changes in both genotype
frequencies and substitution effects.
Covariances between genetic components
Returning to the population with dominance and epistasis used
earlier, we can also examine covariances between its genetic components.
Because the total genetic value is a sum of multiple components, the
total genetic variance also includes covariances between these
components. These are reported separately as covAD_L,
covAAA_L, covDAA_L, and covAN_L,
respectively the covariances between breeding values and dominance
deviations, between breeding values and epistatic deviations, between
dominance and epistatic deviations, and between breeding values and
non-additive deviations. All these are zero in the independent-locus
reference population, and can be non-zero in the observed population.
The complete identity is:
which follows directly from and evaluating .
# The full variance identity
varG = ans$varG[1,1]
varG_via_partsADAA = unname(ans$varA[1,1] + ans$varD[1,1] + ans$varAA[1,1] +
2*(ans$covAD_L[1] + ans$covAAA_L[1] + ans$covDAA_L[1]))
varG_via_partsAN = unname(ans$varA[1,1] + ans$varN[1,1] +
2*(ans$covAN_L[1]))
c(varG = varG, varG_via_partsADAA = varG_via_partsADAA, varG_via_partsAN = varG_via_partsAN)
#> varG varG_via_partsADAA varG_via_partsAN
#> 1.292446 1.292446 1.292446Covariances between traits
With more than one trait, genParam() gives the same
decomposition for the covariances between traits, as matrices. For each
component X, genicCovX is the genic covariance
under Hardy-Weinberg and linkage equilibrium, covX_HWMat
adjusts it for departures from Hardy-Weinberg proportions, and
covX_LMat is the contribution of linkage disequilibrium, so
that genicCovX + covX_HWMat + covX_LMat equals
varX. The diagonals of these matrices are the vectors
described above.
A genic covariance between two traits only comes from loci that are QTL for both of them. Below, the first two traits are added together, so they share their QTL, and their genic covariance reflects the correlation between their effects. The third trait’s QTL are sampled separately, so it shares at most a few of them with the first two. Its genic covariance with them comes only from those few shared QTL, and the rest of its covariance with them is due to linkage disequilibrium.
founders = quickHaplo(nInd = 200, nChr = 2, segSites = 100)
SP2 = SimParam$new(founders)
SP2$nThreads = 1L
SP2$addTraitA(nQtlPerChr = 20, mean = c(0, 0), var = c(1, 1),
corA = matrix(c(1, 0.7, 0.7, 1), nrow = 2))
SP2$addTraitA(nQtlPerChr = 20)
pop2 = newPop(founders, simParam = SP2)
ans2 = genParam(pop2, simParam = SP2)
# Genic, Hardy-Weinberg and linkage disequilibrium parts of
# the additive genetic covariances
round(ans2$genicCovA, 3)
#> Trait1 Trait2 Trait3
#> Trait1 1.060 0.731 -0.003
#> Trait2 0.731 1.064 0.036
#> Trait3 -0.003 0.036 1.059
round(ans2$covA_HWMat, 3)
#> Trait1 Trait2 Trait3
#> Trait1 -0.012 -0.010 0.000
#> Trait2 -0.010 -0.008 0.000
#> Trait3 0.000 0.000 -0.018
round(ans2$covA_LMat, 3)
#> Trait1 Trait2 Trait3
#> Trait1 -0.047 -0.057 0.046
#> Trait2 -0.057 -0.056 0.058
#> Trait3 0.046 0.058 -0.041
# The parts add up to the additive genetic (co)variances
all.equal(ans2$genicCovA + ans2$covA_HWMat + ans2$covA_LMat, ans2$varA)
#> [1] TRUEWhere the decomposition departs from least squares
We have so far calculated allele substitution effects in a reference population with independent loci, and then applied these effects to the observed individuals. We now examine how this calculation differs from fitting genetic values to all QTL dosages simultaneously in the observed population.
We have already seen that the two calculations can differ with epistasis and LD. Here we demonstrate that they can also differ with dominance, partial inbreeding, and LD, even without epistasis. The difference concerns the allele substitution effects themselves, and hence all downstream quantities, such as breeding values, deviations, and variances.
Dominance with partial inbreeding and LD
Recall the single-locus regression introduced above. The fitted line gives the population mean plus the breeding values, and the lack of fit gives the dominance deviations. Because the line is fitted by least squares, these deviations are uncorrelated with the dosage at that locus.
With several loci, a dominance deviation at one locus can nevertheless be correlated with the dosage at another locus. The single-locus regressions do not use this association, while a joint regression can use it to explain some of the remaining genetic variation. The single-locus and joint regressions can therefore give different allele substitution effects.
Accounting for inbreeding at each locus does not resolve this difference. The observed genotype frequencies used in each single-locus regression describe departures from Hardy-Weinberg proportions at that locus, including those due to inbreeding. However, they do not describe how genotypes at different loci occur together, which is the additional information used by the joint regression.
Worked example: a backcross followed by selfing
We first create two diploid inbred parents and a trait with additive and dominance effects at five QTL. We cross the parents to make an F1, backcross the F1 to the first parent, and then self the backcross population for two generations. The QTL are on one chromosome, so linkage can maintain associations between them.
set.seed(316)
founderBC = runMacs(nInd = 2, nChr = 1, segSites = 1000, inbred = TRUE)
SPBC = SimParam$new(founderBC)
SPBC$addTraitAD(nQtlPerChr = 5, meanDD = 0.8, varDD = 0.2)
parentsBC = newPop(founderBC, simParam = SPBC)
F1 = makeCross(parentsBC, matrix(c(1, 2), 1), simParam = SPBC)
BC1 = makeCross2(F1, parentsBC[1], matrix(1, 3000, 2), simParam = SPBC)
BC1S1 = self(BC1, simParam = SPBC)
BC1S2 = self(BC1S1, simParam = SPBC)We now compare additive, dominance, and total genetic variances from
genParam using single-locus regressions with those from a
joint regression. For the latter, we subtract the mean of the fitted
values when calculating the variance, as elsewhere in this article. We
also report covAD_L, the covariance between breeding values
and dominance deviations from genParam, while this is zero
by definition in the joint regression. With only five QTL and 3,000
individuals, this example has far fewer regression coefficients than
individuals.
compareFits = function(pop) {
X = pullQtlGeno(pop, simParam = SPBC)
g = gv(pop)[, 1]
jointA = fitted(lm(g ~ X))
ansBC = genParam(pop, simParam = SPBC)
c(varA = ansBC$varA[1, 1],
varD = ansBC$varD[1, 1],
covAD_L = unname(ansBC$covAD_L),
varG = ansBC$varG[1, 1],
jointVarA = mean((jointA - mean(jointA))^2),
jointVarD = mean((g - jointA)^2),
jointVarG = mean((g - mean(g))^2))
}
round(rbind(BC1 = compareFits(BC1),
BC1S1 = compareFits(BC1S1),
BC1S2 = compareFits(BC1S2)), 4)
#> varA varD covAD_L varG jointVarA jointVarD jointVarG
#> BC1 0.0211 0.0000 0.0000 0.0211 0.0211 0.0000 0.0211
#> BC1S1 0.2092 0.1691 -0.0035 0.3714 0.2025 0.1689 0.3714
#> BC1S2 0.3809 0.1082 -0.0026 0.4837 0.3757 0.1080 0.4837In the backcross, each locus has at most two genotypes: a homozygote
matching the recurrent parent and a heterozygote, or just one genotype
if the parents carry the same allele. A straight line can fit the
genetic values of two genotypes exactly. There is therefore no lack of
fit at a locus, even though its dominance genotypic effect can be
non-zero. Consequently, the single-locus and joint regressions give the
same breeding values and variances, and covAD_L is
zero.
After selfing, all three genotypes can occur at a locus, so the
single-locus regressions can leave non-zero dominance deviations. With
partial inbreeding and LD, these deviations can be associated with
dosages at other loci. The two calculations can now give different
allele substitution effects, breeding values, dominance deviations, and
variances, while covAD_L can be non-zero. The genetic
values and their total variance are however still exact. As shown above, we recover the total genetic
variance from additive and dominance variances and twice their
covariance.
When do the calculations agree?
For a purely additive trait, the genetic value is already a linear
function of dosages, so the two calculations give the same additive
values regardless of LD. For diploid traits with dominance but without
epistasis, we can express agreement in terms of the dominance
deviations. Let
denote the dominance deviation at locus
calculated by AlphaSimR, and
the total dominance deviation. The two calculations give the same
additive values exactly when
is uncorrelated with the dosage
at every locus
in the observed population:
Recall that the single-locus regression already makes
.
Agreement therefore requires the covariances with deviations at other
loci to sum to zero for every dosage. This is stronger than requiring
covAD_L to be zero: the combined additive value can be
uncorrelated with
even when some individual dosages are correlated with it.
The following cases satisfy the condition for agreement:
| Population | Why the single-locus calculation gives the joint additive values |
|---|---|
| Independent genotypes across loci, with any single-locus genotype frequencies | A dominance deviation at one locus is independent of the dosage at another locus. |
| Random union of gametes, even with gametic LD | The single-locus regression removes the association of dominance with dosage at its own locus and with dosages at other loci. |
| At most two genotypes at each locus, including a backcross or a fully inbred population | The single-locus genetic values can be fitted exactly by a straight line on the genotypes present. |
The first case is the reference population used by
AlphaSimR: departures from Hardy-Weinberg proportions do
not prevent an orthogonal decomposition when loci are independent (Vitezica et al. 2017). Using observed genotype
frequencies does not, however, guarantee orthogonality under LD.
The second case is consistent with the variance formula of Avery and Hill (1979) for linked loci with dominance under random union of gametes. It combines per-locus average effects and LD terms, with no covariance term between breeding values and dominance deviations.
The distinction between departures from Hardy-Weinberg proportions and LD also matters when interpreting the literature. Wang et al. (1998) derived the per-locus average effect using observed genotype frequencies, but analyzed departures from Hardy-Weinberg proportions with independent loci and LD under Hardy-Weinberg proportions separately. Their analysis therefore does not establish agreement when both departures occur together.
The selfed generations in our example combine partial inbreeding with
LD. In this setting, dominance can make the single-locus and joint
regressions give different allele substitution effects. The breeding
values and dominance deviations obtained by summing these single-locus
contributions can be correlated in the observed population, as reported
by covAD_L. The reported varA can be either
higher or lower than the additive variance of a joint fit.
Independence in the reference population concerns the genotypes across loci. Inbreeding can also create associations between identity by descent at different loci, including unlinked loci. These associations are called identity disequilibrium and can affect genetic variances (Tachida and Cockerham 1989). They are absent from the independent-locus reference population, although their consequences can appear in the variances and covariances calculated from the observed individuals.
Note that the first two cases describe genotype distributions, from which a finite population can depart. Also, even if the population is in HWE at each locus, this does not guarantee that the joint genotype distribution follows random union of gametes. The third case holds for the genotypes actually present, as illustrated by the backcross example above.
These cases concern additive and dominance effects in diploids. Epistasis can cause further differences under LD, including in fully inbred populations, as discussed above.
The restriction to diploids also matters. In diploids, each gamete contributes one allele copy at each locus, whereas in polyploids it can contribute several. The agreement under random union of gametes therefore needs separate consideration for polyploids.
Why not fit all QTL to the finite population?
The joint regression was useful for the example above where we had a few QTL and many individuals. However, we can have situations where we have more QTL than individuals. As we add more and more additive dosage covariates into the joint regression, it can fit the observed genetic values more closely, including non-additive variation associated with those dosages.
In the extreme, a centered dosage matrix with rank for individuals can fit every centered genetic value exactly. All observed genetic variance would then be called additive, even though the trait has non-additive genotypic effects. The relevant condition is the number of linearly independent predictors, not simply the number of QTL. Such a fit describes the individuals present, but need not describe their offspring, in which the associations can change.
AlphaSimR instead uses the known genotypic effects and
the genotype frequencies at each locus to define the reference
population. This calculation remains practical with many QTL and
different ploidy levels, while retaining the limitations demonstrated
above. A decomposition using multilocus genotype frequencies has been
proposed (Álvarez-Castro and Crujeiras
2019), derived in full for two loci, but fitting the observed
individuals exactly does not by itself solve the problem of predicting
performance in the next generation. For that purpose, we also need to
consider which population the effects refer to and how it
reproduces.
Polyploids and digenic dominance
Genotype coding and model limitations
AlphaSimR uses one dominance genotypic effect
per locus. For diploids, this describes the departure of the
heterozygote’s genetic value from the midpoint of the two homozygotes.
An autotetraploid locus has three heterozygous genotypes, with dosages
1, 2, and 3. Describing their departures independently requires three
dominance parameters, conventionally expressed as digenic, trigenic, and
quadrigenic effects, respectively involving two, three, and four alleles
at the locus (Gallais 2003).
AlphaSimR models only digenic dominance. Its scaled
dominance dosage,
,
is proportional to the number of heterozygous allele pairs: each of the
copies of the “1” allele pairs with each of the
copies of the “0” allele. The dominance contribution
therefore follows a fixed pattern across genotypes rather than allowing
a separate effect for each heterozygote. The scaled dosages
and
for diploids and autotetraploids are illustrated in
vignette("traits").
This restriction concerns the assumed genotypic model, not the
completeness of its decomposition. The identity
still holds for polyploids, with dominance deviations calculated from
the modeled genetic values. AlphaSimR does not represent
trigenic or quadrigenic dominance genotypic effects, so its reported
dominance variance reflects only the digenic dominance included in the
model.
Hardy-Weinberg reference and double reduction
There is a second polyploid-specific caveat. This one concerns the
Hardy-Weinberg reference. The binomial genotype frequencies used to
compute the genic variances are the correct polysomic equilibrium only
under random chromosome segregation without double reduction.
Quadrivalent pairing, described in the Genetic Recombination article,
produces double reduction and therefore an excess of homozygotes
relative to the binomial expectation. AlphaSimR does not
model this in its Hardy-Weinberg reference, so in a simulation with
SP$quadProb > 0 the resulting excess homozygosity
appears in the covD_HW and covA_HW terms as
though it were non-random mating. This is arguably the right place for
it, since the effect on the variance is the same, but it means those
terms should not be read as a pure measure of the mating system in an
autopolyploid simulation.
Relationship to classical theory
The decomposition of genetic variance goes back to Fisher (1919), who connected Mendelian
inheritance to the resemblance between relatives. Fisher separated
genetic values at many loci by least squares into additive effects and
dominance deviations, and noted that interactions between loci leave a
further remainder. Cockerham (1954) and
Kempthorne (1954) extended the partition
to epistatic components and gave their contributions to covariances
between relatives. These partitions connect variance components to
covariances between relatives, heritability, and selection response
under their stated assumptions. The additive-by-additive contrast used
by AlphaSimR is the product of the two single-locus
additive contrasts, which is the standard construction and the one that
makes the components orthogonal when loci are independent. In the
terminology of the natural and orthogonal interactions framework of
Álvarez-Castro and Carlborg (2007),
AlphaSimR computes the breeding value parameterization
against the observed single-locus genotype frequencies, which is what
makes alpha and alpha_HW differ.
Orthogonality of the components holds in the LE reference population,
as well as in the idealized population with HWE and LE. In an observed
population the components can be correlated. The cross-component
covariances are reported explicitly as covAD_L,
covAAA_L, and covDAA_L, rather than being
assumed zero. Consequently, recovering varG from
varA, varD, and varAA generally
requires the cross-component covariance terms.
Two conventions are available for a population away from equilibrium,
and it is worth knowing which one is in use. The first convention
defines the effects in an equilibrium reference population and lets
disequilibrium appear as covariances between components, leaving the
effects themselves unchanged; this is the convention of Wang and Zeng (2006), which makes the Bulmer
partitioning above interpretable. The second convention refits the
effects against the observed multilocus genotype frequencies, which
restores orthogonality at the cost of absorbing the disequilibrium into
the components themselves; Álvarez-Castro and
Crujeiras (2019) give such a decomposition for epistatic traits.
AlphaSimR follows the first convention: it retains
covariances between components while recomputing the average effects of
allele substitution from the current marginal genotype frequencies. Its
equilibrium reference has the observed genotype frequencies at each
locus with the loci independent, so the effects are least-squares
effects in that reference at any level of inbreeding. LD, including
within an epistatic pair, enters the observed means, variances, and
covariances rather than the substitution effects. The second convention
is not used, and Where the decomposition
departs from least squares describes what that costs and why.
One further point of interpretation, made forcefully by Hill et al. (2008), is worth keeping in mind
when setting up a simulation with epistasis. A model with substantial
additive-by-additive epistasis genotypic effects will usually produce a
population in which most of the genetic variance is captured by
statistical additive genetic variance, particularly when allele
frequencies are away from one half. The relAA argument
specifies the ratio of epistatic to additive variance expected in a
population at allele frequency 0.5 in linkage equilibrium; observed
ratios in a simulated population will typically be smaller, sometimes
much smaller. This is not an artifact of the implementation but a
property of the decomposition itself.
Lastly, much of the classical quantitative genetics theory concerns
covariances between relatives and the partitioning of phenotypic and
genetic variance within and between families. Readers can explore these
relationships by simulating crosses and comparing parent and offspring
genetic values under the mating system of interest. The
parentAverage and mendelianSampling functions
can also be used to partition variation between and within families. The
companion Genetic Recombination
article explains the recombination mechanisms underlying those crosses.
As an exercise, simulate several families and compare variation in
parental averages with variation among offspring within each family.