Inverse penetration rate weights
Source:R/adjust_inverse_penetration.R
adjust_inverse_penetration.RdAdjusts MPD-derived OD flows using inverse penetration weights derived from coverage information on population and active users at origins and/or destinations.
Usage
adjust_inverse_penetration(
mpd_od_df,
coverage_df,
flow_col = "flow",
weight_by = c("origin", "destination", "both")
)Arguments
- mpd_od_df
Data frame of MPD flows with at least:
origin, destination,and a flow column (default"flow"). If present,mpd_sourceis used to match coverage by source.- coverage_df
Data frame with at least:
origin, population, user_count
and optionally
mpd_source.- flow_col
Name of the MPD flow column in
mpd_od_df. Default "flow".- weight_by
One of
"origin","destination","both".
Value
A tibble with:
origin, destination(andmpd_sourceif present),flow: original MPD flow,flow_adj: adjusted flow,weight_origin: origin-side inverse-penetration weight (if applicable),weight_destination: destination-side weight (if applicable),weight_both: geometric mean of the two (ifweight_by = "both").
Details
Notation used throughout:
\(P_i^{(O)}, P_j^{(D)}\): population at origin \(i\) and destination \(j\)
\(U_i^{(O)}, U_j^{(D)}\): active users at origin \(i\) and destination \(j\)
\(F_{ij}^{mpd}\): observed MPD flow from \(i\) to \(j\)
\(F_{ij}^{adj}\): adjusted flow
The coverage data frame is expected to contain, at minimum:
origin,population,user_count
possibly with a mpd_source column for source-specific coverage.
Penetration at origins is defined as
$$p^{(O)}_i = \frac{U^{(O)}_i}{P^{(O)}_i}$$
and the inverse-penetration weight is \(w^{(O)}_i = P^{(O)}_i / U^{(O)}_i\). Analogously for destinations.
For weight_by = "origin", adjusted flows are:
$$F^{adj}_{ij} = w^{(O)}_i F^{mpd}_{ij}.$$
For weight_by = "destination":
$$F^{adj}_{ij} = w^{(D)}_j F^{mpd}_{ij}.$$
For weight_by = "both", we use the geometric mean of the two:
$$w^{(B)}_{ij} = \sqrt{w^{(O)}_i w^{(D)}_j}, \quad F^{adj}_{ij} = w^{(B)}_{ij} F^{mpd}_{ij}.$$