From 8434bcbf21cd17cec5bcfa5a41219e2fa3a04f70 Mon Sep 17 00:00:00 2001 From: Sebastian Krantz Date: Sat, 1 Apr 2023 10:50:04 +0200 Subject: [PATCH] v0.2.1. --- DESCRIPTION | 2 +- NEWS.md | 4 ++++ README.md | 2 -- docs/404.html | 2 +- docs/CONTRIBUTING.html | 2 +- docs/LICENSE-text.html | 2 +- docs/articles/index.html | 2 +- docs/articles/introduction.html | 33 +++++++++++++-------------- docs/authors.html | 6 ++--- docs/index.html | 3 +-- docs/news/index.html | 8 +++++-- docs/pkgdown.yml | 2 +- docs/reference/BM14_Models.html | 2 +- docs/reference/DFM.html | 5 +--- docs/reference/FIS.html | 2 +- docs/reference/ICr.html | 2 +- docs/reference/SKF.html | 2 +- docs/reference/SKFS.html | 4 ++-- docs/reference/ainv.html | 2 +- docs/reference/as.data.frame.dfm.html | 2 +- docs/reference/dot-VAR.html | 2 +- docs/reference/em_converged.html | 2 +- docs/reference/index.html | 2 +- docs/reference/plot.dfm.html | 2 +- docs/reference/predict.dfm.html | 2 +- docs/reference/residuals.dfm.html | 2 +- docs/reference/summary.dfm.html | 3 +-- docs/reference/tsnarmimp.html | 2 +- 28 files changed, 53 insertions(+), 53 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 37009ed..93b62e2 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: dfms -Version: 0.2.0 +Version: 0.2.1 Title: Dynamic Factor Models Authors@R: c(person("Sebastian", "Krantz", role = c("aut", "cre"), email = "sebastian.krantz@graduateinstitute.ch"), person("Rytis", "Bagdziunas", role = "aut")) diff --git a/NEWS.md b/NEWS.md index 949d0b4..c695737 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +# dfms 0.2.1 + +* Fixed print bug in `summary.dfm`: print method showed that model had AR(1) errors even though `idio.ar1 = FALSE` by default. + # dfms 0.2.0 * Added argument `idio.ar1 = TRUE` allowing estimation of approximate DFM's with AR(1) observation errors. diff --git a/README.md b/README.md index 0eb4ac1..7ec2b5b 100644 --- a/README.md +++ b/README.md @@ -18,8 +18,6 @@ -*** - *dfms* provides efficient estimation of Dynamic Factor Models via the EM Algorithm. Estimation can be done in 3 different ways following: - Doz, C., Giannone, D., & Reichlin, L. (2011). A two-step estimator for large approximate dynamic factor models based on Kalman filtering. *Journal of Econometrics, 164*(1), 188-205. diff --git a/docs/404.html b/docs/404.html index 6a00dc4..49e1352 100644 --- a/docs/404.html +++ b/docs/404.html @@ -32,7 +32,7 @@ dfms - 0.2.0 + 0.2.1 diff --git a/docs/CONTRIBUTING.html b/docs/CONTRIBUTING.html index 0929aa9..811104d 100644 --- a/docs/CONTRIBUTING.html +++ b/docs/CONTRIBUTING.html @@ -17,7 +17,7 @@ dfms - 0.2.0 + 0.2.1 diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index 73cf047..cfe4ca6 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -17,7 +17,7 @@ dfms - 0.2.0 + 0.2.1 diff --git a/docs/articles/index.html b/docs/articles/index.html index 03e104f..4618ca9 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -17,7 +17,7 @@ dfms - 0.2.0 + 0.2.1 diff --git a/docs/articles/introduction.html b/docs/articles/introduction.html index c2074cb..ec00f9b 100644 --- a/docs/articles/introduction.html +++ b/docs/articles/introduction.html @@ -33,7 +33,7 @@ dfms - 0.2.0 + 0.2.1 @@ -73,7 +73,7 @@

Introduction to dfms

Sebastian Krantz

-

2023-03-30

+

2023-04-01

Source: vignettes/introduction.Rmd @@ -104,7 +104,7 @@

2023-03-30

head(colnames(BM14_M)) #> [1] "ip_total" "ip_tot_cstr" "ip_tot_cstr_en" "ip_constr" #> [5] "ip_im_goods" "ip_capital" -plot(scale(BM14_M), lwd = 1) +plot(scale(BM14_M), lwd = 1)

