Disclaimer

This notebook gives an overview over different weighting strategies between economic values of traits of different animal categories.

Background

In beef cattle there are three different carcass performance traits.

tbl_trait <- tibble::data_frame(Abbreviation = c("CC", "CF", "CW"),
                                Trait = c("Carcass Conformation",
                                          "Carcass Fat",
                                          "Carcass Weight"))
knitr::kable( tbl_trait,
              booktabs = TRUE,
              longtable = TRUE )

Both traits are available in two animal categories

tbl_category <- tibble::data_frame(Abbreviation = c("c", "a"),
                                   Category     = c("calf", "adult"))
knitr::kable( tbl_category,
              booktabs = TRUE,
              longtable = TRUE )
n_nr_trait <- nrow(tbl_category) * nrow(tbl_trait)

Combining both, results in the following matrix of a total of r n_nr_trait traits

tbl_trait_matrix <- tibble::data_frame(Trait = c("CC", "CF", "CW"),
                                       Calf  = c("CCc", "CFc", "CWc"),
                                       Adult = c("CCa", "CFa", "CWa"))
knitr::kable( tbl_trait_matrix,
              booktabs = TRUE,
              longtable = TRUE )

1. Economic Values

library(dplyr)

#' #1. Computing Economic Value For Dual Breed
#' 
#' ## Genetic Standard Deviations
#' Economic values can also be given in terms of a change of one genetic standard deviation. The used estimates for this parameter are
#' 
## ------------------------------------------------------------------------
l_gen_sd <- list(CCc = 0.6336,
                 CCa = 0.6335,
                 CFc = 0.3474,
                 CFa = 0.3609,
                 CWc = 0.0557,
                 CWa = 0.1395)

#' 
#' ##Carcass conformation adults (CCa)
## ------------------------------------------------------------------------
### # prices
vec_price_cca <- c(7.526960,7.938872,8.450784,8.800000,9.137304,9.392693,9.642693)

#' 
#' ###OB
## ------------------------------------------------------------------------
n_mean_cca_ob <- 5.20
n_sd_cca_ob <- 1.02
vec_count_cca_ob <- c(4,43,218,1150,2106,1905,522)
vec_freq_cca_ob <- vec_count_cca_ob / sum(vec_count_cca_ob)

#' 
## ---- include=FALSE------------------------------------------------------
(ev_cca_ob <- MeatValueIndex::compute_economic_value( pn_mean = n_mean_cca_ob,
                        pn_sd = n_sd_cca_ob,
                        pvec_class_freq = vec_freq_cca_ob,
                        pvec_threshold = NULL,
                        pvec_price = vec_price_cca,
                        pn_delta_mean = .1,
                        pn_gen_sd = l_gen_sd$CCa,
                        pb_verbose = TRUE))

#' 
#' ###BV
## ------------------------------------------------------------------------
n_mean_cca_bv <- 4.78
n_sd_cca_bv <- 1.27
vec_count_cca_bv <- c(273,1562,5982,17808,14303,11438,5875)
vec_freq_cca_bv <- vec_count_cca_bv / sum(vec_count_cca_bv)


#' 
## ---- include=FALSE------------------------------------------------------
(ev_cca_bv <- MeatValueIndex::compute_economic_value( pn_mean = n_mean_cca_bv,
                        pn_sd = n_sd_cca_bv,
                        pvec_class_freq = vec_freq_cca_bv,
                        pvec_threshold = NULL,
                        pvec_price = vec_price_cca,
                        pn_delta_mean = .1,
                        pn_gen_sd = l_gen_sd$CCa,
                        pb_verbose = TRUE))

#' 
#' ###SI
## ------------------------------------------------------------------------
n_mean_cca_si <- 5.83
n_sd_cca_si <- 0.9
vec_count_cca_si <- c(4,38,377,3994,13917,24738,13535)
vec_freq_cca_si <- vec_count_cca_si / sum(vec_count_cca_si)

#' 
## ---- include=FALSE------------------------------------------------------
(ev_cca_si <- MeatValueIndex::compute_economic_value( pn_mean = n_mean_cca_si,
                        pn_sd = n_sd_cca_si,
                        pvec_class_freq = vec_freq_cca_si,
                        pvec_threshold = NULL,
                        pvec_price = vec_price_cca,
                        pn_delta_mean = .1,
                        pn_gen_sd = l_gen_sd$CCa,
                        pb_verbose = TRUE))

#' 
#' ###SF
## ------------------------------------------------------------------------
n_mean_cca_sf <- 4.57
n_sd_cca_sf <- 1.18
vec_count_cca_sf <- c(165,1189,4814,11545,10445,6303,1755)
vec_freq_cca_sf <- vec_count_cca_sf / sum(vec_count_cca_sf)

#' 
## ---- include=FALSE------------------------------------------------------
(ev_cca_sf <- MeatValueIndex::compute_economic_value( pn_mean = n_mean_cca_sf,
                        pn_sd = n_sd_cca_sf,
                        pvec_class_freq = vec_freq_cca_sf,
                        pvec_threshold = NULL,
                        pvec_price = vec_price_cca,
                        pn_delta_mean = .1,
                        pn_gen_sd = l_gen_sd$CCa,
                        pb_verbose = TRUE))

#' 
#' ###MO
## ------------------------------------------------------------------------
n_mean_cca_mo <- 5.39
n_sd_cca_mo <- 0.94
vec_count_cca_mo <- c(10,33,194,1341,3511,3730,979)
vec_freq_cca_mo <- vec_count_cca_mo / sum(vec_count_cca_mo)

