as.data.frame.dfm {dfms} | R Documentation |
Extract Factor Estimates in a Data Frame
Description
Extract Factor Estimates in a Data Frame
Usage
## S3 method for class 'dfm'
as.data.frame(
x,
...,
method = "all",
pivot = c("long", "wide.factor", "wide.method", "wide", "t.wide"),
time = seq_row(x$F_pca),
stringsAsFactors = TRUE
)
Arguments
x |
an object class 'dfm'. |
... |
not used. |
method |
character. The factor estimates to use: any of |
pivot |
character. The orientation of the frame: |
time |
a vector identifying the time dimension, or |
stringsAsFactors |
make factors from method and factor identifiers. Same as option to |
Value
A data frame of factor estimates.
Examples
library(xts)
# Fit DFM with 3 factors and 3 lags in the transition equation
mod = DFM(diff(BM14_M), r = 3, p = 3)
# Taking a single estimate:
print(head(as.data.frame(mod, method = "qml")))
print(head(as.data.frame(mod, method = "qml", pivot = "wide")))
# Adding a proper time variable
time = index(BM14_M)[-1L]
print(head(as.data.frame(mod, method = "qml", time = time)))
# All estimates: different pivoting methods
for (pv in c("long", "wide.factor", "wide.method", "wide", "t.wide")) {
cat("\npivot = ", pv, "\n")
print(head(as.data.frame(mod, pivot = pv, time = time), 3))
}
[Package dfms version 0.2.2 Index]