Skip to contents

This function takes a data frame, performs RMSE between estimate and actual values on specified grouping variables,

Usage

compute_rmse(data, grouping_by = c("from", "description"))

Arguments

data

A data frame containing the variables 'actual' and 'estimate' for regression.

grouping_by

A character vector specifying the grouping variables

Value

A data frame with columns 'from', 'term', and 'RMSE' representing the grouping variables and the corresponding RMSE values.

Examples

data <- data.frame(from = c("A", "A", "A", "A"),
                   term = c("X", "Y", "X", "Y"),
                   actual = c(1, 2, 3, 4),
                   estimate = c(1.5, 2.5, 3.5, 4.5))
compute_rmse(data, grouping_by = c("from", "term"))
#>   from term RMSE
#> 1    A    X  0.5
#> 2    A    Y  0.5