Compute feed conversion ratio (FCR) from ADG and ADFI over the same body weight stage, flag pigs whose values rely on extrapolation, and summarise the traits.
calc_fcr(adg, adfi, min_coverage = adg$settings$min_coverage, verbose = 1)Result of calc_adg().
Result of calc_adfi() computed from the same adg.
Minimum share of stage days with recorded feed
intake for fcr_flag = "ok". Default: min_coverage of the QC
settings (0.7).
0 (silent), 1 (summary, default) or 2 (details).
An object of class ppt_fcr (a list):
per_pig: adg (g/d), adfi (g/d), fcr, gf, adg_type,
coverage, stage_days, start_weight, end_weight, fcr_flag,
fcr_note;
daily: the daily table of calc_adfi();
summary: numeric summary (n, min, max, median, mean,
sd, cv) of the main traits, for all pigs, for pigs with
fcr_flag = "ok" and, with a breed column, for each breed;
by_bin: one row per pig and body weight class of bin_width kg
(days are put into classes by the growth curve): feed (feed_kg),
gain (gain_kg, from the growth curve), segment fcr,
weight_coverage_kg (span of recorded body weights in the class),
low_coverage (inner class covered by less than
min_bin_coverage_kg) and fcr_out (segment FCR outside
bin_fcr_limits);
removed, settings.
FCR = ADFI / ADG, with ADG the slope of the daily weights over the stage
(observed, interpolated and curve-filled days, see calc_adg()) and ADFI
the mean daily intake over the same days (recorded, corrected and
imputed, see calc_adfi()).
visits <- prep_visits(nedap, verbose = 0)
adg <- calc_adg(clean_weight(visits, verbose = 0), verbose = 0)
adfi <- calc_adfi(visits, adg, verbose = 0)
fcr <- calc_fcr(adg, adfi)
#>
#> ── FCR over 30-120 kg ──────────────────────────────────────────────────────────
#> Pigs with FCR 29
#> └ ok 23 79.3%
#> └ low confidence 6 20.7%
#> ✔ FCR 2.36 ± 0.14 (mean ± SD) 0.0s
head(fcr$per_pig[, .(responder, adg, adfi, fcr, fcr_flag, fcr_note)])
#> responder adg adfi fcr fcr_flag
#> <char> <num> <num> <num> <char>
#> 1: 13913 1209.897 2642.654 2.184196 ok
#> 2: 13918 1162.966 2566.372 2.206747 ok
#> 3: 13954 1124.224 2681.418 2.385127 low_confidence
#> 4: 13996 1334.979 2860.245 2.142538 ok
#> 5: 14962 1278.746 2830.550 2.213536 ok
#> 6: 15006 1317.472 3121.544 2.369343 ok
#> fcr_note
#> <char>
#> 1:
#> 2:
#> 3: weight records cover 5.0 kg of 80-90 kg
#> 4:
#> 5:
#> 6:
fcr$summary[group == "all"]
#> group trait n min max median
#> <char> <char> <int> <num> <num> <num>
#> 1: all adg 29 821.6537633 1404.1822971 1230.4801777
#> 2: all adfi 29 1962.8256429 3540.2716430 2812.5426352
#> 3: all fcr 29 2.1425384 2.7773018 2.3685027
#> 4: all gf 29 0.3600617 0.4667361 0.4222077
#> 5: all stage_days 29 65.0686763 96.0346641 73.5551659
#> 6: all start_weight 29 29.9999925 30.0000105 30.0000000
#> 7: all end_weight 29 81.7066712 120.0000038 119.9999997
#> mean sd cv
#> <num> <num> <num>
#> 1: 1205.2355800 1.325465e+02 1.099756e-01
#> 2: 2844.9425395 3.600194e+02 1.265472e-01
#> 3: 2.3608004 1.423354e-01 6.029118e-02
#> 4: 0.4250185 2.470859e-02 5.813534e-02
#> 5: 75.0289278 7.602231e+00 1.013240e-01
#> 6: 29.9999998 3.541864e-06 1.180622e-07
#> 7: 118.6795398 7.110893e+00 5.991675e-02