Lior Goldemberg
Lior Goldemberg

Reputation: 876

unclear forecast value for R timeseries

I am using hybridForecast R package , and I'm not sure what I'm doing wrong to get a negative forecast:

example:

library("forecastHybrid")
hits=c(1969,2552,3407,3768,1302,2988,3760,2822,3012,2945,2979,3180,4421)
model <- hybridModel(y = hits)
fc <- forecast(model, h = 1)
plot(fc)

upper <- as.numeric(fc[["upper"]][1, 2]) #5107
lower <- as.numeric(fc[["lower"]][1, 2])# -24198
baseline <- as.numeric(fc["mean"][[1]]) # -2143

is there a reason for the negative forecast?

Upvotes: 1

Views: 106

Answers (1)

Alexandre Lohmann
Alexandre Lohmann

Reputation: 41

your vector is not a time series, so the hybridModel function is not able to fit a model.

Try this, using the ts function.

hits=ts(c(1969,2552,3407,3768,1302,2988,3760,2822,3012,2945,2979,3180,4421), frequency=12)
model <- hybridModel(y = hits)
fc <- forecast(model, h = 1)
plot(fc)

The forecasts are "ok" (positive).

enter image description here

Upvotes: 1

Related Questions