The data frame BM14_Models provides information about the series2, and the various models estimated by @@ -138,7 +138,7 @@

2023-03-30

# log-transforming and first-differencing the data BM14_M[, BM14_Models_M$log_trans] %<>% log() BM14_M_diff = diff(BM14_M) -plot(scale(BM14_M_diff), lwd = 1) +plot(scale(BM14_M_diff), lwd = 1)

Determining the Structure of the Model @@ -155,7 +155,7 @@

Determining the Structure of the #> #> IC1 IC2 IC3 #> 7 7 13 -plot(ic)

+plot(ic)

Another option is to use a Screeplot to gauge the number of factors by looking for a kink in the plot. A mathematical procedure for finding @@ -169,7 +169,7 @@

Determining the Structure of the do not add much to the explanatory power of the model. Next to the number of factors, the lag order of the factor-VAR of the transition equation should be estimated (the default is 1 lag). This can be done -using the VARselect() function from the vars +using the VARselect() function from the vars package, with PCA factor estimates reported by ICr().

 # Using vars::VARselect() with 4 principal components to estimate the VAR lag order
@@ -220,9 +220,9 @@ 

Estimation and Exploration#> f2 0.1347 -0.0024 -0.0342 #> f3 -0.0087 0.1767 0.0249 #> f4 0.0307 0.0662 -0.0035 -plot(model1)

+plot(model1)

-

The model can be investigated using summary(), which +

The model can be investigated using summary(), which returns an object of class ‘dfm_summary’ containing the system matrices and summary statistics of the factors and the residuals in the measurement equation, as well as the R-Squared of the factor model for @@ -230,10 +230,9 @@

Estimation and Exploration
-dfm_summary <- summary(model1)
+dfm_summary <- summary(model1)
 print(dfm_summary) # Large model with > 40 series: defaults to compact = 2
 #> Dynamic Factor Model: n = 92, T = 356, r = 4, p = 3, %NA = 25.8366
-#>    with AR(1) errors: mean(abs(rho)) = 0.253 
 #> 
 #> Call:  DFM(X = BM14_M_diff, r = 4, p = 3)
 #> 
@@ -282,15 +281,15 @@ 

Estimation and Exploration# print(dfm_summary, compact = 1) # print(dfm_summary, compact = 0)

Apart from the model summary, the dfm methods -residuals() and fitted() return observation +residuals() and fitted() return observation residuals and fitted values from the model. The default format is a plain matrix, but the functions also have an argument to return data in the original (input) format.

-plot(resid(model1, orig.format = TRUE))
+plot(resid(model1, orig.format = TRUE))

-plot(fitted(model1, orig.format = TRUE))
+plot(fitted(model1, orig.format = TRUE))

Another way to examine the factor model visually is to plot the Quasi-Maximum-Likelihood (QML) factor estimates against PCA and Two-Step @@ -299,7 +298,7 @@

Estimation and ExplorationDFM() during EM estimation and can also be visualized with plot.dfm.

-plot(model1, method = "all", type = "individual")
+plot(model1, method = "all", type = "individual")

The plot with the various estimates shows that the QML estimates are more volatile in the initial periods where there are many missing @@ -327,13 +326,13 @@

Estimation and Exploration

Forecasting

-

DFM forecasts can be obtained with the predict() method, +

DFM forecasts can be obtained with the predict() method, which dynamically forecasts the factors using the transition equation (default 10 periods), and then also predicts data forecasts using the observation equation. Objects are of class ‘dfm_forecast’

 # 12-period ahead DFM forecast
-fc = predict(model1, h = 12)
+fc = predict(model1, h = 12)
 print(fc)
 #> 12 Step Ahead Forecast from Dynamic Factor Model
 #> 
@@ -379,7 +378,7 @@ 

Forecasting9.

 # Setting an appropriate plot range to see the forecast
-plot(fc, xlim = c(320, 370))
+plot(fc, xlim = c(320, 370))

 # Predicting with Two-Step estimates
diff --git a/docs/authors.html b/docs/authors.html
index 76318f1..dccde00 100644
--- a/docs/authors.html
+++ b/docs/authors.html
@@ -17,7 +17,7 @@
       
       
         dfms
-        0.2.0
+        0.2.1
       
     
@@ -70,13 +70,13 @@

Citation

