kaushikrch / rucm

Implementation of Unobserved Components Models (UCM) in R
3 stars 3 forks source link

Error in predicting future values using UCM (Unobserved Components Model) #18

Open MarcoVende opened 2 years ago

MarcoVende commented 2 years ago

Hey team, I'm using a Unobserved Components Model to predict future values using several independent variables.

Demand <- read.csv2("Demand.csv") 
# e.g. sample(x = 800 : 15000, size =50)
Cars <- read.csv2("Cars.csv")
#e.g. sample(x = 500 : 800, size =50)
Duration (1-60), Distance (300 and 3000) Rain (between 0 and 500), Sun_hrs (0-12), Temperatur (-3 to 27), Wind (0 to 80)
...
Multivariate_DataFrame <- data.frame(Demand, Cars, Duration, Distance, Rain, Sun, Temperature, Wind)
head(Multivariate_DataFrame)

library(rucm)

ucm_xyz <- ucm(formula = Demand ~ Cars + Duration + Distance + Rain + Regulars + Sun + Temperature + Wind, data = Multivariate_DataFrame, level = TRUE, slope = TRUE, irregular = TRUE, season = TRUE, season.length =12)
print(ucm_xyz)
fitted.values(ucm_xyz$model)

So far the model works and I'm happy with the fitted values.

But when forecasting,

predict(ucm_xyz["model"],newdata = 6)

The error message:

Error in meanf(object, h = h, level = level, fan = fan, lambda = lambda,  : 
  unused argument (newdata = 6)

occurs.

Any help would be fantastic