R2: Calculate R2 of a Forecast object

Description Usage Arguments Value Examples

Description

R2 takes a Forecast object and returns the R2 of the forecast. R2 is calculated as: cor(forecast, realized)^2

Usage

1

Arguments

Forecast

Forecast object.

Value

R2 value.

Examples

1
2
3
4
5
6
7
8
9
my_forecast <- Forecast(
  origin   = as.Date(c("2010-03-31", "2010-06-30", "2010-09-30", "2010-12-31")),
  future   = as.Date(c("2011-03-31", "2011-06-30", "2011-09-30", "2011-12-31")),
  forecast = c(4.21, 4.27, 5.32, 5.11),
  realized = c(4.40, 4.45, 4.87, 4.77),
  h_ahead  = 4L
)

R2(my_forecast)

lmForc documentation built on Jan. 4, 2022, 1:11 a.m.

Related to R2 in lmForc...