This function implements the Theta method using a Generalized Linear Model (GLM)

glmthetaf(
  y,
  h = ifelse(frequency(y) > 1, 2 * frequency(y), 10),
  level = 95L,
  fit_func = stats::glm,
  predict_func = predict,
  fan = FALSE,
  x = y,
  type_pi = c("gaussian", "conformal-split", "conformal-surrogate",
    "conformal-bootstrap", "conformal-block-bootstrap", "conformal-kde",
    "conformal-fitdistr"),
  attention = TRUE,
  attention_type = c("dot_product", "scaled_dot_product", "cosine", "exponential",
    "gaussian", "linear", "value_based", "hybrid", "parametric"),
  attention_method = c("heuristic", "historical"),
  scale_ctxt = 1,
  historical_lookback = 50L,
  max_adjustment = 0.5,
  B = 250L,
  nsim = B,
  ...
)

Arguments

y

The time series data

h

The number of periods to forecast

level

The confidence level for the forecast intervals

fit_func

The function to use for fitting the GLM (and other models)

predict_func

The function to use for predict the other models (not GLMs)

fan

Logical flag for fan plot

x

The time series data

attention

Logical flag for using attention mechanism

attention_type

The type of attention mechanism to use

attention_method

The method for computing attention-based adjustments: "heuristic" (original) or "historical" (new evidence-based)

scale_ctxt

Scaling coefficient for context vector

historical_lookback

Number of periods to consider for historical matching

max_adjustment

Maximum allowed adjustment percentage (0-1)

B

Number of bootstrap replications or number of simulations (alias: nsim)

nsim

Alias for B

...

Additional arguments to pass to the fit_func

Value

A forecast object