Skip to content

Commit 5b44f4b

Browse files
committed
docs: generate linear phenotypic selection index vignette from Chapter 02
This adds the linear-phenotypic-selection-index.Rmd vignette which illustrates the use of lpsi function and related functions, along with theory from Chapter 2.
1 parent fe102ab commit 5b44f4b

1 file changed

Lines changed: 168 additions & 0 deletions

File tree

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
---
2+
title: "The Linear Phenotypic Selection Index Theory"
3+
output: rmarkdown::html_vignette
4+
vignette: >
5+
%\VignetteIndexEntry{The Linear Phenotypic Selection Index Theory}
6+
%\VignetteEngine{knitr::rmarkdown}
7+
%\VignetteEncoding{UTF-8}
8+
---
9+
10+
```{r, include = FALSE}
11+
knitr::opts_chunk$set(
12+
collapse = TRUE,
13+
comment = "#>"
14+
)
15+
```
16+
17+
## Introduction
18+
19+
In plant and animal breeding, quantitative traits (QTs) are expressions of genes distributed across the genome interacting with the environment. The phenotypic value of QTs ($y$) can be systematically partitioned into a genotypic component ($g$) and an environmental component ($e$):
20+
21+
$$ y = g + e $$
22+
23+
The primary goal in breeding is to maximize an individual's **net genetic merit**. The net genetic merit ($H$) is a linear combination of the unobservable true breeding values ($\mathbf{g}$) weighted by their respective economic values ($\mathbf{w}$):
24+
25+
$$ H = {\mathbf{w}}^{\prime}\mathbf{g} $$
26+
27+
Because the net genetic merit is unobservable in field trials, breeders construct a **Linear Phenotypic Selection Index (LPSI)** to predict it. The LPSI ($I$) is a linear combination of the observable and optimally weighted phenotypic trait values ($\mathbf{y}$) adjusted by index coefficients ($\mathbf{b}$):
28+
29+
$$ I = {\mathbf{b}}^{\prime}\mathbf{y} $$
30+
31+
The objective of the LPSI is to predict the net genetic merit and maximize the multi-trait selection response.
32+
33+
## Optimizing the LPSI
34+
35+
To identify the optimal parents for the next selection cycle, the correlation between the net genetic merit ($H$) and the LPSI ($I$) must be maximized. The vector $\mathbf{b}$ that simultaneously minimizes the mean squared difference between $I$ and $H$ and perfectly maximizes this correlation is mathematically derived as:
36+
37+
$$ \mathbf{b} = {\mathbf{P}}^{-1}\mathbf{Gw} $$
38+
39+
where:
40+
* $\mathbf{P}$ is the phenotypic variance-covariance matrix.
41+
* $\mathbf{G}$ is the genotypic variance-covariance matrix.
42+
* $\mathbf{w}$ is the vector of economic weights defining relative trait importance.
43+
44+
Once these optimal coefficients are derived, we can evaluate two fundamental parameters:
45+
46+
1. **The Maximized Selection Response ($R_I$)**: The expected mean improvement in the net genetic merit due to indirect selection on the index.
47+
$$ {R}_I = {k}_I\sqrt{{\mathbf{b}}^{\prime}\mathbf{Pb}} $$
48+
49+
2. **The Expected Genetic Gain Per Trait ($\mathbf{E}$)**: The multi-trait selection response broken down per individual trait.
50+
$$ \mathbf{E} = {k}_I\frac{\mathbf{Gb}}{\sigma_I} $$
51+
52+
where $k_I$ is the standardized selection intensity and $\sigma_I$ is the standard deviation of the index score variance.
53+
54+
## Practical Implementation in R
55+
56+
We can seamlessly translate this text theory into rigorous statistical practice using the `selection.index` package. We will utilize the built-in synthetic datasets: `maize_pheno` (containing multi-environment phenotypic records for 100 genotypes) and `maize_geno` (500 SNP markers).
57+
58+
### 1. Estimating Covariance Matrices
59+
60+
First, we estimate the genotypic ($\mathbf{G}$) and phenotypic ($\mathbf{P}$) variance-covariance matrices from our raw phenotypic dataset.
61+
62+
```{r matrices}
63+
library(selection.index)
64+
65+
# Load the synthetic phenotypic multi-environment dataset
66+
data("maize_pheno")
67+
68+
# In maize_pheno: Traits are columns 4:6.
69+
# Genotypes are in column 1, and Block/Replication is in column 3.
70+
gmat <- gen_varcov(data = maize_pheno[, 4:6], genotypes = maize_pheno[, 1], replication = maize_pheno[, 3])
71+
pmat <- phen_varcov(data = maize_pheno[, 4:6], genotypes = maize_pheno[, 1], replication = maize_pheno[, 3])
72+
```
73+
74+
### 2. Defining Economic Weights
75+
76+
Next, we establish the relative economic priority of each trait. Economic weights ($\mathbf{w}$) explicitly define our strategic breeding objectives.
77+
78+
```{r weights}
79+
# Define the economic weights for the 3 continuous traits
80+
# (e.g., Yield, PlantHeight, DaysToMaturity)
81+
weights <- c(10, -5, -5)
82+
```
83+
84+
### 3. Calculating the LPSI
85+
86+
With the covariance matrices and economic weights specified, we integrate them into the primary `lpsi()` function, which evaluates the combinatorial multi-trait selection indices efficiently.
87+
88+
```{r lpsi}
89+
# Calculate the Optimal Combinatorial Linear Phenotypic Selection Index (LPSI)
90+
index_results <- lpsi(
91+
ncomb = 3,
92+
pmat = pmat,
93+
gmat = gmat,
94+
wmat = as.matrix(weights),
95+
wcol = 1
96+
)
97+
```
98+
99+
### 4. Evaluating Outcomes and Selecting Genotypes
100+
101+
Finally, we evaluate the theoretical gains. The `lpsi()` function returns a structured data frame containing the theoretical selection response ($R_I$) and other parameter estimates for all requested trait combinations.
102+
103+
```{r gains}
104+
# View the top combinatorial indices, including their selection response (R_A)
105+
head(index_results)
106+
107+
# Extract the phenotypic selection scores to strategically rank the parental candidates
108+
# using the top evaluated combinatorial index
109+
scores <- predict_selection_score(
110+
index_results,
111+
data = maize_pheno[, 4:6],
112+
genotypes = maize_pheno[, 1]
113+
)
114+
115+
# View the top performing candidates designated for the next breeding cycle
116+
head(scores)
117+
```
118+
119+
### 5. Extension: Linear Marker Selection Index
120+
121+
The classical linear selection index theories seamlessly extend to marker-assisted genomic selection. If you have genome-wide marker profiles for your genotypes, you can incorporate them to estimate the Linear Marker Selection Index (LMSI).
122+
123+
```{r marker_data, eval=FALSE}
124+
# Load the associated synthetic genomic dataset (500 SNPs for the 100 genotypes)
125+
data("maize_geno")
126+
127+
# Calculate the marker-assisted index combining our matrices and raw SNP profiles
128+
marker_index_results <- lmsi(
129+
pmat = pmat,
130+
gmat = gmat,
131+
marker_scores = maize_geno,
132+
wmat = weights
133+
)
134+
135+
summary(marker_index_results)
136+
```
137+
138+
### 6. The Base Index and Index Efficiency
139+
140+
In scenarios where the phenotypic ($\mathbf{P}$) and genotypic ($\mathbf{G}$) matrices are poorly estimated (e.g., due to limited data), the true optimal coefficients ($\mathbf{b}$) can be systematically biased. The **Base Index** provides a robust, non-optimized alternative where coefficients are set strictly equal to the fixed economic weights ($I_B = \mathbf{w}'\mathbf{y}$).
141+
142+
```{r base_index}
143+
# Calculate the Base Index and automatically compare its efficiency to the LPSI
144+
base_results <- base_index(
145+
pmat = pmat,
146+
gmat = gmat,
147+
wmat = weights,
148+
compare_to_lpsi = TRUE
149+
)
150+
151+
# Observe the expected genetic gains and efficiency comparison
152+
base_results$summary
153+
```
154+
155+
### 7. Heritability of the LPSI
156+
157+
The theory demonstrates that the correlation between the net genetic merit ($H$) and the expected index ($I$) differs from the traditional index heritability mathematically ($h^2_I \neq \rho^2_{HI}$). The `lpsi()` function intrinsically estimates both of these fundamental statistics:
158+
159+
```{r heritability}
160+
# Extract the top combinatorial index results
161+
top_index <- index_results[1, ]
162+
163+
# h^2_I: Heritability of the optimal index
164+
top_index$hI2
165+
166+
# \rho_HI: Correlation between the LPSI and the true underlying Net Genetic Merit
167+
top_index$rHI
168+
```

0 commit comments

Comments
 (0)