#' 
## ---- include=FALSE------------------------------------------------------
(ev_cca_mo <- MeatValueIndex::compute_economic_value( pn_mean = n_mean_cca_mo,
                        pn_sd = n_sd_cca_mo,
                        pvec_class_freq = vec_freq_cca_mo,
                        pvec_threshold = NULL,
                        pvec_price = vec_price_cca,
                        pn_delta_mean = .1,
                        pn_gen_sd = l_gen_sd$CCa,
                        pb_verbose = TRUE))

#' 
#' ##Carcass conformation calves (CCc)
#' 
## ------------------------------------------------------------------------
### # prices
vec_price_ccc <- c(11.2,12.7,13.6,14.2,14.7,15.2,15.7)

#' 
#' ###OB
## ------------------------------------------------------------------------
n_mean_ccc_ob <- 4.98
n_sd_ccc_ob <- 1.01
vec_count_ccc_ob <- c(11,94,451,2266,3486,2376,472)
vec_freq_ccc_ob <- vec_count_ccc_ob / sum(vec_count_ccc_ob)

#' 
## ---- include=FALSE------------------------------------------------------
(ev_ccc_ob <- MeatValueIndex::compute_economic_value( pn_mean = n_mean_ccc_ob,
                        pn_sd = n_sd_ccc_ob,
                        pvec_class_freq = vec_freq_ccc_ob,
                        pvec_threshold = NULL,
                        pvec_price = vec_price_ccc,
                        pn_delta_mean = .1,
                        pn_gen_sd = l_gen_sd$CCc,
                        pb_verbose = TRUE))

#' 
#' ###BV
## ------------------------------------------------------------------------
n_mean_ccc_bv <- 4.08
n_sd_ccc_bv <- 1.08
vec_count_ccc_bv <- c(1759,10739,42522,94581,40759,15082,4855)
vec_freq_ccc_bv <- vec_count_ccc_bv / sum(vec_count_ccc_bv)

#' 
## ---- include=FALSE------------------------------------------------------
(ev_ccc_bv <- MeatValueIndex::compute_economic_value( pn_mean = n_mean_ccc_bv,
                        pn_sd = n_sd_ccc_bv,
                        pvec_class_freq = vec_freq_ccc_bv,
                        pvec_threshold = NULL,
                        pvec_price = vec_price_ccc,
                        pn_delta_mean = .1,
                        pn_gen_sd = l_gen_sd$CCc,
                        pb_verbose = TRUE))

#' 
#' ###SI
## ------------------------------------------------------------------------
n_mean_ccc_si <- 5.33
n_sd_ccc_si <- 1.02
vec_count_ccc_si <- c(16,64,247,1620,3359,3374,1087)
vec_freq_ccc_si <- vec_count_ccc_si / sum(vec_count_ccc_si)

#' 
#' 
## ---- include=FALSE------------------------------------------------------
(ev_ccc_si <- MeatValueIndex::compute_economic_value( pn_mean = n_mean_ccc_si,
                        pn_sd = n_sd_ccc_si,
                        pvec_class_freq = vec_freq_ccc_si,
                        pvec_threshold = NULL,
                        pvec_price = vec_price_ccc,
                        pn_delta_mean = .1,
                        pn_gen_sd = l_gen_sd$CCc,
                        pb_verbose = TRUE))

#' 
#' ###SF
## ------------------------------------------------------------------------
n_mean_ccc_sf <- 3.88
n_sd_ccc_sf <- 1.08
vec_count_ccc_sf <- c(645,4027,13631,21453,9150,3054,626)
vec_freq_ccc_sf <- vec_count_ccc_sf / sum(vec_count_ccc_sf)

#' 
#' 
## ---- include=FALSE------------------------------------------------------
(ev_ccc_sf <- MeatValueIndex::compute_economic_value( pn_mean = n_mean_ccc_sf,
                        pn_sd = n_sd_ccc_sf,
                        pvec_class_freq = vec_freq_ccc_sf,
                        pvec_threshold = NULL,
                        pvec_price = vec_price_ccc,
                        pn_delta_mean = .1,
                        pn_gen_sd = l_gen_sd$CCc,
                        pb_verbose = TRUE))

#' 
#' ###MO
## ------------------------------------------------------------------------
n_mean_ccc_mo <- 4.73
n_sd_ccc_mo <- 1.11
vec_count_ccc_mo <- c(14,57,232,774,920,523,118)
vec_freq_ccc_mo <- vec_count_ccc_mo / sum(vec_count_ccc_mo)

#' 
#' 
## ---- include=FALSE------------------------------------------------------
(ev_ccc_mo <- MeatValueIndex::compute_economic_value( pn_mean = n_mean_ccc_mo,
                        pn_sd = n_sd_ccc_mo,
                        pvec_class_freq = vec_freq_ccc_mo,
                        pvec_threshold = NULL,
                        pvec_price = vec_price_ccc,
                        pn_delta_mean = .1,
                        pn_gen_sd = l_gen_sd$CCc,
                        pb_verbose = TRUE))

#' 
#' 
#' 
#' ##Carcass fatness adults (CFa)
## ------------------------------------------------------------------------
### # prices
vec_price_cfa <- c(-0.9000000,
-0.3000000,
0.0000000,
-0.3926929,
-0.8480817)

