| Title: | Package for Construction of Selection Index |
|---|---|
| Description: | This package is useful for construction of selection index. This package uses the mixed and random model least squares analysis to estimate the heritabilities of the traits and genetic correlation between the traits.This uses the sire model as it is considered as random effect. The genetic and phenotypic (co)variances along with the relative economic values are used to construct the selection index for any number of traits. It also estimates the accuracy of the index and the genetic gain expected for different traits. |
| Authors: | Raja TV [aut, cre], Alex Rani [aut], Gowane Gopal [aut], Vohra Vikas [aut] |
| Maintainer: | Raja TV <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.0 |
| Built: | 2026-06-09 10:10:10 UTC |
| Source: | https://github.com/venkatesanraja/selindrix |
This dataset contains information used for constructing a selection index.
data(data, package="selINDRIx")data(data, package="selINDRIx")
A data frame with 689 rows and 7 columns:
Sire of the cows
Farm from which the data were collected
The season of calving of a cow
The period of calving of a cow
Total lactation milk yield in Kg
The peak yield in Kg
The age at first calving
The average fat yield
Title Construction of selection index
mixed_si(data, traits, fixed, random, economic_values)mixed_si(data, traits, fixed, random, economic_values)
data |
A data frame containing the fixed, random and traits |
traits |
The traits for which index values are to be estimated |
fixed |
The fixed effects |
random |
The random effects |
economic_values |
The relative economic values |
Results of selection index
results <- mixed_si(data = data, traits = traits, fixed = fixed, random = random, economic_values = economic_values)results <- mixed_si(data = data, traits = traits, fixed = fixed, random = random, economic_values = economic_values)
Title Construction of selection index
random_si(data_input, traits, economic_values)random_si(data_input, traits, economic_values)
traits |
The traits for which index values are to be estimated |
economic_values |
The relative economic values |
data |
A data frame containing the fixed, random and traits |
random |
The random effects |
Results of selection index
results <- mixed_si(data = data, traits = traits, random = random, economic_values = economic_values)results <- mixed_si(data = data, traits = traits, random = random, economic_values = economic_values)
This package provides functions for mixed and random least squares analysis to generate the genetic and phenotypic parameters to be used for the construction of selection index Contains two main functions: mixed() and random() that perform the least squares analysis to generate the heritability, genetic and phenotypic correlations of the traits along with their variances and covariances
The package includes the following main functions:
mixed(): Mixed model least squares analysis to estimate the
genetic and phenotypic parameters
random(): Random model least squares analysis to estimate the
genetic and phenotypic parameters
# Example using mixed function # Read the data data("data", package = "seliNDRIx") # Define your parameters traits <- c("tmy", "py", "fatyield") fixed <- c("farm", "soc", "poc") random <- c("sire") economic_values <- c(1, 0.85, 0.65) # Run the analysis results <- mixed_si( data = data, traits = traits, fixed = fixed, random = random, economic_values = economic_values ) results # To calculate the overall selection index for each animal SI <- c(results$SelectionIndex) # Selection index estimates (weights) for traits traits <- c("tmy", "py", "fatyield") # Define the trait columns to use overall_index <- function(data, SI, traits) { # Ensure the number of weights matches the number of trait columns if (length(SI) != length(traits)) { stop("The number of weights must match the number of trait columns.") } # Select only the defined trait columns and calculate the index data %>% rowwise() %>% mutate(Index = sum(c_across(all_of(traits)) * SI)) %>% ungroup() } # Calculate the selection index result3 <- overall_index(data, SI, traits) # Print the result print(result3) # Select the top 20% of animals with the highest selection index values top20 <- result3 %>% arrange(desc(Index)) %>% # Sort by Index in descending order slice_head(prop = 0.2) # Select the top 20% # Example using random function # Read the data data("data", package = "seliNDRIx") # Run the analysis results2 <- random_si(data, traits = c("tmy", "py", "fatyield"), economic_values = c(1, 0.85, 0.65)) results2 # To calculate the overall selection index for each animal SI <- c(results$SelectionIndex) # Selection index estimates (weights) for traits traits <- c("tmy", "py", "fatyield") # Define the trait columns to use overall_index <- function(data, SI, traits) { # Ensure the number of weights matches the number of trait columns if (length(SI) != length(traits)) { stop("The number of weights must match the number of trait columns.") } # Select only the defined trait columns and calculate the index data %>% rowwise() %>% mutate(Index = sum(c_across(all_of(traits)) * SI)) %>% ungroup() } # Calculate the selection index result3 <- overall_index(data, SI, traits) # Print the result print(result3) # Select the top 20% of animals with the highest selection index values top20 <- result3 %>% arrange(desc(Index)) %>% # Sort by Index in descending order slice_head(prop = 0.2) # Select the top 20%# Example using mixed function # Read the data data("data", package = "seliNDRIx") # Define your parameters traits <- c("tmy", "py", "fatyield") fixed <- c("farm", "soc", "poc") random <- c("sire") economic_values <- c(1, 0.85, 0.65) # Run the analysis results <- mixed_si( data = data, traits = traits, fixed = fixed, random = random, economic_values = economic_values ) results # To calculate the overall selection index for each animal SI <- c(results$SelectionIndex) # Selection index estimates (weights) for traits traits <- c("tmy", "py", "fatyield") # Define the trait columns to use overall_index <- function(data, SI, traits) { # Ensure the number of weights matches the number of trait columns if (length(SI) != length(traits)) { stop("The number of weights must match the number of trait columns.") } # Select only the defined trait columns and calculate the index data %>% rowwise() %>% mutate(Index = sum(c_across(all_of(traits)) * SI)) %>% ungroup() } # Calculate the selection index result3 <- overall_index(data, SI, traits) # Print the result print(result3) # Select the top 20% of animals with the highest selection index values top20 <- result3 %>% arrange(desc(Index)) %>% # Sort by Index in descending order slice_head(prop = 0.2) # Select the top 20% # Example using random function # Read the data data("data", package = "seliNDRIx") # Run the analysis results2 <- random_si(data, traits = c("tmy", "py", "fatyield"), economic_values = c(1, 0.85, 0.65)) results2 # To calculate the overall selection index for each animal SI <- c(results$SelectionIndex) # Selection index estimates (weights) for traits traits <- c("tmy", "py", "fatyield") # Define the trait columns to use overall_index <- function(data, SI, traits) { # Ensure the number of weights matches the number of trait columns if (length(SI) != length(traits)) { stop("The number of weights must match the number of trait columns.") } # Select only the defined trait columns and calculate the index data %>% rowwise() %>% mutate(Index = sum(c_across(all_of(traits)) * SI)) %>% ungroup() } # Calculate the selection index result3 <- overall_index(data, SI, traits) # Print the result print(result3) # Select the top 20% of animals with the highest selection index values top20 <- result3 %>% arrange(desc(Index)) %>% # Sort by Index in descending order slice_head(prop = 0.2) # Select the top 20%