mvar.midcast: Compute multi-step imputations and predictors of a...

View source: R/mvar.midcast.r

mvar.midcastR Documentation

Compute multi-step imputations and predictors of a multivariate process via Levinson-Durbin algorithm with missing values

Description

Background: A multivariate difference-stationary process x_t with w_t = delta(B) x_t may be observed with missing values, and one wants to compute Gaussian conditional expectations of missing values (midcasts), or future values (forecasts), or past values (aftcasts). Also of interest is the Gaussian likelihood resulting from such a sample, and the residuals. It is required that at least d contiguous values be observed, where d is the order of delta(B). If the first d values are contiguous, we can do a forward pass; otherwise, the first set of d contiguous values starts after time index 1, and is marked by t.hash. In this case, we must also do a backward pass, involving aftcasts.

Usage

mvar.midcast(x.acf, z, delta, debug = FALSE)

Arguments

x.acf

Array of dimension N x T x N of autocovariances for process w_t, where there are N series, of total length T each.

z

Differenced data as N x (T+H) matrix, with missing values at various time points. Presumes first T observations are not missing, and latter H observations are missing, being encoded with 1i in that entry. That is, Im(z[,t]) = rep(1i,N) encodes missing values.

delta

Differencing polynomial (corresponds to delta(B) in Background) written in format c(delta0,delta1,...,deltad)

debug

Set to TRUE (FALSE by default) if lik values should be printed to screen

Details

Notes: to get H forecasts, append matrix(1i,N,H) to input x. To get aftcasts, prepend the same. T will be the second dimension of z, and includes the spots taken by aftcasts and forecasts. (So the T for the original dataset could be less than the T used in this function.)

Value

list containing casts.x, casts.var, c(Qseq,logdet), and eps casts.x: N x H matrix of backcasts, midcasts, aftcasts, where H is the total number of time indices with missing values. So if times.na is a subset of seq(1,T) corresponding to indices with missing values, we can fill in all NAs via z[,times.na] <- casts.x. If a subset is missing at some time t, casts.x for that time t contains the casts together with the known values. casts.var: NH x NH matrix of covariances of casting errors. note that casts.var.array <- array(casts.var,c(N,H,N,H)) corresponds to cast.var.array[,j,,k] equal to the covariance between the jth and kth casting errors. If a subset is missing at some time t, the corresponding block of casts.var will have zeros corresponding to the known values. Qseq: quadratic form portion of the Gaussian divergence based on missing value formulation (McElroy and Monsell, 2015 JASA) logdet: log determinant portion of the Gaussian divergence eps: residuals from casting recursions, defined in the manner discussed in Casting paper. Dimension is N x T-(H+d)


jlivsey/sigex documentation built on March 20, 2024, 3:17 a.m.