#' 
#' ###OB
## ------------------------------------------------------------------------
n_mean_cfa_ob <- 2.88
n_sd_cfa_ob <- 0.58
vec_count_cfa_ob <- c(161,889,4429,448,21)
vec_freq_cfa_ob <- vec_count_cfa_ob / sum(vec_count_cfa_ob)

#' 
#' 
## ---- include=FALSE------------------------------------------------------
(ev_cfa_ob<- MeatValueIndex::compute_economic_value( pn_mean = n_mean_cfa_ob,
                        pn_sd = n_sd_cfa_ob,
                        pvec_class_freq = vec_freq_cfa_ob,
                        pvec_threshold = NULL,
                        pvec_price = vec_price_cfa,
                        pn_delta_mean = .1,
                        pn_gen_sd = l_gen_sd$CFa,
                        pb_verbose = TRUE))

#' 
#' ###BV
## ------------------------------------------------------------------------
n_mean_cfa_bv <- 2.85
n_sd_cfa_bv <- 0.6
vec_count_cfa_bv <- c(1704,9941,41215,4167,214)
vec_freq_cfa_bv <- vec_count_cfa_bv / sum(vec_count_cfa_bv)

#' 
#' 
## ---- include=FALSE------------------------------------------------------
(ev_cfa_bv <- MeatValueIndex::compute_economic_value( pn_mean = n_mean_cfa_bv,
                        pn_sd = n_sd_cfa_bv,
                        pvec_class_freq = vec_freq_cfa_bv,
                        pvec_threshold = NULL,
                        pvec_price = vec_price_cfa,
                        pn_delta_mean = .1,
                        pn_gen_sd = l_gen_sd$CFa,
                        pb_verbose = TRUE))

#' 
#' ###SI
## ------------------------------------------------------------------------
n_mean_cfa_si <- 2.82
n_sd_cfa_si <- 0.55
vec_count_cfa_si <- c(1259,10942,41326,3004,72)
vec_freq_cfa_si <- vec_count_cfa_si / sum(vec_count_cfa_si)

#' 
#' 
## ---- include=FALSE------------------------------------------------------
(ev_cfa_si <- MeatValueIndex::compute_economic_value( pn_mean = n_mean_cfa_si,
                        pn_sd = n_sd_cfa_si,
                        pvec_class_freq = vec_freq_cfa_si,
                        pvec_threshold = NULL,
                        pvec_price = vec_price_cfa,
                        pn_delta_mean = .1,
                        pn_gen_sd = l_gen_sd$CFa,
                        pb_verbose = TRUE))

#' 
#' ###SF
## ------------------------------------------------------------------------
n_mean_cfa_sf <- 2.87
n_sd_cfa_sf <- 0.55
vec_count_cfa_sf <- c(787,5694,27214,2442,79)
vec_freq_cfa_sf <- vec_count_cfa_sf / sum(vec_count_cfa_sf)

#' 
#' 
## ---- include=FALSE------------------------------------------------------
(ev_cfa_sf <- MeatValueIndex::compute_economic_value( pn_mean = n_mean_cfa_sf,
                        pn_sd = n_sd_cfa_sf,
                        pvec_class_freq = vec_freq_cfa_sf,
                        pvec_threshold = NULL,
                        pvec_price = vec_price_cfa,
                        pn_delta_mean = .1,
                        pn_gen_sd = l_gen_sd$CFa,
                        pb_verbose = TRUE))

#' 
#' ###MO
## ------------------------------------------------------------------------
n_mean_cfa_mo <- 2.68
n_sd_cfa_mo <- 0.6
vec_count_cfa_mo <- c(373,2721,6420,280,4)
vec_freq_cfa_mo <- vec_count_cfa_mo / sum(vec_count_cfa_mo)

#' 
#' 
## ---- include=FALSE------------------------------------------------------
(ev_cfa_mo <- MeatValueIndex::compute_economic_value( pn_mean = n_mean_cfa_mo,
                        pn_sd = n_sd_cfa_mo,
                        pvec_class_freq = vec_freq_cfa_mo,
                        pvec_threshold = NULL,
                        pvec_price = vec_price_cfa,
                        pn_delta_mean = .1,
                        pn_gen_sd = l_gen_sd$CFa,
                        pb_verbose = TRUE))

#' 
#' 
#' 
#' ##Carcass fatness calves (CFc)
## ------------------------------------------------------------------------
### # prices
vec_price_cfc <- c(-1.5,
-0.6,
0.0,
-0.4,
-1.0)

#' 
#' ###OB
## ------------------------------------------------------------------------
n_mean_cfc_ob <- 2.62
n_sd_cfc_ob <- 0.69
vec_count_cfc_ob <- c(632,2671,5379,471,3)
vec_freq_cfc_ob <- vec_count_cfc_ob / sum(vec_count_cfc_ob)

#' 
#' 
## ---- include=FALSE------------------------------------------------------
(ev_cfc_ob <- MeatValueIndex::compute_economic_value( pn_mean = n_mean_cfc_ob,
                        pn_sd = n_sd_cfc_ob,
                        pvec_class_freq = vec_freq_cfc_ob,
                        pvec_threshold = NULL,
                        pvec_price = vec_price_cfc,
                        pn_delta_mean = .1,
                        pn_gen_sd = l_gen_sd$CFc,
                        pb_verbose = TRUE))

#' 
#' ###BV
## ------------------------------------------------------------------------
n_mean_cfc_bv <- 2.68
n_sd_cfc_bv <- 0.67
vec_count_cfc_bv <- c(12790,52626,133521,11316,44)
vec_freq_cfc_bv <- vec_count_cfc_bv / sum(vec_count_cfc_bv)

