Learn R Programming

fnets

Contains methods for network estimation and forecasting for high-dimensional time series under a factor-adjusted VAR model. See

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

by Dom Owens, Haeran Cho and Matteo Barigozzi arXiv:2301.11675 accompanying the R package, and

FNETS: Factor-adjusted network estimation and forecasting for high-dimensional time series

by Matteo Barigozzi, Haeran Cho and Dom Owens arXiv:2201.06110 for details of the methodology.

Installation

To install fnets from CRAN:

install.packages("fnets")

To install from GitHub:

devtools::install_github("https://github.com/Dom-Owens-UoB/fnets")

Usage

We can generate an example dataset used in the above paper for simulation studies, by separately generating the factor-driven common component and the idiosyncratic VAR process as

set.seed(123)
n <- 500
p <- 50
common <- sim.unrestricted(n, p)
idio <- sim.var(n, p)
x <- common$data + idio$data

Fit a factor-adjusted VAR model with q = 2 factors and lasso for VAR transition matrix estimation

out <- fnets(x, q = 2, var.order = 1, var.method = "lasso", do.lrpc = FALSE)

Plot the Granger network induced by the estimated VAR transition matrices:

plot(out, type = "granger", display = "network")

Estimate and plot the partial-correlation and long-run partial correlation-based networks:

plrpc <- par.lrpc(out)
out$lrpc <- plrpc
out$lrpc.method <- 'par'
plot(out, type = "lrpc", display = "heatmap")

Estimate the (long-run) partial correlation-based networks directly using fnets:

out <- fnets(x, q = 2, var.order = 1, var.method = "lasso", do.lrpc = TRUE)

Forecast n.ahead steps:

pr <- predict(out, n.ahead = 1, common.method = "restricted")
pr$forecast

Copy Link

Version

Install

install.packages('fnets')

Monthly Downloads

218

Version

0.1.6

License

GPL (>= 3)

Maintainer

Haeran Cho

Last Published

January 23rd, 2024

Functions in fnets (0.1.6)

f.func.full

full likelihood
abc.factor.number

Factor number estimator of Alessi, Barigozzi and Capasso (2010)
fnets

Factor-adjusted network estimation
fnets.factor.model

Factor model estimation
common.irf.estimation

Blockwise VAR estimation under GDFM
common.predict

Forecasting the factor-driven common component
factor.number

Factor number selection methods
fnets.var

l1-regularised Yule-Walker estimation for VAR processes
hl.factor.number

Factor number estimator of Hallin and Liška (2007)
fnets.var.internal

internal function for fnets.var
network.fnets

Convert networks estimated by fnets into igraph objects
predict.fm

Forecasting for factor models
predict.fnets

Forecasting by fnets
idio.predict

Forecasting idiosyncratic VAR process
par.lrpc

Parametric estimation of long-run partial correlations of factor-adjusted VAR processes
print.factor.number

Print factor number
plot.threshold

Plotting the thresholding procedure
logfactorial

logarithmic factorial of `n`
print.fnets

Print fnets
network

Convert networks into igraph objects
print.fm

Print factor model
plot_internal

internal function for plot.fnets and network
print.threshold

Print threshold
sim.restricted

Simulate data from a restricted factor model
plot.factor.number

Plot factor number
sim.unrestricted

Simulate data from an unrestricted factor model
sim.var

Simulate a VAR(1) process
static.pca

Static PCA
plot.fnets

Plotting the networks estimated by fnets
threshold

Threshold the entries of the input matrix at a data-driven level
yw.cv

Cross validation for factor-adjusted VAR estimation
tuning_plot

Plotting output for tuning parameter selection in fnets
yw.ic

Information criterion for factor-adjusted VAR estimation
var.dantzig

Dantzig selector-type estimator of VAR processes via constrained l1-minimisation
var.lasso

Lasso-type estimator of VAR processes via l1-regularised M-estimation
dyn.pca

Dynamic PCA
data.unrestricted

Simulated data from the unrestricted factor-adjusted vector autoregression model
ebic

extended Bayesian Information Criterion
Bartlett.weights

Bartlett weights
data.restricted

Simulated data from the restricted factor-adjusted vector autoregression model