calculate_rmse_rse: Calculate RMSE and RSE for predictive estimates

Description Usage Arguments Value

View source: R/predictive_validity_functions.R

Description

Given a dataset, calculate Root Mean Squared Error and Relative Squared Error (both weighted and unweighted) for predictions across a dataset. The observed data should come in the form of separate numerator and denominator columns, while the estimates should be a single field estimating a rate (i.e. already normalized by denominator)

Usage

1
2
3
4
5
6
7
calculate_rmse_rse(
  in_data,
  num_field,
  denom_field,
  est_field,
  group_fields = NULL
)

Arguments

in_data

Input data.table

num_field

Numerator field for the observed data

denom_field

Denominator field for the observed data

est_field

Estimator field, presented as a rate (num/denom)

group_fields

[optional, default NULL] If the predictive validity metrics should be grouped, list the fields to group them by here. If NULL (the default), the predictive validity metrics will be calculated across the entire dataset

Value

A data.table with the following fields: - 'rmse': Root mean squared error, unweighted - 'rmse_weighted': Root mean squared error, weighted by population size - 'rse': Relative squared error, unweighted - 'rse_weighted': Relative squared error, weighted by population size - Any grouping columns specified in the function arguments


njhenry/covidemr documentation built on Feb. 2, 2022, 2:31 a.m.