#' 
#' 
## ---- include=FALSE------------------------------------------------------
(ev_cfc_bv <- MeatValueIndex::compute_economic_value( pn_mean = n_mean_cfc_bv,
                        pn_sd = n_sd_cfc_bv,
                        pvec_class_freq = vec_freq_cfc_bv,
                        pvec_threshold = NULL,
                        pvec_price = vec_price_cfc,
                        pn_delta_mean = .1,
                        pn_gen_sd = l_gen_sd$CFc,
                        pb_verbose = TRUE))

#' 
#' ###SI
## ------------------------------------------------------------------------
n_mean_cfc_si <- 2.66
n_sd_cfc_si <- 0.7
vec_count_cfc_si <- c(691,2522,5974,578,2)
vec_freq_cfc_si <- vec_count_cfc_si / sum(vec_count_cfc_si)

#' 
#' 
## ---- include=FALSE------------------------------------------------------
(ev_cfc_si <- MeatValueIndex::compute_economic_value( pn_mean = n_mean_cfc_si,
                        pn_sd = n_sd_cfc_si,
                        pvec_class_freq = vec_freq_cfc_si,
                        pvec_threshold = NULL,
                        pvec_price = vec_price_cfc,
                        pn_delta_mean = .1,
                        pn_gen_sd = l_gen_sd$CFc,
                        pb_verbose = TRUE))

#' 
#' ###SF
## ------------------------------------------------------------------------
n_mean_cfc_sf <- 2.76
n_sd_cfc_sf <- 0.65
vec_count_cfc_sf <- c(2475,11464,35025,3602,19)
vec_freq_cfc_sf <- vec_count_cfc_sf / sum(vec_count_cfc_sf)

#' 
#' 
## ---- include=FALSE------------------------------------------------------
(ev_cfc_sf <- MeatValueIndex::compute_economic_value( pn_mean = n_mean_cfc_sf,
                        pn_sd = n_sd_cfc_sf,
                        pvec_class_freq = vec_freq_cfc_sf,
                        pvec_threshold = NULL,
                        pvec_price = vec_price_cfc,
                        pn_delta_mean = .1,
                        pn_gen_sd = l_gen_sd$CFc,
                        pb_verbose = TRUE))

#' 
#' ###MO
## ------------------------------------------------------------------------
n_mean_cfc_mo <- 2.64
n_sd_cfc_mo <- 0.67
vec_count_cfc_mo <- c(191,676,1675,96,0)
vec_freq_cfc_mo <- vec_count_cfc_mo / sum(vec_count_cfc_mo)

#' 
#' 
## ---- include=FALSE------------------------------------------------------
(ev_cfc_mo <- MeatValueIndex::compute_economic_value( pn_mean = n_mean_cfc_mo,
                        pn_sd = n_sd_cfc_mo,
                        pvec_class_freq = vec_freq_cfc_mo,
                        pvec_threshold = NULL,
                        pvec_price = vec_price_cfc,
                        pn_delta_mean = .1,
                        pn_gen_sd = l_gen_sd$CFc,
                        pb_verbose = TRUE))

#' 
#' 
#' 
#' ##Carcass weight adults (CWa)
#' 
## ------------------------------------------------------------------------
 n_scale_fact_cwa <- 100
vec_price_cwa <- c(0.0,
-0.1,
-0.2,
-0.3,
-0.5,
-0.7,
-0.9,
-1.2,
-1.4,
-1.6,
-1.8)
vec_thre_cwa <- c(2.9,
3.0,
3.1,
3.2,
3.3,
3.4,
3.5,
3.6,
3.7,
3.8) * n_scale_fact_cwa

#' 
#' ### OB
## ------------------------------------------------------------------------
n_mean_cwa_ob <- 2.61 * n_scale_fact_cwa
n_sd_cwa_ob <- 0.41 * n_scale_fact_cwa

#' 
#' 
## ---- include=FALSE------------------------------------------------------
(ev_cwa_ob <- MeatValueIndex::compute_economic_value( pn_mean = n_mean_cwa_ob,
                        pn_sd = n_sd_cwa_ob,
                        pvec_class_freq = NULL,
                        pvec_threshold = vec_thre_cwa,
                        pvec_price = vec_price_cwa,
                        pn_gen_sd = l_gen_sd$CWa * n_scale_fact_cwa,
                        pn_delta_mean = .01 * n_scale_fact_cwa))


#' 
#' ### BV
## ------------------------------------------------------------------------
n_mean_cwa_bv <- 2.77 * n_scale_fact_cwa
n_sd_cwa_bv <- 0.36 * n_scale_fact_cwa

#' 
#' 
## ---- include=FALSE------------------------------------------------------
(ev_cwa_bv <- MeatValueIndex::compute_economic_value( pn_mean = n_mean_cwa_bv,
                        pn_sd = n_sd_cwa_bv,
                        pvec_class_freq = NULL,
                        pvec_threshold = vec_thre_cwa,
                        pvec_price = vec_price_cwa,
                        pn_gen_sd = l_gen_sd$CWa * n_scale_fact_cwa,
                        pn_delta_mean = .01 * n_scale_fact_cwa))


#' 
#' 
#' ### SI
## ------------------------------------------------------------------------
n_mean_cwa_si <- 2.79 * n_scale_fact_cwa
n_sd_cwa_si <- 0.42 * n_scale_fact_cwa

