fit_modelA: Runs the expectation maximization algorithm for Model A

Description Usage Arguments Value

View source: R/FITTING.R

Description

Runs the expectation maximization algorithm for Model A

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
fit_modelA(
  X,
  y,
  u = NULL,
  d,
  beta = NULL,
  alpha_00 = NULL,
  Gamma = NULL,
  P_00 = 1000 * diag(ncol(y) * d),
  Sigma = NULL,
  Omega = NULL,
  Omega_diagonal = FALSE,
  maxit = 100,
  silent = FALSE,
  tol_finish = 0.001,
  tol_EMstep = 0.001,
  return_covariances = FALSE,
  Gamma_rrr = "identity",
  initialize = "RRR"
)

Arguments

X

predictors (t x q-dimensional)

y

target (t x p-dimensional)

u

additional predictors (t x q-dimensional)

d

latent dimension

beta

starting value for beta, default NULL (RRR)

alpha_00

starting value for the algorithm, default NULL (RRR)

Gamma

starting value for the fixed full-rank coefficient matrix, default NULL (RRR)

P_00

starting state covariance (default 1000 * diag(p x d))

Sigma

column covariance of states (default 0.01 * diag(d))

Omega

error covariance (defaults to residual covariance from RRR, or respective starting values)

Omega_diagonal

logical, indicates whether Omega is assumed to be a diagonal matrix (advisable if p is large)

maxit

maximum number of iterations for the EM algorithm

silent

logical, indicates whether progress should be printed during model fitting

tol_finish

tolerance for stopping the EM algorithm

tol_EMstep

tolerance for iterative estimation during EM step

Output:

return_covariances

logical, indicates whether the state covariances should be returned (might be necessary for evaluation of the likelihood).

Gamma_rrr

type of normalization for the starting values obtained from RRR

initialize

either "RRR" or "random", applies if no starting values are handed over

Value

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

states

The estimated states (i.e. coefficient matrices)

  • filtered (the filtered states)

  • smoothed (the smoothed states)

covariances

The filtered and smoothed covariances and lag-1 covariances (if return_covariances = TRUE)

  • P_t^t filtered covariances

  • P_t^t-1 predicted covariances

  • P_t^T smoothed covariances

  • P_t-1t-2^T smoothed lag-1 covariances

data

the data handed over to the algorithms

  • X predictors

  • y responses

  • u additional predictors

  • Z transition matrices (X_t'beta (x) I_p)

parameters

The parameters that have been fitted during the algorithm, that is

  • Sigma the column covariance of the states

  • Omega the error covariance

  • beta (for model A)

  • alpha (for model B)

likelihoods

list containing Q and data loglikelihood for each iteration

convergence_information

Message containing parameter stages at convergence


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