dfm: Estimates a dynamic factor model based on Doz, Gianone &...

Description Usage Arguments Value Examples

View source: R/dfm.R

Description

Estimates a dynamic factor model based on Doz, Gianone & Reichlin (2011)

Usage

1
2
3
dfm(data, r, p, q = r, max_iter = 100, threshold = 1e-04,
  lower_set = 1e-07, rQ = c("none", "identity"), rC = c("none", "upper"),
  ...)

Arguments

data

Data matrix with time in rows and variables in columns.

r

Number of static factors to estimate.

p

Lag order for factors. It is assumed that factors follow VAR(p) model.

q

Number of dynamic factors, must be equal to or less than r. Dynamic factors refer essentially to the number of principal components relevant for the state covariance estimation.

max_iter

Maximum number of iterations in the EM-algorithm.

threshold

Threshold for algorithm convergence

lower_set

In order to keep an invertible observation covariance matrix, diagonal values are constrained to be such that diag(R)[diag(R) < lower_set] <- lower_set.

rQ

Restrictions on system state covariance. Currently, either no restrictions can be set or Q can be fixed as identity.

rC

Restrictions on factor loading matrix. Currently, either no restrictions can be set or upper matrix of C can be set to 0.

...

Further arguments that are currently unused

Value

3 types of factor estimates, namely principal component estimate, two step estimate based on PCA and Kalman filtering and QML estimate based on EM-algorithm. PCA estimator is not able to deal with missing data.

Examples

1
2
3
4
5
6
7
8
## Not run: 
set.seed(314)
x <- matrix(rnorm(50*10), 50, 10)
W <- as.logical(matrix(rbinom(50*10, 1, 0.1), 50, 10))
x[W] <- NA
dfm(x, 2, 2, 1)

## End(Not run)

SebKrantz/dynfacto_R documentation built on Dec. 31, 2020, 4:30 p.m.