#' 
#' 
## ---- include=FALSE------------------------------------------------------
(ev_cwa_si <- MeatValueIndex::compute_economic_value( pn_mean = n_mean_cwa_si,
                        pn_sd = n_sd_cwa_si,
                        pvec_class_freq = NULL,
                        pvec_threshold = vec_thre_cwa,
                        pvec_price = vec_price_cwa,
                        pn_gen_sd = l_gen_sd$CWa * n_scale_fact_cwa,
                        pn_delta_mean = .01 * n_scale_fact_cwa))


#' 
#' ### SF
## ------------------------------------------------------------------------
n_mean_cwa_sf <- 2.88 * n_scale_fact_cwa
n_sd_cwa_sf <- 0.32 * n_scale_fact_cwa

#' 
#' 
## ---- include=FALSE------------------------------------------------------
(ev_cwa_sf <- MeatValueIndex::compute_economic_value( pn_mean = n_mean_cwa_sf,
                        pn_sd = n_sd_cwa_sf,
                        pvec_class_freq = NULL,
                        pvec_threshold = vec_thre_cwa,
                        pvec_price = vec_price_cwa,
                        pn_gen_sd = l_gen_sd$CWa * n_scale_fact_cwa,
                        pn_delta_mean = .01 * n_scale_fact_cwa))


#' 
#' ### MO
## ------------------------------------------------------------------------
n_mean_cwa_mo <- 2.99 * n_scale_fact_cwa
n_sd_cwa_mo <- 0.25 * n_scale_fact_cwa

#' 
#' 
## ---- include=FALSE------------------------------------------------------
(ev_cwa_mo <- MeatValueIndex::compute_economic_value( pn_mean = n_mean_cwa_mo,
                        pn_sd = n_sd_cwa_mo,
                        pvec_class_freq = NULL,
                        pvec_threshold = vec_thre_cwa,
                        pvec_price = vec_price_cwa,
                        pn_gen_sd = l_gen_sd$CWa * n_scale_fact_cwa,
                        pn_delta_mean = .01 * n_scale_fact_cwa))


#' 
#' 
#' 
#' ##Carcass weight calves (CWc)
## ------------------------------------------------------------------------
n_scale_fact_cwc <- 100
vec_price_cwc <- seq(0.0,-1.1,-0.1);vec_price_cwc
vec_thre_cwc <- seq(1.4, 1.5, 0.01) * n_scale_fact_cwc
vec_thre_cwc

#' 
#' ### OB
## ------------------------------------------------------------------------
n_mean_cwc_ob <- 1.25 * n_scale_fact_cwc
n_sd_cwc_ob <- 0.13 * n_scale_fact_cwc

#' 
#' 
## ---- include=FALSE------------------------------------------------------
(ev_cwc_ob <- MeatValueIndex::compute_economic_value( pn_mean = n_mean_cwc_ob,
                        pn_sd = n_sd_cwc_ob,
                        pvec_class_freq = NULL,
                        pvec_threshold = vec_thre_cwc,
                        pvec_price = vec_price_cwc,
                        pn_gen_sd = l_gen_sd$CWc * n_scale_fact_cwc,
                        pn_delta_mean = .01 * n_scale_fact_cwc))


#' 
#' ### BV
## ------------------------------------------------------------------------
n_mean_cwc_bv <- 1.26 * n_scale_fact_cwc
n_sd_cwc_bv <- 0.14 * n_scale_fact_cwc

#' 
#' 
## ---- include=FALSE------------------------------------------------------
(ev_cwc_bv <- MeatValueIndex::compute_economic_value( pn_mean = n_mean_cwc_bv,
                        pn_sd = n_sd_cwc_bv,
                        pvec_class_freq = NULL,
                        pvec_threshold = vec_thre_cwc,
                        pvec_price = vec_price_cwc,
                        pn_gen_sd = l_gen_sd$CWc * n_scale_fact_cwc,
                        pn_delta_mean = .01 * n_scale_fact_cwc))


#' 
#' 
#' ### SI
## ------------------------------------------------------------------------
n_mean_cwc_si <- 1.27 * n_scale_fact_cwc
n_sd_cwc_si <- 0.13 * n_scale_fact_cwc

#' 
#' 
## ---- include=FALSE------------------------------------------------------
(ev_cwc_si <- MeatValueIndex::compute_economic_value( pn_mean = n_mean_cwc_si,
                        pn_sd = n_sd_cwc_si,
                        pvec_class_freq = NULL,
                        pvec_threshold = vec_thre_cwc,
                        pvec_price = vec_price_cwc,
                        pn_gen_sd = l_gen_sd$CWc * n_scale_fact_cwc,
                        pn_delta_mean = .01 * n_scale_fact_cwc))


#' 
#' ### SF
## ------------------------------------------------------------------------
n_mean_cwc_sf <- 1.24 * n_scale_fact_cwc
n_sd_cwc_sf <- 0.13 * n_scale_fact_cwc

#' 
#' 
## ---- include=FALSE------------------------------------------------------
(ev_cwc_sf <- MeatValueIndex::compute_economic_value( pn_mean = n_mean_cwc_sf,
                        pn_sd = n_sd_cwc_sf,
                        pvec_class_freq = NULL,
                        pvec_threshold = vec_thre_cwc,
                        pvec_price = vec_price_cwc,
                        pn_gen_sd = l_gen_sd$CWc * n_scale_fact_cwc,
                        pn_delta_mean = .01 * n_scale_fact_cwc))


