Skip to contents

Calculates root mean squared error (rmse)

Usage

calc_rmse(backtest_summary)

Arguments

backtest_summary

results of backtest call

Value

The Root Mean Squared Error for each of the runs in backtest().

Examples

# Load the data
data(denguedat)

# Run a nowcast with very few iterations
# change to method = "sampling" when working and remove the iter = 10 (or set to iter = 2000)
now <- as.Date("1990-10-01")
ncast <- nowcast(denguedat, "onset_week", "report_week", now = now,
  method = "optimization", seed = 2495624, iter = 10)

# Run a backtest for the model checking the model fit for two dates:
btest <- backtest(ncast, dates_to_test = c(as.Date("1990-06-11"), as.Date("1990-06-18")))

# Get the rmse with the scoringutils package
if (requireNamespace("scoringutils", quietly = TRUE)){
  calc_rmse(btest)
}
#>                                    model        now horizon Strata_unified
#>                                   <char>     <Date>   <num>         <char>
#> 1: model_2025-05-16_19h28m28s_2120140673 1990-06-11       0      No strata
#> 2: model_2025-05-16_19h28m28s_2120140673 1990-06-18       0      No strata
#>      rmse
#>     <num>
#> 1: 10.687
#> 2: 19.340