Krantz S, Bagdziunas R (2023). dfms: Dynamic Factor Models. -R package version 0.2.0, https://sebkrantz.github.io/dfms/. +R package version 0.2.1, https://sebkrantz.github.io/dfms/.

@Manual{,
   title = {dfms: Dynamic Factor Models},
   author = {Sebastian Krantz and Rytis Bagdziunas},
   year = {2023},
-  note = {R package version 0.2.0},
+  note = {R package version 0.2.1},
   url = {https://sebkrantz.github.io/dfms/},
 }
diff --git a/docs/index.html b/docs/index.html index cb2b141..bf86a37 100644 --- a/docs/index.html +++ b/docs/index.html @@ -42,7 +42,7 @@ dfms - 0.2.0 + 0.2.1 @@ -86,7 +86,6 @@ -

dfms provides efficient estimation of Dynamic Factor Models via the EM Algorithm. Estimation can be done in 3 different ways following:

  • Doz, C., Giannone, D., & Reichlin, L. (2011). A two-step estimator for large approximate dynamic factor models based on Kalman filtering. Journal of Econometrics, 164(1), 188-205. doi:10.1016/j.jeconom.2011.02.012

  • diff --git a/docs/news/index.html b/docs/news/index.html index 40af086..c391e63 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -17,7 +17,7 @@ dfms - 0.2.0 + 0.2.1 @@ -51,7 +51,11 @@

    Changelog

    - + +
    • Fixed print bug in summary.dfm: print method showed that model had AR(1) errors even though idio.ar1 = FALSE by default.
    • +
    +
    +
    • Added argument idio.ar1 = TRUE allowing estimation of approximate DFM’s with AR(1) observation errors.

    • Added a small theoretical vignette entitled ‘Dynamic Factor Models: A Very Short Introduction’. This vignette lays a foundation for the present and future functionality of dfms. I plan to implement all features described in this vignette until summer 2023.

    diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index ed31a4a..566e3c2 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -3,5 +3,5 @@ pkgdown: 2.0.6 pkgdown_sha: ~ articles: introduction: introduction.html -last_built: 2023-03-30T11:22Z +last_built: 2023-04-01T08:38Z diff --git a/docs/reference/BM14_Models.html b/docs/reference/BM14_Models.html index 96f6f69..76683aa 100644 --- a/docs/reference/BM14_Models.html +++ b/docs/reference/BM14_Models.html @@ -18,7 +18,7 @@ dfms - 0.2.0 + 0.2.1 diff --git a/docs/reference/DFM.html b/docs/reference/DFM.html index 73b0b83..5c747be 100644 --- a/docs/reference/DFM.html +++ b/docs/reference/DFM.html @@ -18,7 +18,7 @@ dfms - 0.2.0 + 0.2.1 @@ -277,7 +277,6 @@

    Examples

    # Inspecting the model summary(dfm_small) #> Dynamic Factor Model: n = 14, T = 356, r = 2, p = 3, %NA = 38.3628 -#> with AR(1) errors: mean(abs(rho)) = NA #> #> Call: DFM(X = BM14[, BM14_Models$small], r = 2, p = 3) #> @@ -471,7 +470,6 @@

    Examples

    # Inspecting the model summary(dfm_medium) #> Dynamic Factor Model: n = 48, T = 356, r = 3, p = 3, %NA = 32.6135 -#> with AR(1) errors: mean(abs(rho)) = NA #> #> Call: DFM(X = BM14[, BM14_Models$medium], r = 3, p = 3) #> @@ -558,7 +556,6 @@

    Examples

    # Inspecting the model summary(dfm_large) #> Dynamic Factor Model: n = 101, T = 356, r = 6, p = 3, %NA = 29.7363 -#> with AR(1) errors: mean(abs(rho)) = NA #> #> Call: DFM(X = BM14, r = 6, p = 3) #> diff --git a/docs/reference/FIS.html b/docs/reference/FIS.html index 94ec284..4c73c7c 100644 --- a/docs/reference/FIS.html +++ b/docs/reference/FIS.html @@ -17,7 +17,7 @@ dfms - 0.2.0 + 0.2.1 diff --git a/docs/reference/ICr.html b/docs/reference/ICr.html index 9618282..1e18e02 100644 --- a/docs/reference/ICr.html +++ b/docs/reference/ICr.html @@ -18,7 +18,7 @@ dfms - 0.2.0 + 0.2.1 diff --git a/docs/reference/SKF.html b/docs/reference/SKF.html index 9a717f1..9e150f5 100644 --- a/docs/reference/SKF.html +++ b/docs/reference/SKF.html @@ -17,7 +17,7 @@ dfms - 0.2.0 + 0.2.1 diff --git a/docs/reference/SKFS.html b/docs/reference/SKFS.html index da10420..e831791 100644 --- a/docs/reference/SKFS.html +++ b/docs/reference/SKFS.html @@ -17,7 +17,7 @@ dfms - 0.2.0 + 0.2.1 @@ -113,7 +113,7 @@

    See also

    Examples

    library(collapse)
    -#> collapse 1.9.4, see ?`collapse-package` or ?`collapse-documentation`
    +#> collapse 1.9.5, see ?`collapse-package` or ?`collapse-documentation`
     #> 
     #> Attaching package: ‘collapse’
     #> The following object is masked from ‘package:vars’:
    diff --git a/docs/reference/ainv.html b/docs/reference/ainv.html
    index 2953c54..55716a5 100644
    --- a/docs/reference/ainv.html
    +++ b/docs/reference/ainv.html
    @@ -17,7 +17,7 @@
           
           
             dfms
    -        0.2.0
    +        0.2.1
           
         
    diff --git a/docs/reference/as.data.frame.dfm.html b/docs/reference/as.data.frame.dfm.html index f30c121..0a340f0 100644 --- a/docs/reference/as.data.frame.dfm.html +++ b/docs/reference/as.data.frame.dfm.html @@ -17,7 +17,7 @@ dfms - 0.2.0 + 0.2.1
    diff --git a/docs/reference/dot-VAR.html b/docs/reference/dot-VAR.html index 7aa683d..29fd427 100644 --- a/docs/reference/dot-VAR.html +++ b/docs/reference/dot-VAR.html @@ -17,7 +17,7 @@ dfms - 0.2.0 + 0.2.1 diff --git a/docs/reference/em_converged.html b/docs/reference/em_converged.html index 448ed0e..5e9ba82 100644 --- a/docs/reference/em_converged.html +++ b/docs/reference/em_converged.html @@ -17,7 +17,7 @@ dfms - 0.2.0 + 0.2.1 diff --git a/docs/reference/index.html b/docs/reference/index.html index fb41ad8..ecf6e94 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -17,7 +17,7 @@ dfms - 0.2.0 + 0.2.1 diff --git a/docs/reference/plot.dfm.html b/docs/reference/plot.dfm.html index a883261..1af2e27 100644 --- a/docs/reference/plot.dfm.html +++ b/docs/reference/plot.dfm.html @@ -17,7 +17,7 @@ dfms - 0.2.0 + 0.2.1 diff --git a/docs/reference/predict.dfm.html b/docs/reference/predict.dfm.html index 45a24df..76c1822 100644 --- a/docs/reference/predict.dfm.html +++ b/docs/reference/predict.dfm.html @@ -18,7 +18,7 @@ dfms - 0.2.0 + 0.2.1 diff --git a/docs/reference/residuals.dfm.html b/docs/reference/residuals.dfm.html index de6a60c..7fa4ab3 100644 --- a/docs/reference/residuals.dfm.html +++ b/docs/reference/residuals.dfm.html @@ -17,7 +17,7 @@ dfms - 0.2.0 + 0.2.1 diff --git a/docs/reference/summary.dfm.html b/docs/reference/summary.dfm.html index 5c5bb1a..ddd512a 100644 --- a/docs/reference/summary.dfm.html +++ b/docs/reference/summary.dfm.html @@ -18,7 +18,7 @@ dfms - 0.2.0 + 0.2.1 @@ -110,7 +110,6 @@

    Examples

    #> f2 0.0353 0.2270 -0.026 0.0645 -0.0744 0.1802 summary(mod) #> Dynamic Factor Model: n = 9, T = 117, r = 2, p = 3, %NA = 7.5973 -#> with AR(1) errors: mean(abs(rho)) = 0.179 #> #> Call: DFM(X = diff(BM14_Q), r = 2, p = 3) #> diff --git a/docs/reference/tsnarmimp.html b/docs/reference/tsnarmimp.html index afb2fdf..317117c 100644 --- a/docs/reference/tsnarmimp.html +++ b/docs/reference/tsnarmimp.html @@ -18,7 +18,7 @@ dfms - 0.2.0 + 0.2.1