#' 
#' ### MO
## ------------------------------------------------------------------------
n_mean_cwc_mo <- 1.28 * n_scale_fact_cwc
n_sd_cwc_mo <- 0.15 * n_scale_fact_cwc

#' 
## ---- include=FALSE------------------------------------------------------
(ev_cwc_mo <- MeatValueIndex::compute_economic_value( pn_mean = n_mean_cwc_mo,
                        pn_sd = n_sd_cwc_mo,
                        pvec_class_freq = NULL,
                        pvec_threshold = vec_thre_cwc,
                        pvec_price = vec_price_cwc,
                        pn_gen_sd = l_gen_sd$CWc * n_scale_fact_cwc,
                        pn_delta_mean = .01 * n_scale_fact_cwc))


tbl_ev_result_ev_per_gen_sd <- tibble::data_frame(Traits = c("cca", "ccc", "cfa", "cfc", "cwa", "cwc"),
                                    OB = c(ev_cca_ob$ev_per_gen_sd,
                                            ev_ccc_ob$ev_per_gen_sd, 
                                            ev_cfa_ob$ev_per_gen_sd, 
                                            ev_cfc_ob$ev_per_gen_sd, 
                                            ev_cwa_ob$ev_per_gen_sd, 
                                            ev_cwc_ob$ev_per_gen_sd),
                                    BV = c(ev_cca_bv$ev_per_gen_sd, 
                                            ev_ccc_bv$ev_per_gen_sd, 
                                            ev_cfa_bv$ev_per_gen_sd, 
                                            ev_cfc_bv$ev_per_gen_sd, 
                                            ev_cwa_bv$ev_per_gen_sd, 
                                            ev_cwc_bv$ev_per_gen_sd),
                                    SI = c(ev_cca_si$ev_per_gen_sd, 
                                            ev_ccc_si$ev_per_gen_sd, 
                                            ev_cfa_si$ev_per_gen_sd, 
                                            ev_cfc_si$ev_per_gen_sd, 
                                            ev_cwa_si$ev_per_gen_sd, 
                                            ev_cwc_si$ev_per_gen_sd),
                                    SF = c(ev_cca_sf$ev_per_gen_sd, 
                                            ev_ccc_sf$ev_per_gen_sd, 
                                            ev_cfa_sf$ev_per_gen_sd, 
                                            ev_cfc_sf$ev_per_gen_sd, 
                                            ev_cwa_sf$ev_per_gen_sd, 
                                            ev_cwc_sf$ev_per_gen_sd),
                                    MO = c(ev_cca_mo$ev_per_gen_sd, 
                                            ev_ccc_mo$ev_per_gen_sd, 
                                            ev_cfa_mo$ev_per_gen_sd, 
                                            ev_cfc_mo$ev_per_gen_sd, 
                                            ev_cwa_mo$ev_per_gen_sd, 
                                            ev_cwc_mo$ev_per_gen_sd))


#' ###2.1) Computing Relative Economic Factors For All Categories
## ---- echo=FALSE---------------------------------------------------------
### # compute factors with function
tbl_rel_factors <- MeatValueIndex::get_relative_economic_factors(ptbl_economic_value = tbl_ev_result_ev_per_gen_sd,
                                                 pb_first_col_trait_name = TRUE)

#' 
#' ###2.2) Computing Relative Economic Factors For Adults
#' Computing the factors for different animal categories separately can be done with two separate function calls.We start with the category "addults"
## ---- echo=FALSE---------------------------------------------------------
### # adults
vec_row_idx_adult <- c(1,3,5)
tbl_rel_factors_adult <- MeatValueIndex::get_relative_economic_factors(ptbl_economic_value = tbl_ev_result_ev_per_gen_sd[vec_row_idx_adult,],
                                                 pb_first_col_trait_name = TRUE)

#' 
#' ###2.3) Computing Relative Economic Factors For Calves
#' The same is done for the category "calves"
## ---- echo=FALSE---------------------------------------------------------
### # adults
vec_row_idx_calves <- c(2,4,6)
tbl_rel_factors_calves <- MeatValueIndex::get_relative_economic_factors(ptbl_economic_value = tbl_ev_result_ev_per_gen_sd[vec_row_idx_calves,],
                                                 pb_first_col_trait_name = TRUE)

#' 
#' ##3. Importance of calves versus adults for each population
## ---- include=FALSE------------------------------------------------------
tbl_number_calves_adults <- tibble::data_frame(Categories = c("adults", "calves"),
                                    OB = c(5948,
                                           9156),
                                    BV = c(57241, 
                                          210297),
                                    SI = c(56603, 
                                           9767),
                                    SF = c(36216, 
                                           52585),
                                    MO = c(9798, 
                                           2638))


#' 
## ---- include=FALSE------------------------------------------------------
### # Proportion of the slaughtercategories for each breed
tbl_proportion <- MeatValueIndex::get_relative_economic_factors(ptbl_economic_value = tbl_number_calves_adults,
                                                                      pb_first_col_trait_name = TRUE)


### # adjust dimensions of proportion matrix to be consistent with ev tbl.
(tbl_proportion4eachtrait <- bind_rows(tbl_proportion,tbl_proportion,tbl_proportion))
(tbl_proportion4eachtrait <- tbl_proportion4eachtrait[, 2:ncol(tbl_proportion4eachtrait)])
(tbl_proportion4eachtrait <- bind_cols(tbl_rel_factors[,1], tbl_proportion4eachtrait))
(colnames(tbl_proportion4eachtrait) <- colnames(tbl_rel_factors))

