fnets: An R Package for Network Estimation and Forecasting via Factor-Adjusted VAR Modelling

Vector autoregressive (VAR) models are useful for modelling high-dimensional time series data. This paper introduces the package fnets, which implements the suite of methodologies proposed by (Barigozzi et al. 2023) for the network estimation and forecasting of high-dimensional time series under a factor-adjusted vector autoregressive model, which permits strong spatial and temporal correlations in the data. Additionally, we provide tools for visualising the networks underlying the time series data after adjusting for the presence of factors. The package also offers data-driven methods for selecting tuning parameters including the number of factors, the order of autoregression, and thresholds for estimating the edge sets of the networks of interest in time series analysis. We demonstrate various features of fnets on simulated datasets as well as real data on electricity prices.

Dom Owens (School of Mathematics, University of Bristol) , Haeran Cho (School of Mathematics, University of Bristol) , Matteo Barigozzi (Department of Economics, Università di Bologna)
2023-12-18

0.1 Supplementary materials

Supplementary materials are available in addition to this article. It can be downloaded at RJ-2023-070.zip

S. C. Ahn and A. R. Horenstein. Eigenvalue ratio test for the number of factors. Econometrica, 81(3): 1203–1227, 2013. URL https://doi.org/10.3982/ECTA8968.
L. Alessi, M. Barigozzi and M. Capasso. Improved penalization for determining the number of factors in approximate factor models. Statistics & Probability Letters, 80(23-24): 1806–1813, 2010. URL https://doi.org/10.1016/j.spl.2010.08.005.
M. Avarucci, M. Cavicchioli, M. Forni and P. Zaffaroni. The main business cycle shock(s): Frequency-band estimation of the number of dynamic factors. 2022. URL https://dx.doi.org/10.2139/ssrn.3970658.
J. Bai. Inferential theory for factor models of large dimensions. Econometrica, 71(1): 135–171, 2003. URL https://doi.org/10.1111/1468-0262.00392.
J. Bai and S. Ng. Determining the number of factors in approximate factor models. Econometrica, 70: 191–221, 2002. URL https://doi.org/10.1111/1468-0262.00273.
P. Bai. LSVAR: Estimation of low rank plus sparse structured vector auto-regressive (VAR) model. 2021. URL https://CRAN.R-project.org/package=LSVAR. R package version 1.2.
M. Barigozzi and C. Brownlees. Nets: Network estimation for time series. Journal of Applied Econometrics, 34: 347–364, 2019. URL https://doi.org/10.1002/jae.2676.
M. Barigozzi, H. Cho and D. Owens. FNETS: Factor-adjusted network estimation and forecasting for high-dimensional time series. Journal of Business & Economic Statistics, 1–13, 2023. URL https://doi.org/10.1080/07350015.2023.2257270.
S. Basu and G. Michailidis. Regularized estimation in sparse high-dimensional time series models. The Annals of Statistics, 43: 1535–1567, 2015. URL 10.1214/15-AOS1315.
A. Beck and M. Teboulle. A fast iterative shrinkage-thresholding algorithm for linear inverse problems. SIAM Journal on Imaging Sciences, 2(1): 183–202, 2009. URL https://doi.org/10.1137/080716542.
C. Bergmeir, R. J. Hyndman and B. Koo. A note on the validity of cross-validation for evaluating autoregressive time series prediction. Computational Statistics & Data Analysis, 120: 70–83, 2018.
M. Berkelaar et al. lpSolve: Interface to “lpsolve” v. 5.5 to solve linear/integer programs. 2020. URL https://CRAN.R-project.org/package=lpSolve. R package version 5.6.15.
B. S. Bernanke, J. Boivin and P. Eliasz. Measuring the effects of monetary policy: A factor-augmented vector autoregressive (FAVAR) approach. The Quarterly journal of economics, 120(1): 387–422, 2005. URL https://doi.org/10.1162/0033553053327452.
M. Billio, M. Getmansky, A. W. Lo and L. Pelizzon. Econometric measures of connectedness and systemic risk in the finance and insurance sectors. Journal of Financial Economics, 104(3): 535–559, 2012. URL https://doi.org/10.1016/j.jfineco.2011.12.010.
C. Brownlees. Nets: Network estimation for time series. 2020. URL https://CRAN.R-project.org/package=nets. R package version 0.9.1.
T. T. Cai, W. Liu and H. H. Zhou. Estimating sparse precision matrix: Optimal rates of convergence and adaptive estimation. The Annals of Statistics, 44(2): 455–488, 2016. URL 10.1214/13-AOS1171.
T. Cai, W. Liu and X. Luo. A constrained \(\ell_1\) minimization approach to sparse precision matrix estimation. Journal of the American Statistical Association, 106(494): 594–607, 2011. URL https://doi.org/10.1198/jasa.2011.tm10155.
E. Candes and T. Tao. The dantzig selector: Statistical estimation when p is much larger than n. The Annals of Statistics, 35(6): 2313–2351, 2007. URL 10.1214/009053606000001523.
J. Chen and Z. Chen. Extended bayesian information criteria for model selection with large model spaces. Biometrika, 95(3): 759–771, 2008. URL https://doi.org/10.1093/biomet/asn034.
G. Csardi, T. Nepusz, et al. The igraph software package for complex network research. InterJournal, complex systems, 1695(5): 1–9, 2006.
R. Dahlhaus. Graphical interaction models for multivariate time series. Metrika, 51(2): 157–172, 2000. URL https://doi.org/10.1007/s001840000055.
Douglas Nychka, Reinhard Furrer, John Paige and Stephan Sain. Fields: Tools for spatial data. 2021. URL https://github.com/dnychka/fieldsRPackage. R package version 14.1.
M. Eichler. Granger causality and path diagrams for multivariate time series. Journal of Econometrics, 137(2): 334–353, 2007. URL http://dx.doi.org/10.1016/j.jeconom.2005.06.032.
S. Epskamp, L. J. Waldorp, R. Mõttus and D. Borsboom. The gaussian graphical model in cross-sectional and time-series data. Multivariate Behavioral Research, 53(4): 453–480, 2018. URL https://doi.org/10.1080/00273171.2018.1454823.
J. Fan, Y. Liao and M. Mincheva. Large covariance estimation by thresholding principal orthogonal complements. Journal of the Royal Statistical Society: Series B (Statistical Methodology), 75(4): 2013. URL https://doi.org/10.1111/rssb.12016.
M. Forni, M. Hallin, M. Lippi and L. Reichlin. The generalized dynamic factor model: One-sided estimation and forecasting. Journal of the American statistical association, 100(471): 830–840, 2005. URL https://doi.org/10.1198/016214504000002050.
M. Forni, M. Hallin, M. Lippi and L. Reichlin. The generalized dynamic-factor model: Identification and estimation. Review of Economics and Statistics, 82(4): 540–554, 2000. URL http://dx.doi.org/10.1162/003465300559037.
M. Forni, M. Hallin, M. Lippi and P. Zaffaroni. Dynamic factor models with infinite-dimensional factor space: Asymptotic analysis. Journal of Econometrics, 199(1): 74–92, 2017. URL https://doi.org/10.1016/j.jeconom.2017.04.002.
M. Forni, M. Hallin, M. Lippi and P. Zaffaroni. Dynamic factor models with infinite-dimensional factor spaces: One-sided representations. Journal of Econometrics, 185(2): 359–371, 2015. URL https://doi.org/10.1016/j.jeconom.2013.10.017.
M. Hallin and R. Liška. Determining the number of factors in the general dynamic factor model. Journal of the American Statistical Association, 102(478): 603–617, 2007. URL https://doi.org/10.1198/016214506000001275.
F. Han, H. Lu and H. Liu. A direct estimation of high dimensional stationary vector autoregressions. Journal of Machine Learning Research, 16(97): 3115–3150, 2015. URL http://jmlr.org/papers/v16/han15a.html.
L. Han, I. Cribben and S. Trueck. Extremal dependence in australian electricity markets. arXiv preprint arXiv:2202.09970, 2022. URL https://doi.org/10.48550/arXiv.2202.09970.
J. M. Haslbeck and L. J. Waldorp. Mgm: Estimating time-varying mixed graphical models in high-dimensional data. Journal of Statistical Software, 93: 1–46, 2020. URL https://doi.org/10.18637/jss.v093.i08.
C. Kirch, B. Muhsal and H. Ombao. Detection of changes in multivariate time series with application to EEG data. Journal of the American Statistical Association, 110: 1197–1216, 2015. URL https://doi.org/10.1080/01621459.2014.957545.
M. Knight, K. Leeming, G. Nason and M. Nunes. Generalized network autoregressive processes and the GNAR package. Journal of Statistical Software, 96: 1–36, 2020.
A. B. Kock and L. Callot. Oracle inequalities for high dimensional vector autoregressions. Journal of Econometrics, 186(2): 325–344, 2015. URL https://doi.org/10.1016/j.jeconom.2015.02.013.
G. M. Koop. Forecasting with medium and large bayesian VARs. Journal of Applied Econometrics, 28(2): 177–203, 2013. URL https://doi.org/10.1002/jae.1270.
J. Krampe and L. Margaritella. Dynamic factor models with sparse VAR idiosyncratic components. arXiv preprint arXiv:2112.07149, 2021. URL https://doi.org/10.48550/arXiv.2112.07149.
S. Krantz and R. Bagdziunas. Dfms: Dynamic factor models. 2023. URL https://sebkrantz.github.io/dfms/. R package version 0.2.1.
B. Liu, X. Zhang and Y. Liu. Simultaneous change point inference and structure recovery for high dimensional gaussian graphical models. Journal of Machine Learning Research, 22(274): 1–62, 2021. URL https://www.jmlr.org/papers/volume22/20-327/20-327.pdf.
L. Liu and D. Zhang. Robust estimation of high-dimensional vector autoregressive models. arXiv preprint arXiv:2109.10354, 2021.
H. Lütkepohl. New introduction to multiple time series analysis. Springer Science & Business Media, 2005.
K. Maciejowska and R. Weron. Forecasting of daily electricity spot prices by incorporating intra-day relationships: Evidence from the UK power market. In 2013 10th international conference on the european energy market (EEM), pages. 1–5 2013. IEEE. URL 10.1109/EEM.2013.6607314.
M. C. Medeiros and E. F. Mendes. \(\ell_1\)-regularization of high-dimensional time-series models with non-gaussian and heteroskedastic errors. Journal of Econometrics, 191(1): 255–271, 2016. URL https://doi.org/10.1016/j.jeconom.2015.10.011.
Microsoft and S. Weston. doParallel: Foreach parallel adaptor for the ’parallel’ package. 2022a. URL https://CRAN.R-project.org/package=doParallel. R package version 1.0.17.
Microsoft and S. Weston. Foreach: Provides foreach looping construct. 2022b. URL https://CRAN.R-project.org/package=foreach. R package version 1.5.2.
L. Mosley, T.-S. Chan and A. Gibberd. sparseDFM: An R package to estimate dynamic factor models with sparse loadings. arXiv preprint arXiv:2303.14125, 2023. URL https://doi.org/10.48550/arXiv.2303.14125.
E. Neuwirth. RColorBrewer: ColorBrewer palettes. 2022. URL https://CRAN.R-project.org/package=RColorBrewer. R package version 1.1-3.
W. B. Nicholson, I. Wilms, J. Bien and D. S. Matteson. High dimensional forecasting via interpretable vector autoregression. Journal of Machine Learning Research, 21(166): 1–52, 2020. URL https://jmlr.org/papers/v21/19-777.html.
W. Nicholson, D. Matteson and J. Bien. Bigvar: Tools for modeling sparse high-dimensional multivariate time series. arXiv preprint arXiv:1702.07094, 2017. URL https://doi.org/10.48550/arXiv.1702.07094.
J. Peng, P. Wang, N. Zhou and J. Zhu. Partial correlation estimation by joint sparse regression models. Journal of the American Statistical Association, 104(486): 735–746, 2009. URL 10.32614/RJ-2021-023.
A. Shojaie and G. Michailidis. Discovering graphical granger causality using the truncating lasso penalty. Bioinformatics, 26(18): i517–i523, 2010. URL https://doi.org/10.1093/bioinformatics/btq377.
J. H. Stock and M. W. Watson. Forecasting using principal components from a large number of predictors. Journal of the American Statistical Association, 97(460): 1167–1179, 2002. URL https://doi.org/10.1198/016214502388618960.
B. Uniejewski, R. Weron and F. Ziel. Variance stabilizing transformations for electricity spot price forecasting. IEEE Transactions on Power Systems, 33(2): 2219–2229, 2017. URL http://dx.doi.org/10.1109/TPWRS.2017.2734563.
S. Vazzoler. Sparsevar: Sparse VAR/VECM models estimation. 2021. URL https://CRAN.R-project.org/package=sparsevar. R package version 0.1.0.
D. Wang and R. S. Tsay. Rate-optimal robust estimation of high-dimensional vector autoregressive models. arXiv preprint arXiv:2107.11002, 2021. URL https://doi.org/10.48550/arXiv.2107.11002.
I. Wilms, S. Basu, J. Bien and D. Matteson. Bigtime: Sparse estimation of large time series models. 2021. URL https://cran.r-project.org/package=bigtime. R package version 0.2.1.
Y. Zheng. An interpretable and efficient infinite-order vector autoregressive model for high-dimensional time series. arXiv preprint arXiv:2209.01172, 2022. URL https://doi.org/10.48550/arXiv.2209.01172.

References

Reuse

Text and figures are licensed under Creative Commons Attribution CC BY 4.0. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: "Figure from ...".

Citation

For attribution, please cite this work as

Owens, et al., "fnets: An R Package for Network Estimation and Forecasting via Factor-Adjusted VAR Modelling", The R Journal, 2023

BibTeX citation

@article{RJ-2023-070,
  author = {Owens, Dom and Cho, Haeran and Barigozzi, Matteo},
  title = {fnets: An R Package for Network Estimation and Forecasting via Factor-Adjusted VAR Modelling},
  journal = {The R Journal},
  year = {2023},
  note = {https://doi.org/10.32614/RJ-2023-070},
  doi = {10.32614/RJ-2023-070},
  volume = {15},
  issue = {3},
  issn = {2073-4859},
  pages = {214-239}
}