boot_init: Obtain initial values to start the EM algorithm

View source: R/intial_estimation.R

boot_initR Documentation

Obtain initial values to start the EM algorithm

Description

boot_init implements the estimation scheme of the initial parameter values given in Appendix B of Estimation of Impulse-Response Functions with Dynamic Factor Models: A New Parametrization available at https://arxiv.org/pdf/2202.00310.pdf.

Usage

boot_init(data, nu, degs = NULL, reg_prm = 6, nrep = 1, tmpl_mod = NULL)

Arguments

data

matrix of dimension (T x N), where T is the number of observations and N is the number of variables

nu

a vector of Kronecker indices

degs

optional, vector of length 2, where one can specify the degrees of c(z) and d(z), either of the parameters must be equal to max(nu)

reg_prm

integer valued parameter allowing the user to directly estimate initial values from regularized data such that the std deviation of the randomly drawn noise vector of normally distributed values is 10^-reg_prm

nrep

integer, nrep=1 for no bootstrapping of initial values and nrep>1 for nrep bootstraps of initial values

tmpl_mod

optional, supply the template as an input, using this speeds up the function, enabled for convenience of the function do_everything_rmfd

Value

a list of elements

params0

vector of initial values

sigma

estimate of initial error covariance matrix

llval

the log-likelihood value of the initial state space model, returned only if nrep>1

Examples

# compare the difference in computing time
# w/ and w/o bootstrapping
# scale data first
Y <- scale(FRED_light$df)
tmp <- Sys.time()
arg_list <- list(data = Y, nu = c(1,1,1,1), reg_prm = NULL, nrep = 1)
est0 <- do.call(boot_init, arg_list)
time_elapsed <- Sys.time() - tmp
arg_list$nrep <- 10
tmp <- Sys.time()
est1 <- do.call(boot_init, arg_list)
time_elapsed1 <- Sys.time() - tmp
# the computation slows down roughly at a rate 1 sec/1 bootstrap round, and is
# caused by the evaluation of the log-likelihood of the boostrapped models
print(time_elapsed1 - time_elapsed)


juhokalle/rmfd4dfm documentation built on July 18, 2024, 10:19 p.m.