Skip to contents

This function simply calculates the aggregated fit in Mean Average Percent Error of the weighted survey data against the targets.

Usage

calc_weight_mape(
  seed_incidence_table,
  target_table,
  weights,
  weight_col = "final_weight"
)

Arguments

seed_incidence_table

data.table with required columns:

  • hh_id_dow — household-day identifier

  • p_* — person-level variables (prefix p_)

  • h_* — household-level variables (prefix h_) Rows: one per household-day. Keys: (hh_id_dow). Modified by reference: no (returns copy).

target_table

data.table with required columns:

  • hh_id_dow — household-day identifier

  • p_* — person-level target variables (prefix p_)

  • h_* — household-level target variables (prefix h_) Rows: one per household-day. Keys: (hh_id_dow). Modified by reference: no (returns copy).

weights

data.table with required columns:

  • hh_id_dow — household-day identifier

  • final_weight — weight value (or as specified by weight_col) Rows: one per household-day. Keys: (hh_id_dow). Modified by reference: no (returns copy).

weight_col

character(1). Name of the column in weights containing the weight values. Default: 'final_weight'.

Value

A numeric value containing the MAPE