#' ### Szenario B) The relative factors are weighted with animal categories to get weighted relative factors (File name: weighted_economic_value_relative.csv)
## ---- include=FALSE------------------------------------------------------
tbl_weighted_rel_factors <- MeatValueIndex::weight_economic_value(ptbl_economic_value = tbl_rel_factors,
                                     ptbl_weight = tbl_proportion4eachtrait,
                                     pb_first_col_trait_name = TRUE)

Economic values for all r n_nr_trait traits were computed using a simplified profit function leading to the following results.

Table are presenting economic value in genetic standard deviation.

tbl_ev_result_ev_per_gen_sd <- tibble::data_frame(Traits = c("cca", "ccc", "cfa", "cfc", "cwa", "cwc"),
                                    OB = c(ev_cca_ob$ev_per_gen_sd,
                                            ev_ccc_ob$ev_per_gen_sd, 
                                            ev_cfa_ob$ev_per_gen_sd, 
                                            ev_cfc_ob$ev_per_gen_sd, 
                                            ev_cwa_ob$ev_per_gen_sd, 
                                            ev_cwc_ob$ev_per_gen_sd),
                                    BV = c(ev_cca_bv$ev_per_gen_sd, 
                                            ev_ccc_bv$ev_per_gen_sd, 
                                            ev_cfa_bv$ev_per_gen_sd, 
                                            ev_cfc_bv$ev_per_gen_sd, 
                                            ev_cwa_bv$ev_per_gen_sd, 
                                            ev_cwc_bv$ev_per_gen_sd),
                                    SI = c(ev_cca_si$ev_per_gen_sd, 
                                            ev_ccc_si$ev_per_gen_sd, 
                                            ev_cfa_si$ev_per_gen_sd, 
                                            ev_cfc_si$ev_per_gen_sd, 
                                            ev_cwa_si$ev_per_gen_sd, 
                                            ev_cwc_si$ev_per_gen_sd),
                                    SF = c(ev_cca_sf$ev_per_gen_sd, 
                                            ev_ccc_sf$ev_per_gen_sd, 
                                            ev_cfa_sf$ev_per_gen_sd, 
                                            ev_cfc_sf$ev_per_gen_sd, 
                                            ev_cwa_sf$ev_per_gen_sd, 
                                            ev_cwc_sf$ev_per_gen_sd),
                                    MO = c(ev_cca_mo$ev_per_gen_sd, 
                                            ev_ccc_mo$ev_per_gen_sd, 
                                            ev_cfa_mo$ev_per_gen_sd, 
                                            ev_cfc_mo$ev_per_gen_sd, 
                                            ev_cwa_mo$ev_per_gen_sd, 
                                            ev_cwc_mo$ev_per_gen_sd))

knitr::kable(tbl_ev_result_ev_per_gen_sd,booktabs = TRUE)

2. Comparison To Values (Szenario A und Szenario A*)

SZENARIO A

Computing Relative Economic Factors For All Categories.

knitr::kable(tbl_rel_factors, booktabs = TRUE)

Computing Relative Economic Factors For All Categories For Szenario A*

Computing relative economic factor within category.

Computing Relative Economic Factors For Adults (table 2.2)

knitr::kable(tbl_rel_factors_adult, booktabs = TRUE)

Computing Relative Economic Factors For Calves (table 2.3)

knitr::kable(tbl_rel_factors_calves, booktabs = TRUE)

SZENARIO A*

To get the relative importance inside of an index, we have to re-scale

tbl_rel_fact_adult_calf <- bind_rows(tbl_rel_factors_adult, tbl_rel_factors_calves)
tbl_rel_fact_adult_calf <- tbl_rel_fact_adult_calf[c(1,4,2,5,3,6),]
tbl_rel_fact_adult_calf_rescaled <- MeatValueIndex::get_relative_economic_factors(ptbl_economic_value = tbl_rel_fact_adult_calf,
                                                                      pb_first_col_trait_name = TRUE)

knitr::kable(tbl_rel_fact_adult_calf_rescaled, booktabs = TRUE)

3. Comparison To Values (Szenario B und Szenario B*)

Computing Relative Economic Factors Weithted with proportion of animal categories.

SZENARIO B

The following table shows economic values of r n_nr_trait traits weighted with proportion of animal categories.

knitr::kable( tbl_weighted_rel_factors,
              booktabs = TRUE )

The values in the above table are now re-scaled.

tbl_weighted_rel_factors_rescaled <- MeatValueIndex::get_relative_economic_factors(ptbl_economic_value = tbl_weighted_rel_factors,
                                                                      pb_first_col_trait_name = TRUE)
knitr::kable( tbl_weighted_rel_factors_rescaled, 
              booktabs = TRUE )

SZENARIO B*

The above factors are weighted with the proportion of the aniMal categories

tbl_weighted_rel_fact_adult_calf <- MeatValueIndex::weight_economic_value(ptbl_economic_value = tbl_rel_fact_adult_calf_rescaled,
                                     ptbl_weight = tbl_proportion4eachtrait,
                                     pb_first_col_trait_name = TRUE)
tbl_weighted_rel_fact_adult_calf_rescaled <- MeatValueIndex::get_relative_economic_factors(ptbl_economic_value = tbl_weighted_rel_fact_adult_calf,
                                                                      pb_first_col_trait_name = TRUE)

