Build the set of quality-control (QC) thresholds used by the whole
pipeline. Every parameter has a default; override any of them through
....
qc_config(...)An object of class ppt_qc: a named list of parameters.
Station transfer and test interruptions (see prep_visits())
misread_max_visits: a run of at most this many consecutive visits at
another station, inside the pig's visits at its current station, is a
transponder misread: the visits are kept as unidentified visits.
Default 2.
max_gap_days: a pig without any visit for longer than this (e.g.
isolated for treatment, at any station or between two stations) is
flagged as low confidence by clean_weight(). Default 3.
max_jump_kg: body weight jump at a station transfer, beyond the
expected growth over the gap, that gives a warning and flags the pig as
low confidence. Default 10.
Body weight records (used by clean_weight(), in this order)
weight_range: valid body weight of a single record, kg. Default
c(15, 150).
adapt_days: adaptation period after entry, days (default 7). Body
weights of the first adapt_days days after a pig's first visit are
not used (qc_flag = "adaptation"). Their feed intake is kept: it
counts for ADFI and FCR when these days lie inside stage_range (e.g. a
pig that enters at 45 kg with a 30-120 kg stage), and not when the pig
is still below the stage. 0 = off.
weight_track: track the weight of each pig back from the end of the
test (default TRUE). The scale only counts a pig standing on it with
all four feet, so a reading is too light only rarely, while several
small pigs on the scale at once give readings that are too heavy. At
the end of the test the pigs are large and only one fits on the scale,
so the last days are the most reliable. Starting from the median of the
last 3 recorded days and the daily gain of the last 14 days, the weight
is tracked back day by day: a record is kept when it lies within
track_tol (default 8%, at least 2 kg, widened by 0.5 kg per day
without kept records) of the weight expected for that day; the daily
gain is updated from the kept daily weights of the next 10 days. Other
records are removed (qc_flag = "track"). Pigs with less than 7
recorded days or a test shorter than 14 days are not tracked.
weight_outlier: outlier methods applied to the remaining records, one
or more of "rlm" (quadratic robust regression, bisquare weights; a
record with a weight below rlm_cutoff is an outlier), "loess"
(robust LOESS smooth; a record more than sd_max robust SDs from it is
an outlier), "stl" (trend + weekly component of the daily median
weight) and "sd" (quadratic least squares, sd_max SDs). Default
c("rlm", "loess").
outlier_combine: "any" (outlier for any method, default) or
"majority".
rlm_cutoff: default 0.5.
sd_max: default 3.
loess_span: smoothing span for LOESS and STL. Default 0.75.
Pig-level checks (used by clean_weight())
min_records, min_test_days, max_missing_rate: a pig with fewer
valid weights (default 20), a shorter test (default 35 days) or a larger
share of test days without a valid weight (default 0.30) is removed.
entry_weight_max, exit_weight_min: a pig entering heavier (default
65 kg) or leaving lighter (default 85 kg) is flagged as low confidence.
track_flag_share: a pig whose tracking removes more than this share of
its records (default 0.4) is flagged as low confidence: the scale
probably did not weigh it correctly for a long time (e.g. a faulty load
cell).
smooth_r2_min: a pig whose valid weights fit their LOESS smooth with
an R² below this (default 0.99) is flagged as low confidence.
Growth, filled weights and ADG (used by calc_adg())
stage_range: body weight interval for ADG, ADFI and FCR, kg. Default
c(30, 120).
curve_model: growth curve that fixes the stage start and end and fills
the weights before the first and after the last recorded day:
"poly2" (default), "poly1", "poly3" or "gompertz" (falls back
to "poly2" when it does not converge). Missing days between recorded
days are always filled by linear interpolation.
max_extrap_days: maximum extrapolation of the curve, days. Default 30.
curve_extrap: how the curve continues beyond the records.
"start" (default): before the first record a straight line from the
curve at the first record, with the robust slope of the records of the
first 14 days (limited to 0.2-1.5 kg/d); after the last record the
fitted curve itself. "tangent": such a line at both ends; "curve":
the fitted curve at both ends (before version 1.4.0). A polynomial
bends away from the data when it is extrapolated for weeks; the
tangent does not. At the end the tangent gave better ADG but a worse
FCR ranking (the feed of the extrapolated days follows the higher
weights), hence "start". Compare them on your data with
validate_truncation().
Feeder errors (Casey et al. 2005, Table 3)
fiv_range: FIV-lo / FIV-hi, feed intake per visit, g.
fiv0_abs_max: FIV-0, maximum |FIV| for a 0 s visit, g.
duration_max: OTV-hi, maximum occupation time per visit, s.
speed_fiv_lo_max: FRV-hi-FIV-lo, maximum feeding rate for visits with
0 < FIV < 50 g, g/min.
speed_strict_max: FRV-hi-strict, maximum feeding rate when the
preceding or following visit has FIV < -20 g, g/min.
speed_range: FRV-lo and FRV-hi, g/min.
idle_duration_max: FRV-0, maximum occupation time with no intake, s.
trough_diff_range: LWD / FWD, trough weight difference between
subsequent visits, g.
max_unidentified_feed_kg: feed disappearance in unidentified visits
per feeder above which a warning is given.
fiv_max_by_weight: optional table that replaces the upper limit of
fiv_range (FIV-hi) by a limit that depends on body weight, and
optionally on breed. Columns weight_from (kg, lower bound of the
weight class), fiv_max (g) and optionally breed. See
fiv_max_example(). NULL = off.
Daily feed intake (used by calc_adfi())
dfi_range: valid daily feed intake, kg.
dfi_quantile: optional, lower and upper quantile cut-offs (e.g.
c(0.025, 0.99)). NULL = off.
dfi_correct: "lmm" (Jiao et al. 2014) or "none".
impute_method: how missing stage days are filled. Gaps between
recorded days of up to long_gap_days days are filled from a robust
LOESS smooth of the daily intake ("loess_pop", "loess_lm"); longer
gaps and the days before the first / after the last recorded day:
"loess_pop" (default): longer gaps and the days before the first
recorded day from the population curve of daily intake on body weight
(all pigs, or each breed), scaled to the intake level of the pig; the
days after the last recorded day from a linear regression of the pig's
own daily intake on body weight; "loess_lm": the pig's own regression
for all of these; "linear": linear interpolation between recorded
days whatever the gap, the per-pig regression at the ends.
long_gap_days: default 3.
Confidence flags (used by calc_fcr())
max_edge_extrap_days: a pig is "low_confidence" when its weights or
its feed intake are filled over more than this many days at the start
or the end of the stage. Default 15.
min_coverage: minimum share of stage days with recorded feed intake.
Default 0.7.
bin_width: width of the body weight classes used for the segment
checks of calc_fcr(), kg. Default 10.
min_bin_coverage_kg: an inner weight class whose recorded body
weights span less than this many kg flags the pig. Default 6.
bin_fcr_limits: optional table of plausible FCR per weight class,
columns weight_from (kg), fcr_min, fcr_max. See
bin_fcr_example(). NULL = off.
Casey, D. S., Stern, H. S., & Dekkers, J. C. M. (2005). Identification of errors and factors associated with errors in data from electronic swine feeders. Journal of Animal Science, 83, 969-982.
Jiao, S., Maltecca, C., Gray, K. A., & Cassady, J. P. (2014). Feed intake, average daily gain, feed efficiency, and real-time ultrasound traits in Duroc pigs: I. Journal of Animal Science, 92, 2377-2386.