Calculate fit between target and survey confidence intervals
calc_weight_fit.RdRetrieves pre-calculated confidence intervals for targets and survey data, calculates fit statistics, and prepares data for plotting and analysis.
Value
list with two data.tables:
zone_group: fit statistics by zone group. Columns:
variable
— variable name day_group
— day group label target
— target value target_low
— lower bound for target target_upp
— upper bound for target survey
— survey value survey_low
— lower bound for survey survey_upp
— upper bound for survey abs_diff
— absolute difference pct_diff
— percent difference Additional columns as needed for reporting
region: fit statistics by region. Columns:
variable
— variable name day_group
— day group label target
— target value target_low
— lower bound for target target_upp
— upper bound for target survey
— survey value survey_low
— lower bound for survey survey_upp
— upper bound for survey abs_diff
— absolute difference pct_diff
— percent difference Additional columns as needed for reporting
Details
Reads target and survey confidence intervals from output files.
Joins by geography level and aggregates day groups if requested.
Calculates absolute and percent differences, error bars.
Checks for missing values and stops if found.
Returns a list of data.tables for zone group and region.
See also
calc_survey_ciscripts/weighting/fit_analysis.R
Other survey analysis:
calc_max_error(),
calc_survey_ci()
Examples
## Not run:
run_label <- "test"
settings <- list(outputs_dir = "out")
calc_weight_fit(run_label, settings)
#> Error in get("weight_dow_groups", settings): object 'weight_dow_groups' not found
## End(Not run)