Description Usage Arguments Value
View source: R/predictive_validity_functions.R
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)
1 2 3 4 5 6 7 | calculate_rmse_rse(
in_data,
num_field,
denom_field,
est_field,
group_fields = NULL
)
|
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 |
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.