The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
When generating a forecast, sometimes you might be interested in forecasting the historical observations. These predictions, known as fitted values, can help you better understand and evaluate a model’s performance over time.
TimeGPT
has a method for generating fitted values, and
users can call it from nixtlar
. This vignette will explain
how to do this. It assumes you have already set up your API key. If you
haven’t done this, please read the Get
Started vignette first.
For this vignette, we’ll use the electricity consumption dataset that
is included in nixtlar
, which contains the hourly prices of
five different electricity markets.
To generate a forecast for the historical data, use
nixtlar::nixtla_client_historic
, which should include the
following parameters:
ds
and y
. If your column names are
different, specify them with time_col
and
target_col
, respectively. If you are working with multiple
series, you must also include a column with unique identifiers. The
default name for this column is unique_id
; if different,
specify it with id_col
.nixtla_client_fitted_values <- nixtla_client_historic(df, level = c(80,95))
#> Frequency chosen: h
head(nixtla_client_fitted_values)
#> ds TimeGPT TimeGPT-lo-80 TimeGPT-lo-95 TimeGPT-hi-80
#> 1 2016-10-27 00:00:00 56.07623 25.27245 8.965920 86.88000
#> 2 2016-10-27 01:00:00 52.41973 21.61596 5.309425 83.22350
#> 3 2016-10-27 02:00:00 52.81474 22.01096 5.704433 83.61852
#> 4 2016-10-27 03:00:00 52.59026 21.78649 5.479953 83.39404
#> 5 2016-10-27 04:00:00 52.67297 21.86920 5.562667 83.47675
#> 6 2016-10-27 05:00:00 54.10659 23.30282 6.996284 84.91036
#> TimeGPT-hi-95
#> 1 103.18653
#> 2 99.53004
#> 3 99.92505
#> 4 99.70057
#> 5 99.78328
#> 6 101.21690
Notice that there are no fitted values for some of the initial
observations. This is because TimeGPT
requires a minimum
number of values to generate a forecast for the historical data.
All the fitted values are generated using a rolling window, meaning that the fitted value for observation \(T\) is generated using the first \(T-1\) observations.
nixtlar::nixtla_client_forecast
nixtlar::nixtla_client_historic
is the dedicated
function that calls TimeGPT
’s method for generating fitted
values. However, you can also use
nixtlar::nixtla_client_forecast
with
add_history=TRUE
. This will generate both a forecast for
the historical data and for the next \(h\) future observations.
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.