long_format: Long format of prediction data.frame

View source: R/long_format.R

long_formatR Documentation

Long format of prediction data.frame

Description

Creates a long format of the predictions

Usage

long_format(fit, Time = NULL)

Arguments

fit

The result from either lm_fit or rls_fit

Time

If the timestamps are missing from the fit object

Details

This functions creates a useful prediction data.frame which can be useful for analysis and plotting.

Value

Data.frame of when the prediction where made, also the prediction value and timestamp.

Examples


# Take data
D <- subset(Dbuilding, c("2010-12-15", "2011-01-01"))
D$y <- D$heatload
D$scoreperiod <- in_range("2010-12-20", D$t)
# Define a model
model <- forecastmodel$new()
model$add_inputs(Ta = "Ta",
                 mu = "one()")
model$add_regprm("rls_prm(lambda=0.99)")
model$kseq <- 1:6
# Fit it
fit <- rls_fit(prm=c(lambda=0.99), model, D)

# Get the forecasts (in fit$Yhat) on long format
long_format(fit)


onlineforecast documentation built on Oct. 12, 2023, 5:15 p.m.