Skip to content

CurtinIDS/MRCIGVAR

Repository files navigation

MRCIGVAR

MRCIGVAR provides data-generation, estimation, model-selection, testing, and impulse-response tools for a family of global and regime-switching multivariate time-series models. The package covers both standard and cointegrated specifications, with particular emphasis on multi-regime cointegrated global VAR systems.

The current refactor standardises the public API around lower snake_case function names while keeping backward-compatible legacy aliases where needed.

Acknowledgment

This repository builds on the original MRCIGVAR package created by Dr Pu Chen (https://orcid.org/0000-0002-9659-8697). We gratefully acknowledge Dr Chen as the founder and original owner of the package. The original repository is available at https://github.com/puchen8229/MRCIGVAR/.

Supported model families

The package currently includes workflows for:

  • VAR
  • CIVAR
  • MRVAR
  • MRCIVAR
  • GVAR
  • CIGVAR
  • MRGVAR
  • MRCIGVAR

Across those families, the package supports:

  • synthetic data generation
  • parameter estimation
  • lag and threshold model selection
  • impulse response functions and confidence bands
  • regime-migration GIRFs
  • constraint and diagnostic routines

Installation

Install the development version from GitHub with:

# install.packages("pak")
pak::pak("CurtinIDS/MRCIGVAR")

For local development, clone the repository and either load or install the package locally:

devtools::load_all()
# or
devtools::install()

Refactored API

The refactored codebase uses a consistent naming scheme:

  • *_data() for data generators and constructors
  • *_estimate() for estimation routines
  • *_select_*() for model-selection helpers
  • irf_*() and girf_*() for response analysis

Examples:

  • cigvar_data(), cigvar_estimate()
  • mrcigvar_data(), mrcigvar_estimate()
  • irf_cigvar_cb(), irf_mrcigvar_cb()

Legacy aliases are still available for backward compatibility, but new code should use the refactored lowercase function names.

Example workflow

Below is a minimal CIGVAR workflow using the refactored API.

library(MRCIGVAR)

n <- 4
p <- matrix(0, nrow = n, ncol = 3)
p[, 1] <- 2
p[, 2] <- 2

res_d <- cigvar_data(
  m = 2,
  n = n,
  p = p,
  T = 200,
  type = "const",
  DFYflag = 0
)

res_e <- cigvar_estimate(res_d)
res_e$Summary

sel <- cigvar_select_(res = res_e, L_V = c(3, 3))
sel[which.min(sel[, ncol(sel)]), ]

irf_cb <- irf_cigvar_cb(
  res = res_e,
  nstep = 12,
  comb = NA,
  irf = "gen1",
  runs = 50,
  conf = c(0.05, 0.95)
)

plot_irf(irf_cb, response = c(1, 2), impulse = c(1, 2), ncol = 2)

For multi-regime workflows, the package provides parallel families such as mrcigvar_data(), mrcigvar_estimate(), mrcigvar_select_(), and irf_mrcigvar_cb().

Further documentation

For longer-form documentation, see the vignette set:

  • vignettes/mrcigvar-introduction.Rmd
  • vignettes/core-model-workflows.Rmd
  • vignettes/mrcigvar-workflow.Rmd
  • vignettes/irf-and-girf.Rmd
  • vignettes/refactor-migration-guide.Rmd

Project status

This repository is under active refactoring. The main goals of the refactor are:

  • consistent public naming
  • clearer roxygen documentation
  • improved module boundaries in R/
  • compatibility wrappers for legacy function names

Documentation and development

  • Edit README.Rmd, not README.md.
  • NAMESPACE is generated by roxygen2.
  • Most files in R/ are split-module outputs and should be edited carefully.
  • The MkDocs site combines native pages in docs/ with generated pages rendered from README.Rmd and selected files in vignettes/.
  • Regenerate the docs pages with Rscript scripts/render-docs.R.
  • Create the docs environment with conda env create -f environment-docs.yml.
  • Activate it with conda activate mrcigvar-docs.
  • Preview the docs locally with mkdocs serve.

Contributor expectations and project conventions are documented in CONTRIBUTING.md.

Issues and feedback

Bug reports and feature requests are best submitted through the GitHub issue tracker:

https://github.com/CurtinIDS/MRCIGVAR/issues

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages