Hide recorded daily weights of the stage on purpose, fill them again with each method and compare with the recorded values. Errors are measured on the hidden days (filled minus recorded daily weight) and on ADG (against the ADG of all records with the settings of weight).

All weight records of the hidden days are removed before cleaning, and the remaining records are cleaned again with the settings of weight (clean_weight()), so the hidden days do not decide which of the other records are kept (before 1.5.0 the records were cleaned on all days).

validate_weight_fill(
  weight,
  methods = c("linear", "poly1", "poly2", "poly3", "gompertz"),
  extrap = NULL,
  scenarios = c("random30", "blocks3", "late20", "early15"),
  reps = 3,
  max_pigs = NULL,
  seed = 1,
  verbose = 1,
  cores = 1
)

Arguments

weight

Result of clean_weight().

methods

Fill methods to compare:

  • "linear": linear interpolation between recorded days, the growth curve curve_model of the settings before the first and after the last recorded day (the method of calc_adg());

  • "poly1", "poly2", "poly3", "gompertz": that growth curve, fitted on the remaining records, for every missing day.

extrap

Extrapolations of the curve beyond the records to compare (values of curve_extrap): "start", "curve", "tangent" or several. Default: the one of the settings of weight. Other than "curve", a method is labelled e.g. "linear+tangent". It matters for the days hidden at the ends ("late<d>", "early<d>").

scenarios

Patterns of hidden days, as in validate_adfi(): "random<p>", "blocks<n>", "late<d>", "early<d>". Only recorded stage days are hidden.

reps

Number of repetitions per scenario. Default 3.

max_pigs

Use a random sample of at most this many pigs. Default NULL: all.

seed

Random seed.

verbose

0 (silent), 1 (summary and progress, default).

cores

Number of CPU cores. Default 1.

Value

A list of class ppt_validation with

  • summary: one row per scenario and method: daily_rmse and daily_mae (kg, hidden days), daily_bias (kg), adg_bias and adg_rmse (g/d), adg_spearman (rank correlation with the full-data ADG) and n_pigs;

  • per_pig: the errors of every pig, scenario, repetition and method;

  • settings.