Skip to contents

Computes a Gaussian response forecast at future occasions of already observed series. The forecast conditions on the complete observed response vector at fitted parameter values. se.fit is the corresponding conditional predictive standard deviation; it excludes uncertainty in the fitted parameters and is not a calibrated prediction interval.

Usage

forecast_temporal(object, newdata, se.fit = FALSE)

Arguments

object

A fitted native temporal gllvmTMB() model.

newdata

A complete trait panel for one or more future series–occasion pairs. Each series must occur in the fitted data and each requested time must be strictly after that series' final fitted time.

se.fit

Return the fitted-parameter conditional predictive standard deviation.

Value

newdata, in its input row order, with est on the Gaussian identity-link scale and, when requested, se.fit.

Details

This first route supports an unreplicated, temporal_indep(), Gaussian identity-link model. It deliberately refuses new series, replicated panels, other temporal covariance modes, non-temporal random-effect tiers, source combinations, past or observed occasions, and non-Gaussian families. Those cases require their own conditioning and validation contracts.

Examples

d <- expand.grid(series = c("a", "b"), occasion = 1:3,
  trait = c("t1", "t2", "t3"), KEEP.OUT.ATTRS = FALSE)
d$value <- with(d, occasion + as.numeric(factor(trait)) / 10)
fit <- gllvmTMB(value ~ 0 + trait +
  temporal_indep(0 + trait | series, time = occasion),
  data = d, unit = "series", family = gaussian(), silent = TRUE,
  control = gllvmTMBcontrol(se = FALSE))
future <- expand.grid(series = c("a", "b"), occasion = 4,
  trait = c("t1", "t2", "t3"), KEEP.OUT.ATTRS = FALSE)
forecast_temporal(fit, future, se.fit = TRUE)
#>   series occasion trait est    se.fit
#> 1      a        4    t1 2.1 0.8164966
#> 2      b        4    t1 2.1 0.8164966
#> 3      a        4    t2 2.2 0.8164966
#> 4      b        4    t2 2.2 0.8164966
#> 5      a        4    t3 2.3 0.8164966
#> 6      b        4    t3 2.3 0.8164966