|
11 | 11 | #' Efficient estimation of a Dynamic Factor Model via the EM Algorithm - on stationary data |
12 | 12 | #' with time-invariant system matrices and classical assumptions, while permitting missing data. |
13 | 13 | #' |
14 | | -#' @param X a \code{T x n} numeric data matrix or frame of stationary time series. May contain missing values. |
15 | | -#' @param r integer. number of factors. |
16 | | -#' @param p integer. number of lags in factor VAR. |
17 | | -#' @param \dots (optional) arguments to \code{\link{tsnarmimp}}. |
18 | | -#' @param idio.ar1 logical. Model observation errors as AR(1) processes: \eqn{e_t = \rho e_{t-1} + v_t}{e(t) = rho e(t-1) + v(t)}. \emph{Note} that this substantially increases computation time, and is generaly not needed if \code{n} is large (>30). See theoretical vignette for details. |
| 14 | +#' @param X a \code{T x n} numeric data matrix or frame of stationary time series. May contain missing values. \emph{Note} that data is internally standardized (scaled and centered) before estimation. |
| 15 | +#' @param r integer. Number of factors. |
| 16 | +#' @param p integer. Number of lags in factor VAR. |
| 17 | +#' @param \dots (optional) arguments to \code{\link{tsnarmimp}}. The default settings impute internal missing values with a cubic spline and the edges with the median and a 3-period moving average. |
| 18 | +#' @param idio.ar1 logical. Model observation errors as AR(1) processes: \eqn{e_t = \rho e_{t-1} + v_t}{e(t) = rho e(t-1) + v(t)}. \emph{Note} that this substantially increases computation time, and is generally not needed if \code{n} is large (>30). See theoretical vignette for details. |
19 | 19 | #' @param quarterly.vars character. Names of quarterly variables in \code{X} (if any). Monthly variables should be to the left of the quarterly variables in the data matrix and quarterly observations should be provided every 3rd period. |
20 | | -#' @param rQ character. restrictions on the state (transition) covariance matrix (Q). |
21 | | -#' @param rR character. restrictions on the observation (measurement) covariance matrix (R). |
| 20 | +#' @param rQ character. Restrictions on the state (transition) covariance matrix (Q). |
| 21 | +#' @param rR character. Restrictions on the observation (measurement) covariance matrix (R). |
22 | 22 | #' @param em.method character. The implementation of the Expectation Maximization Algorithm used. The options are: |
23 | 23 | #' \tabular{llll}{ |
24 | 24 | #' \code{"auto"} \tab\tab Automatic selection: \code{"BM"} if \code{anyNA(X)}, else \code{"DGR"}. \cr\cr |
|
77 | 77 | #' \eqn{\textbf{R}}{R} \tab\tab \eqn{n \times n}{n x n} observation covariance matrix. It is diagonal by assumption 2 and identical to \eqn{\textbf{R}}{R} as stated in the dynamic form.\cr\cr |
78 | 78 | #' } |
79 | 79 | # that \eqn{E[\textbf{f}_t|\textbf{F}_{t-1}] = E[\textbf{f}_t|\textbf{f}_{t-1}] = \textbf{A}_1 \textbf{f}_{t-1}}{E[f(t)|F(t-1)] = E[f(t)|f(t-1)] = A1 f(t-1)} (all relationships between lagged factors are captured in \eqn{\textbf{A}_1}{A1}).\cr\cr |
| 80 | +#' The filter is initialized with PCA estimates on the imputed dataset---see \code{\link{SKFS}} for a complete code example. |
| 81 | +#' |
80 | 82 | #' |
81 | 83 | #' @returns A list-like object of class 'dfm' with the following elements: |
82 | | -#' \item{\code{X_imp}}{\eqn{T \times n}{T x n} matrix with the imputed and standardized (scaled and centered) data - with attributes attached allowing reconstruction of the original data: |
| 84 | +#' \item{\code{X_imp}}{\eqn{T \times n}{T x n} matrix with the imputed and standardized (scaled and centered) data---after applying \code{\link{tsnarmimp}}. It has attributes attached allowing for reconstruction of the original data: |
83 | 85 | #' \tabular{llll}{ |
84 | 86 | #' \code{"stats"} \tab\tab is a \eqn{n \times 5}{n x 5} matrix of summary statistics of class \code{"qsu"} (see \code{\link[collapse]{qsu}}).\cr\cr |
85 | 87 | #' \code{"missing"} \tab\tab is a \eqn{T \times n}{T x n} logical matrix indicating missing or infinite values in the original data (which are imputed in \code{X_imp}).\cr\cr |
|
104 | 106 | #' \item{\code{converged}}{single logical valued indicating whether the EM algorithm converged (within \code{max.iter} iterations subject to \code{tol}).} |
105 | 107 | #' \item{\code{anyNA}}{single logical valued indicating whether there were any (internal) missing values in the data (determined after removal of rows with too many missing values). If \code{FALSE}, \code{X_imp} is simply the original data in matrix form, and does not have the \code{"missing"} attribute attached.} |
106 | 108 | #' \item{\code{rm.rows}}{vector of any cases (rows) that were removed beforehand (subject to \code{max.missing} and \code{na.rm.method}). If no cases were removed the slot is \code{NULL}. } |
| 109 | +#' \item{\code{quarterly.vars}}{names of the quarterly variables (if any).} |
107 | 110 | #' \item{\code{em.method}}{The EM method used.} |
108 | 111 | #' \item{\code{call}}{call object obtained from \code{match.call()}.} |
109 | 112 | #' |
|
0 commit comments