knitr::kable(tbl_weighted_rel_fact_adult_calf_rescaled, booktabs = TRUE)

Conclusions

Prepare Economic Values Input For Selection Response

tbl_ev_result_ev_per_trait_unit <- tibble::data_frame(Traits = c("cca", "ccc", "cfa", "cfc", "cwa", "cwc"),
                                    OB = c(ev_cca_ob$ev_per_trait_unit, 
                                            ev_ccc_ob$ev_per_trait_unit, 
                                            ev_cfa_ob$ev_per_trait_unit, 
                                            ev_cfc_ob$ev_per_trait_unit, 
                                            ev_cwa_ob$ev_per_trait_unit, 
                                            ev_cwc_ob$ev_per_trait_unit),
                                    BV = c(ev_cca_bv$ev_per_trait_unit, 
                                            ev_ccc_bv$ev_per_trait_unit, 
                                            ev_cfa_bv$ev_per_trait_unit, 
                                            ev_cfc_bv$ev_per_trait_unit, 
                                            ev_cwa_bv$ev_per_trait_unit, 
                                            ev_cwc_bv$ev_per_trait_unit),
                                    SI = c(ev_cca_si$ev_per_trait_unit, 
                                            ev_ccc_si$ev_per_trait_unit, 
                                            ev_cfa_si$ev_per_trait_unit, 
                                            ev_cfc_si$ev_per_trait_unit, 
                                            ev_cwa_si$ev_per_trait_unit, 
                                            ev_cwc_si$ev_per_trait_unit),
                                    SF = c(ev_cca_sf$ev_per_trait_unit, 
                                            ev_ccc_sf$ev_per_trait_unit, 
                                            ev_cfa_sf$ev_per_trait_unit, 
                                            ev_cfc_sf$ev_per_trait_unit, 
                                            ev_cwa_sf$ev_per_trait_unit, 
                                            ev_cwc_sf$ev_per_trait_unit),
                                    MO = c(ev_cca_mo$ev_per_trait_unit, 
                                            ev_ccc_mo$ev_per_trait_unit, 
                                            ev_cfa_mo$ev_per_trait_unit, 
                                            ev_cfc_mo$ev_per_trait_unit, 
                                            ev_cwa_mo$ev_per_trait_unit, 
                                            ev_cwc_mo$ev_per_trait_unit))
#Äquivalent zu Szenario A per_trait_units
(tbl_rel_factors_per_trait_units <- MeatValueIndex::get_relative_economic_factors(ptbl_economic_value = tbl_ev_result_ev_per_trait_unit,
                                                 pb_first_col_trait_name = TRUE))
(tbl_rel_factors_adult_per_trait_units <- MeatValueIndex::get_relative_economic_factors(ptbl_economic_value = tbl_ev_result_ev_per_trait_unit[vec_row_idx_adult,],
                                                 pb_first_col_trait_name = TRUE))
(tbl_rel_factors_calf_per_trait_units <- MeatValueIndex::get_relative_economic_factors(ptbl_economic_value = tbl_ev_result_ev_per_trait_unit[vec_row_idx_calves,],
                                                 pb_first_col_trait_name = TRUE))
tbl_rel_fact_adult_calf_per_trait_units <- bind_rows(tbl_rel_factors_adult_per_trait_units, tbl_rel_factors_calf_per_trait_units)
(tbl_rel_fact_adult_calf_per_trait_units <- tbl_rel_fact_adult_calf_per_trait_units[c(1,4,2,5,3,6),])
#Äquivalent zu Szenario A* per_trait_units
(tbl_rel_fact_adult_calf_per_trait_units_rescaled <- MeatValueIndex::get_relative_economic_factors(ptbl_economic_value = tbl_rel_fact_adult_calf_per_trait_units,
                                                                      pb_first_col_trait_name = TRUE))
(tbl_weighted_rel_factors_per_trait_units <- MeatValueIndex::weight_economic_value(ptbl_economic_value = tbl_rel_factors_per_trait_units,
                                     ptbl_weight = tbl_proportion4eachtrait,
                                     pb_first_col_trait_name = TRUE))

Äquivalent zu Szenario B per_trait_units

tbl_weighted_rel_factors_per_trait_units_rescaled <- MeatValueIndex::get_relative_economic_factors(ptbl_economic_value = tbl_weighted_rel_factors_per_trait_units,
                                                                      pb_first_col_trait_name = TRUE)
knitr::kable( tbl_weighted_rel_factors_per_trait_units_rescaled, 
              booktabs = TRUE )

Äquivalent zu Szenario B* per_trait_units

#Äquivalent zu Szenario B* per_trait_units
tbl_weighted_rel_fact_adult_calf_per_trait_units <- MeatValueIndex::weight_economic_value(ptbl_economic_value = tbl_rel_fact_adult_calf_per_trait_units_rescaled,
                                     ptbl_weight = tbl_proportion4eachtrait,
                                     pb_first_col_trait_name = TRUE)
tbl_weighted_rel_fact_adult_calf_rescaled_per_trait_units <- MeatValueIndex::get_relative_economic_factors(ptbl_economic_value = tbl_weighted_rel_fact_adult_calf_per_trait_units,
                                                                      pb_first_col_trait_name = TRUE)

knitr::kable(tbl_weighted_rel_fact_adult_calf_rescaled_per_trait_units, booktabs = TRUE)


pvrqualitasag/MeatValueIndex documentation built on May 13, 2019, 4:44 p.m.