Exploring quantitative traits in a mouse population
Practical 1: Variation, association and family structure
Learning objectives
After this practical you should be able to describe a quantitative trait using means, variances and distributions; distinguish phenotypic association from genetic correlation; explore sex, replicate and family patterns; and explain why these summaries do not estimate heritability.
You need introductory statistics and basic R. All calculations use base R; no additional analysis packages are required. Work through the questions before opening the suggested answers.
How do body weight and blood glucose vary among mice, and how do those patterns relate to family, sex and experimental replicate?
The data describe an F2 population derived from M16 and ICR lines, with traits measured at eight weeks. The historical population description reports 1,181 mice; the teaching file contains 1,177 records. The file alone does not explain the difference, so we use its observed record count throughout.
Variable
Meaning
R representation
BW
Body weight
Numeric
Gl
Blood glucose measurement
Numeric
sire, dam
Father and mother labels
Factors
sex
Recorded sex
Factor
reps
Experimental replicate
Factor
The RDS file does not include measurement-unit metadata. We therefore label axes in recorded units rather than infer units. Parent labels are identities, not numerical covariates. Row names are retained source labels; do not assume they provide a complete pedigree or a validated identifier mapping.
Load a reproducible data version
Download the public teaching file once into R’s temporary directory. The URL fixes a repository revision; the checksum checks that the bytes match the version used here. No raw data are changed or added to the course repository. Internet access is needed for the initial download.
Question 1. How many records and variables are present? Are any values missing? Why should we check before calculating a mean?
Show R code
c(records =nrow(mouse), variables =ncol(mouse))
records variables
1177 6
Show R code
colSums(is.na(mouse))
sire dam sex reps Gl BW
0 0 0 0 0 0
Show R code
table(mouse$sex)
Female Male
589 588
Show R code
table(mouse$reps)
1 2 3
415 427 335
Suggested answer
There are 1177 records and 6 variables. This version has no missing values in these fields. Missing values in another dataset would require a declared exclusion or imputation policy and reported denominators. A missing phenotype is not a zero phenotype.
2. Describe quantitative variation
For observations \(y_1,\ldots,y_n\), the sample mean is \(\bar y=\sum_i y_i/n\) and the sample variance is
The standard deviation \(s_y\) has the same units as the observations; variance has squared units. These describe the available phenotypes, combining genetic, environmental and other sources of variation.
Question 2. Calculate the mean, variance and standard deviation of each trait. Can their raw variances be compared as measures of genetic variability?
Mean body weight is 38.724 and mean glucose is 144.223 in their recorded units. Raw variances depend on measurement scale, and neither variance is an estimate of additive genetic variance.
Inspect the distributions
Show R code
local({ old <-par(mfrow =c(2, 2), mar =c(4, 4, 2, 1))on.exit(par(old))for (trait inc("BW", "Gl")) {hist(mouse[[trait]], breaks =20, col ="#4C92B0", border ="white",main = trait, xlab =paste(trait, "(recorded units)")) }for (trait inc("BW", "Gl")) {qqnorm(mouse[[trait]], main =paste("Normal Q-Q plot:", trait), pch =16,cex =0.5, col ="#4C92B0")qqline(mouse[[trait]], col ="#B65C39", lwd =2) }})
Figure 1: Distributions of body weight and glucose in the teaching sample.
Question 3. Which trait has the more pronounced upper tail? Do the plots justify saying that all observations are normally distributed?
Suggested answer
Inspect departures from the Q-Q reference line, particularly in the tails. Glucose has a relatively pronounced upper tail. A roughly bell-shaped histogram does not prove normality. These are marginal phenotype distributions; a later regression model makes assumptions about conditional residuals, and observations within families may be dependent.
3. Explore the relationship between traits
Sample covariance measures joint variation, while Pearson correlation rescales covariance:
\[r_{BW,Gl}=\frac{s_{BW,Gl}}{s_{BW}s_{Gl}}.\]
Question 4. Are heavier mice generally associated with higher glucose measurements? Does that association establish genetic correlation or causation?
Figure 2: Phenotypic association between body weight and glucose; the line is a descriptive linear fit.
Suggested answer
The observed correlation is 0.544, a positive phenotypic association. Shared environment, sex, family and other factors can contribute. Estimating genetic correlation requires a model separating genetic covariance from other covariance. A conventional independent-observation correlation test would also need its sampling assumptions reviewed for this family-structured sample.
4. Compare sex and replicate groups
Question 5. Compare group sizes, means and within-group spread. Does a difference between groups establish its biological cause?
local({ old <-par(mfrow =c(2, 2), mar =c(4, 4, 2, 1))on.exit(par(old))for (group inc("sex", "reps")) {for (trait inc("BW", "Gl")) {boxplot(reformulate(group, response = trait), data = mouse,col ="#86B7A3", main =paste(trait, "by", group),ylab =paste(trait, "(recorded units)")) } }})
Figure 3: Trait distributions by recorded sex and experimental replicate.
Suggested answer
Describe the direction, size and overlap of the plotted differences. Groups may differ in composition as well as environment; these comparisons are descriptive and do not identify causal effects. A later model should consider sex, replicate and the sampling design together.
5. Examine family structure
Related mice share some inherited variation, but family membership may also capture shared environment. Paternal and maternal families are different groupings; a sire can have offspring from several dams.
Question 6. How many sire and dam families are represented? Are their sizes balanced? Does a family pattern directly estimate heritability?
Show R code
family_sizes <-list(sire =table(mouse$sire), dam =table(mouse$dam))t(vapply(family_sizes, function(n) {c(families =length(n), minimum =min(n), maximum =max(n))}, numeric(3)))
families minimum maximum
sire 11 74 119
dam 55 15 24
Show R code
# How many sire labels occur within each dam's records?table(vapply(split(as.character(mouse$sire), mouse$dam),function(x) length(unique(x)), integer(1)))
1
55
Show R code
local({ old <-par(mfrow =c(1, 2), mar =c(4, 4, 2, 1))on.exit(par(old))for (trait inc("BW", "Gl")) {boxplot(reformulate("sire", response = trait), data = mouse,col ="#86B7A3", main = trait, xlab ="Sire label",ylab ="Recorded units", las =2) }})
Figure 4: Phenotype distributions within paternal families. Differences can reflect inherited and environmental sources.
Suggested answer
There are 11 sire families and 55 dam families. Their sizes range from 74 to 119 and from 15 to 24, respectively. Family contrasts alone do not separate additive genetic, maternal and shared environmental effects. Later practicals introduce pedigree relationships and variance-component models.
6. Move from exploration to modelling
An exploratory regression can compare sex and replicate patterns while keeping family modelling for a later practical. For body weight, write
\[BW_i=\mu+\beta_{sex(i)}+\gamma_{rep(i)}+e_i.\]
Here \(\mu\) is a reference-group mean, the coefficients express group contrasts, and \(e_i\) is the residual. This model does not include genetic effects or account for within-family dependence.
Show R code
fit <-lm(BW ~ sex + reps, data = mouse)round(coef(fit), 3)
Question 7. Why is the residual variance not automatically environmental variance? Why should we avoid interpreting regression significance as a heritability estimate?
Suggested answer
Residuals contain all variation not described by these predictors, including unmodelled genetic and environmental sources. Heritability requires a defined population, variance decomposition and appropriate relationship/sampling model. Coefficient p-values from this simple model would rely on error assumptions that do not address family dependence.
Exercises
Multiply body weight by 1,000. Predict the changes in its mean, variance, standard deviation and correlation with glucose, then verify them in R.
Calculate the body-weight/glucose correlation separately within each sex. Explain why these may differ from the pooled correlation.
Plot body weight by dam. Compare readability and family sizes with the sire plot.
Compare the unweighted mean of sire-family means with the overall mean. Explain the role of unequal family size.
The mean and standard deviation multiply by 1,000; variance multiplies by 1,000,000; correlation is unchanged. Within-sex correlations describe different subsets and exclude between-sex mean differences. More dam families make their plot denser. Weighting family means by family size recovers the overall mean; equal weighting answers a different question.
Connection to the next practical
Next we connect allele frequencies and genotype effects to quantitative variation, then distinguish genetic variance from phenotypic variance. gpop can support population summaries as its scientific interfaces become available; gsim provides simulated biological data where truth is known; gsel concerns selection objectives and decisions. None is required for this first descriptive practical, and model fitting remains with estimation tools.