if (FALSE) {
# Generate example data
gmat <- gen_varcov(seldata[, 3:9], seldata[, 2], seldata[, 1])
# Simulate GEBVs (in practice, these come from genomic prediction)
set.seed(123)
n_genotypes <- 100
n_traits <- ncol(gmat)
gebv_mat <- matrix(rnorm(n_genotypes * n_traits, mean = 10, sd = 2),
nrow = n_genotypes, ncol = n_traits
)
colnames(gebv_mat) <- colnames(gmat)
# Economic weights
weights <- c(10, 5, 3, 3, 5, 8, 4)
# Calculate LGSI
result <- lgsi(gebv_mat, gmat, weights, reliability = 0.7)
print(result$summary)
}
Run the code above in your browser using DataLab