Skip to contents

Pfeifer and Deutsch (1980) space-time models on a T x N field (rows are times, columns sites) with spatial weight matrices of orders 1, 2, ... in weights (order 0 is the identity). StLag: W^(order) z. StAcf: space-time autocorrelation rho_l0(s) = gamma_l0(s) / sqrt(gamma_ll(0) gamma_00(0)) with gamma_lh(s) = (1 / (N (T - s))) sum_t t(W^l z_t) (W^h z_(t+s)), returned as acf[s + 1, l + 1]. StPacf: space-time partial autocorrelation from the space-time Yule-Walker equations, one system per time order k, reported as pacf[k, l + 1]. StarFit: STAR model z_t = sum_k sum_(l in ar[[k]]) phi_kl W^(l) z_(t-k) + e_t by least squares on the N (T - p) stacked observations. StarmaFit: STARMA model (moving-average term subtracted, as in the paper) by conditional least squares, L-BFGS-B with central-difference gradients from the STAR start. StarmaForecast: h-step forecasts with zero future shocks. StPortmanteau: Q = N T sum_s sum_l rho_l0(s)^2 of the residuals against chi^2 on S (L + 1) - n_params degrees of freedom. Fields are centred by their grand mean when center.

Usage

StLag(z, weights, order)

StAcf(x, weights, max_lag_t = 10, max_lag_s = NULL, center = TRUE)

StPacf(
  x,
  weights,
  max_lag_t = 5,
  max_lag_s = NULL,
  center = TRUE,
  method = "pfeifer"
)

StarFit(x, weights, ar, intercept = FALSE, center = TRUE)

StarmaFit(x, weights, ar, ma, center = TRUE, max_iter = 500)

StarmaForecast(fit, x, weights, h = 1)

StPortmanteau(
  residuals,
  weights,
  max_lag_t = 5,
  max_lag_s = NULL,
  n_params = 0
)

Arguments

z

Numeric site vector.

weights

List of spatial weight matrices of orders 1, 2, ....

order

Spatial order (0 returns z).

x

Numeric T x N matrix, rows are times.

max_lag_t

Largest time lag.

max_lag_s

Largest spatial order (default all of weights).

center

Centre by the grand mean.

method

"pfeifer" (time-nested Yule-Walker systems, the published definition) or "starma" (systems nested lexicographically in time lag and spatial order, as the starma package).

ar

List of integer vectors: spatial orders per autoregressive time lag.

intercept

Include an intercept in the STAR least squares.

ma

List of integer vectors: spatial orders per moving-average time lag.

max_iter

Optimiser iterations.

fit

Result of StarFit or StarmaFit.

h

Forecast horizon.

residuals

Residual T x N matrix.

n_params

Number of fitted parameters (portmanteau degrees of freedom).

Value

A list; see each function.

References

Pfeifer, P. E. and Deutsch, S. J. (1980). A three-stage iterative procedure for space-time modeling. Technometrics 22, 35-47.

Examples

W <- list(matrix(c(0, 1, 1, 0), 2))
x <- rbind(c(1, 2), c(2, 3), c(4, 3), c(3, 1), c(2, 2))
StAcf(x, W, max_lag_t = 1)$acf
#>            [,1]       [,2]
#> [1,] 1.00000000  0.1358025
#> [2,] 0.09567901 -0.2129630
StarFit(x, W, list(c(0, 1)))$coefficients
#>      k l       value
#> [1,] 1 0  0.09987072
#> [2,] 1 1 -0.18584357