eval_tvRRR: Filtering for the tvRRR model

Description Usage Arguments Details Value

View source: R/FILTERING.R

Description

Run the Kalman filter for a fixed set of parameters and prespecified model A or B as defined in Brune, Bura and Scherrer (2021+).

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
eval_tvRRR(
  X,
  y,
  u = NULL,
  d,
  model = "A",
  alpha,
  beta,
  Gamma = NULL,
  Omega,
  Sigma,
  P_00
)

filter_modelA(
  y,
  X,
  u = NULL,
  beta,
  alpha_00,
  Gamma = NULL,
  P_00,
  Sigma,
  Omega,
  d,
  return_covariances = TRUE
)

filter_modelB(
  X,
  y,
  u = NULL,
  P_00,
  Sigma,
  Omega,
  beta_00,
  alpha,
  Gamma = NULL,
  d,
  return_covariances = TRUE
)

Arguments

X

the predictors (t x q matrix)

y

the target variable (t x p matrix)

u

(optional) additional predictors that do not necessarily vary in time (t x k matrix)

d

latent dimension (min. 1, no default)

model

specifies the model to be fitted, either "A" or "B"

alpha

starting value for the algorithm, or the time-constant parameter matrix (p x d), for model A this corresponds to alpha_00, for model B it corresponds to the time-constant parameter alpha

beta

starting value for the algorithm, or time-constant parameter matrix (q x d), for model A this corresponds to the time-constant parameter beta, for model B it corresponds to the initial state beta_00

Gamma

(optional), the time constant full rank (t x k) matrix

Omega

error covariance in the measurement equation (symmetric p x p matrix)

Sigma

column covariance of the states alpha_t (symmetric d x d matrix)

P_00

starting covariance for the algorithm (pd x pd matrix)

alpha_00

initial state

return_covariances

logical, indicates whether the filtered and smoothed covariances should be returned, defaults to FALSE.

beta_00

initial state

Details

eval_tvRRR() calls filter_modelA() or filter_modelB() respectively. filter_modelB() processes the transposed states, i.e. when directly using this function make sure you hand over the transposed matrix to beta_00.

Value

An object of class tvRRR, that is a named list of lists with elements

states

the filtered states, a named list with elements

  • filtered (the filtered states) – one state matrix per row (t + 1 x p * d)

  • smoothed (the smoothed states) – one state matrix per row (t + 1 x p * d)

  • one-step-ahead (one-step ahead predictions of the states – one state matrix per row (t + 1 x p * d))

covariances

the filtered and smoothed covariances and lag-1 covariances, if return_covariances = TRUE, a named list with elements

  • P_t^t filtered covariances – array of dimensions (t+1, pd, pd)

  • P_t^t-1predicted covariances – (t, pd, pd)

  • P_t^T smoothed covariances – (t+1, pd, pd)

  • P_t-1t-2^T smoothed lag-1 covariances – (t, pd, pd),

else NULL

prediction_covariance

contains P_t^T[t+1, , ] which is necessary for one-step ahead prediction of tvRRR object.

data

the data handed over to the algorithms, a named list with elements

  • X predictors – (t, q)

  • y responses – (t, p)

  • u additional predictors – (t, k)

  • Z transition matrices (X_t'beta (x) I_p) – (t, p, p*d)

parameters

the parameters used for filtering:

  • Sigma – (d, d)

  • Omega – (p, p)

  • beta – (q, d) (for model A)

  • alpha – (p, d) (for model B)


b-brune/tvRRR documentation built on Dec. 19, 2021, 6:37 a.m.