{"id":32209736,"url":"https://github.com/svazzole/sparsevar","last_synced_at":"2026-02-23T05:02:22.333Z","repository":{"id":56935049,"uuid":"57282078","full_name":"svazzole/sparsevar","owner":"svazzole","description":"R package for sparse VAR estimation","archived":false,"fork":false,"pushed_at":"2026-01-25T15:34:53.000Z","size":3982,"stargazers_count":12,"open_issues_count":2,"forks_count":9,"subscribers_count":4,"default_branch":"master","last_synced_at":"2026-01-26T07:12:14.879Z","etag":null,"topics":["econometrics","lasso","mcp","scad","sparse","statistics","time-series","var","vecm"],"latest_commit_sha":null,"homepage":null,"language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/svazzole.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":"svazzole","tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":"paypal.me/svazzole"}},"created_at":"2016-04-28T07:56:02.000Z","updated_at":"2026-01-25T15:35:00.000Z","dependencies_parsed_at":"2022-08-21T06:50:43.141Z","dependency_job_id":null,"html_url":"https://github.com/svazzole/sparsevar","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/svazzole/sparsevar","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svazzole%2Fsparsevar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svazzole%2Fsparsevar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svazzole%2Fsparsevar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svazzole%2Fsparsevar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/svazzole","download_url":"https://codeload.github.com/svazzole/sparsevar/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svazzole%2Fsparsevar/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29738083,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-23T04:51:08.365Z","status":"ssl_error","status_checked_at":"2026-02-23T04:49:15.865Z","response_time":90,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["econometrics","lasso","mcp","scad","sparse","statistics","time-series","var","vecm"],"created_at":"2025-10-22T06:15:45.392Z","updated_at":"2026-02-23T05:02:22.328Z","avatar_url":"https://github.com/svazzole.png","language":"R","readme":"## Sparse VAR (sparsevar)\n[![License](http://img.shields.io/badge/license-GPL%20%28%3E=%202%29-brightgreen.svg?style=flat)](http://www.gnu.org/licenses/gpl-2.0.html)\n[![Version](https://img.shields.io/badge/version-1.0.0-oran.svg)](https://github.com/svazzole/sparsevar)\n[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/sparsevar)](https://cran.r-project.org/package=sparsevar)\n[![Downloads](http://cranlogs.r-pkg.org/badges/sparsevar)](https://cran.r-project.org/package=sparsevar)\n[![Total Downloads](http://cranlogs.r-pkg.org/badges/grand-total/sparsevar?color=brightgreen)](https://cran.r-project.org/package=sparsevar)\n\nSome R functions useful to estimate sparse VAR / VECM models.\n\n### Installation\n\nTo install the stable version from CRAN:\n```r\ninstall.package(\"sparsevar\")\n```\n\nTo install the developing version:\n```r\ninstall.packages(\"devtools\")\ndevtools::install_github(\"svazzole/sparsevar\", \"master\")\n```\n\n### Quick start\n\nTo load the `sparsevar` package simply type\n```r\nlibrary(sparsevar)\n```\n\nUsing the function included in the package, we simply generate a 20x20 VAR(2) process\n```r\nset.seed(1)\nsim \u003c- simulate_var(n = 20, p = 2)\n```\nThis command will generate a model with two sparse matrices with 5% of non-zero entries and a Toeplitz variance-covariance matrix with rho = 0.5.\nWe can estimate the matrices of the process using for example\n```r\nfit \u003c- fit_var(sim$series, p = 2, threshold = TRUE)\n```\n\nThe results can be seen by plotting the two `var` objects\n```r\nplot_var(sim, fit)\n```\nthe first row of the plot is made by the matrices of the simulated process and the second row is formed by their estimates.\n\nThe fit contains also the estimate of the variance/covariance matrix of the residuals\n```r\nplot_matrix(fit$sigma)\n```\n\nwhich can be compared with the covariance matrix of the errors of the generating process\n```r\nplot_matrix(sim$sigma)\n```\n\n### Usage\n\nThe functions included for model estimation are:\n\n- `fit_var`: to estimate a sparse VAR multivariate time series with ENET, SCAD or MC+;\n- `fit_varx`: to estimate a sparse VAR-X model using ENET;\n- `fit_vecm`: to estimate a sparse VECM (Vector Error Correction Model) using LS with penalty (again: ENET, SCAD or MC+);\n- `impulse_response`: compute the impulse response function;\n- `error_bands`: estimate the error bands for the IRF (using bootstrap).\n\nFor simulations:\n\n- `simulate_var`: to generate a sparse VAR multivariate time series;\n- `simulate_varx`: to generate a sparse VARX time series;\n- `create_sparse_matrix`: used to create sparse matrices with a given density.\n\nFor plotting:\n\n- `plot_matrix`: useful to plot matrices and sparse matrices;\n- `plot_var`: plot all the matrices of the model or models in input;\n- `plot_irf`: plot IRF function;\n- `plot_grid_irf`: multiple plots of IRF.\n\n### Papers using `sparsevar`\n[[1](https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1005364)] Gibbons SM, Kearney SM, Smillie CS, Alm EJ (2017) Two dynamic regimes in the human gut microbiome. PLoS Comput. Biol. 13(2): e1005364.\n\n[[2](https://doi.org/10.1016/j.insmatheco.2019.07.004)] Quentin Guibert, Olivier Lopez, Pierrick Piette, Forecasting mortality rate improvements with a high-dimensional VAR, Insurance: Mathematics and Economics, Volume 88, 2019, Pages 255-272, ISSN 0167-6687.\n\n[[2](https://doi.org/10.1016/j.insmatheco.2019.07.004)] Quentin Guibert, Olivier Lopez, Pierrick Piette, Forecasting mortality rate improvements with a high-dimensional VAR, Insurance: Mathematics and Economics, Volume 88, 2019, Pages 255-272, ISSN 0167-6687.\n\n### References\n[[1](https://projecteuclid.org/euclid.aos/1434546214)] Basu, Sumanta; Michailidis, George. Regularized estimation in sparse high-dimensional time series models. Ann. Statist. 43 (2015), no. 4, 1535--1567. doi:10.1214/15-AOS1315.\n\n[[2](https://books.google.it/books/?id=COUFCAAAQBAJ\u0026redir_esc=y)] Lütkepohl, Helmut. New Introduction to Multiple Time Series Analysis. Springer Science \u0026 Business Media, 2005, ISBN 3540277528.\n","funding_links":["https://ko-fi.com/svazzole","paypal.me/svazzole"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsvazzole%2Fsparsevar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsvazzole%2Fsparsevar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsvazzole%2Fsparsevar/lists"}